Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Merge your config files and set parameters from the command line in a simple way.
CLI Config is a lightweight library that provides routines to merge nested configs and set parameters from command line. It contains many routines to create and manipulate the config as flatten or nested python dictionaries. It also provides processing functions that can change the whole configuration before and after each config manipulation.
The package was initially designed for machine learning experiments where the number of parameters is huge and a lot of them have to be set by the user between each experiment. If your project matches this description, this package is for you!
Here you can find the documentation (built with pdoc3).
The old documentation with readthedocs (1.3.6, not up to date) is also available here.
Here you can find the Pypi page.
In a new virtual environment, simply install the package with:
pip install cliconfig
This package is OS independent and supported on Linux, macOS and Windows.
See the Quick Start section of the documentation for a quick overview.
First of all, make default config yaml file(s) in your project (configs are merged from left to right). Then you can create a config object from these files in python:
# main.py
from cliconfig import make_config
config = make_config('default1.yaml', 'default2.yaml')
Now launch your script with eventually additional config file(s) and parameters by command line. The additional configs are merged on the default one's then the parameters are set.
python main.py --config first.yaml,second.yaml --param1=1 --subconfig.param2='foo'
By default, these additional configs cannot add new parameters to the default config (for security and retro-compatibility reasons).
See the Edge cases section of the documentation for some edge cases due to implementation.
You can add tags @<tag_name>
at the end of parameters names to activate some features.
See the Quick start
section of the documentation for a quick overview.
The default tags include:
@merge_add
, @merge_before
, and @merge_after
: merge other yaml files
indicating the path@copy
: copy another parameter@def
: safely evaluate an expression to define the parameter value (a lot of
operations and functions are available)@type:<my type>
: try to convert and check the type@select
: target a sub-config and delete the sub-config in the parent config@delete
: delete the key from the config@new
: allow adding parameters that are not present in default config@dict
: create a dict object that is not a sub-config (see theIt is also easy to create your own features and possibilities are endless. The way to do it are explained in the Processing section of the documentation.
For development, install the package dynamically and dev requirements with:
pip install -e .
pip install -r requirements-dev.txt
Everyone can contribute to CLI Config, and we value everyone’s contributions. Please see our contributing guidelines for more information 🤗
This program is free software under the MIT License.
It means that:
Copyright © 2023 Valentin Goldité
FAQs
Merge your config files and set parameters from the command line in a simple way.
We found that cliconfig demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.