CLI Config


CLI config logo


CLI Config: Lightweight library that provides routines to merge nested and flat configs and set parameters from command line. It is also provide processing functions that can change the whole configuration before and after each config merge, config saving and config loading. It also contains many routines to manipulate the config as flatten or nested dicts.

PyPI version PythonVersion License

Ruff_logo Black_logo

Ruff Flake8 Pydocstyle MyPy PyLint

Tests Coverage Documentation Status

Make a default config file in your project (configs are merged from left to right):

# main.py
from cliconfig import make_config

config, _ = make_config('default1.yaml', 'default2.yaml')  # it's a dict

Then launch your script with additional config(s) file(s) and parameters. By default, these additional configs cannot add new parameters to the default config (for security and retro-compatibility reasons).

python main.py --config first.yaml,second.yaml --param1 1 --subconfig.param2 'foo'

See Quickstart section for more details and Processing section for advanced usage.