Maison
Maison is a Python library to read configuration settings from configuration files using pydantic
behind the scenes.
It's useful to parse TOML config files.
Note: "If you want to use YAML for your config files use goodconf
instead."
Installation⚑
pip install maison
Usage⚑
from maison import ProjectConfig
config = ProjectConfig(project_name="acme")
foo_option = config.get_option("foo")
print(foo_option)
Read from file⚑
By default, maison
will look for a pyproject.toml
file. If you prefer to look elsewhere, provide a source_files
list to ProjectConfig
and maison
will select the first source file it finds from the list.
from maison import ProjectConfig
config = ProjectConfig(project_name="acme", source_files=["acme.ini", "pyproject.toml"])