pydantic loader module.
Project description
PyConfig
Configuration management using pydantic and a bit of sugar.
This library provides a load and save method for pydantic config settings.
"""Small example"""
from pydantic_loader import PydanticConfig
class DummyConfig(PydanticConfig):
"""An app configuration class
Define this class according to pydantic BaseSettings.
"""
a: int = 1
b: str = "ABC"
# Load a json file with config data and include it in the DummyConfig.
config = DummyConfig.load_config("a json config file.json")
# Providing a non existing file will raise a CfgError
# It will return a default instance of the config class when on_error_return_default=True
config = DummyConfig.load_config("invalid_file.json", on_error_return_default=True)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pydantic_loader-0.3.0.tar.gz
(5.2 kB
view hashes)
Built Distribution
Close
Hashes for pydantic_loader-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c02bac1d095ea1861ca0aefabb6db8921be2071a31d644e70741624da9ae775 |
|
MD5 | f638073de63f532cd9f3184297a8b8eb |
|
BLAKE2b-256 | ad51ea1921276c474b08bfae726dffb2377dc99aa49974325f4d0d945ab5293e |