Fully typed configuration management, powered by Pydantic.
📚 Documentation | 🔧 Installation Guide
nshconfig
is a Python library that enhances Pydantic with additional features for configuration management, particularly useful for machine learning experiments and other applications requiring strongly typed configurations.
pip install nshconfig
To install all optional dependencies, use:
pip install nshconfig[extra]
Please see the Installation Guide for more details.
import nshconfig as C
class MyConfig(C.Config):
field1: int
field2: str
field3: C.AllowMissing[float] = C.MISSING
config = MyConfig.draft()
config.field1 = 42
config.field2 = "hello"
final_config = config.finalize()
- Draft configs for intuitive configuration creation
- Multiple configuration formats (Python, JSON, YAML)
- Dynamic type registry for plugin systems
- Configuration code generation tools
- Built-in PyTorch Lightning integration
- MISSING constant for optional fields
For detailed examples and API reference, please visit the documentation.
Contributions are welcome! Please see our Contributing Guide for details.
Built on top of the excellent pydantic library.
MIT License