Sources

Sources are how config information is gathered. The point at which you need a configuration system is when you want to support more than one source.

Builtin Sources

Sources available if all you have are Python’s basic batteries.

class mincfg.DictSource(cfg_dict: Dict[str, Any])[source]

Uses the supplied dict as a config source. Useful for defaults.

class mincfg.OSEnvironSource(prefix: str)[source]

Uses os.environ as a config source, by parsing PREFIXd keys into hierarchical dictionaries, splitting on _

AddOn Sources

These require support modules be installed.

.env files

Using PyYaml

pip install mincfg[env]
class mincfg.DotEnvFileSource(filename: Path | str, prefix=None)[source]

A .env-file source of configuration information

.ini files

Using configobj

pip install mincfg[ini]
class mincfg.INIFileSource(filename: Path | str)[source]

An INI-file source of configuration information Note that if the top level of the file is not a dict, it will be set as the value of an empty key.

.yaml files

Using python-dotenv

pip install mincfg[yaml]
class mincfg.YamlFileSource(filename: Path | str)[source]

A YAML file source of configuration information. Note that if the top level of the yaml file is not a dict, it will be set as the value of an empty key.

Abstract Sources

…and because there’s always a newer format coming down the line, there’s an Abstract Base Class that they’re all derived from

class mincfg.ConfigSource[source]