- 🔧 Cyantic v0.3.0 - a little library I wrote that builds complex Python objects (like Tensors) from simple blueprints using @pydantic.dev. (The name comes from cyanotype photography, i.e. the "blueprint") #opensource #python #openscience github.com/flywhl/cyantic
Jan 9, 2025 11:11
- The idea is simple: write an object's Blueprint once, then whenever you need that object in your @pydantic.dev models, just pass in the parameters. In #machinelearning and #neuroai, we build a lot of Tensors from various parameterisations...
- You can also pre-process the raw data using @hooks. The @env:MY_VARIABLE hook loads data from an environment variable. The @value:path.to.val hook references a value in the raw input data. The @import:foo.bar dynamically imports a Python object.
- There is an API for building custom @hooks - they're just functions.
- 👩💻 Want to try it? `uv add cyantic` `pip install cyantic` (renamed from 'cast' 🤫)
- This is part of @flywhl.dev where we're building simple, declarative software tools for science. Come say hi! Discord: discord.gg/fd37MFZ7RS