loadconfig
A tool to simplify configuration management
We live in an incredible moment in software history. As never before, the quality and quantity of excellent open source software have unleashed massive advances in pretty much all fields of human knowledge. It is overwhelming to have such vast posibilities, and often having a hard time trying to understand how the pieces fit together. More importantly, we are concern on how can we use the software for things that matter to us.
Plenty of times we find what is really needed is a small custom configuration we can easily understand and a handful ways to run the software. And although we barely think about it as we are too busy trying to understand all the bells and whistles, the interface and documentation is at the center of any software.
loadconfig syntax is designed to be clean and DRY, to foster descriptive programming, and to leverage version control systems. loadconfig can be used as a light wrapper around programs to make them behave and to document them the way we designed.
>>> from loadconfig import Config
>>> c = Config('greeter: Hi there')
>>> c
{greeter: Hi there}
>>> c.greeter
'Hi there'
$ loadconfig -E="greeter: Welcome to the loadconfig documentation"
export GREETER="Welcome to the loadconfig documentation"
Technical description
loadconfig dynamically creates a python configuration ordered dictionary from sources like the command line, configuration files and yaml strings that can be used in python code and shell scripts. Dependencies are pyyaml and clg.
Installation
Installation is straightforward using a wheel from pypi:
pip install loadconfig
Alternatively, install from github:
pip install git+https://github.com/mzdaniel/loadconfig
Local test and build
Assumptions for this section: A unix system, python >= 3.11, and pip >= 24.3
loadconfig is hosted on github:
# Download the project using git
git clone https://github.com/mzdaniel/loadconfig
cd loadconfig
# or from the source tarball from github, first finding the latest tag
# released on https://github.com/mzdaniel/loadconfig/releases/latest
wget -O- https://github.com/mzdaniel/loadconfig/archive/0.2.0.tar.gz | tar xz
cd loadconfig
!!! note "" loadconfig tests are exhaustive and also tests described in the documentation are exercised to have confidence loadconfig code is as reliable as posible.
python programs and libraries depend on the environment where it is run.
At a minimun, it is adviced to run the tests and build process in a
venv (python virtual environment)
# Create and activate venv (python virtual environment)
python -m venv build/venv
source build/venv/bin/activate
# Install loadconfig dependencies and pytest with coverage and linting
pip install 'clg>=3.3' 'PyYAML>=6.0.2' 'pytest-cov>=6.2.1' 'pytest-ruff>=0.5'
# Run the tests
pytest
Building loadconfig pip installable wheel (on build/wheel) is as easy as:
pip wheel -w build/wheel .
To test and build (on build/site) loadconfig documentation:
pip install 'mkdocs>=1.6.1' 'mkdocs-codeinclude-plugin>=0.2.1'
mkdocs build
If you are curious, since loadconfig 0.1.2, github actions CI continuos integration server shows the test runs for each commit and pull requests done in the loadconfig repo.
Security
Disclosure: loadconfig is meant for both flexibility and productivity. It does not attempt to be safe with untrusted input. There are ways (linux containers, PyPy’s sandboxing) that can be implemented for such environments and left for the user to consider.
Thanks!
- Guido van Rossum and Linus Torvalds
- Raymond Hettinger and Armin Ronacher for OrderedDict
- Clark Evans and Kirill Simonov for YAML and PyYAML implementation
- Steven Bethard and François Ménabé for argparse and CLG implementations
- Holger Krekel for pytest
- David Goodger and Georg Brandl for reStructuredText and Sphinx
- John Gruber and Tom Christie for markdown and Mkdocs
- Solomon Hykes, Jerome Petazzoni and Sam Alba for Docker
- The awesome Python, Linux and Git communities
Metadata
Release files for loadconfig 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| loadconfig-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for loadconfig-0.2.1-py3-none-any.whl |
Release files / loadconfig-0.2.1-py3-none-any.whl
| Download URL | loadconfig-0.2.1-py3-none-any.whl |
|---|---|
| Size | 13.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1941248f3c6bda43ef7d9808a5fd95eac595a13ead5d8e5f55430f1bbccef194
|
|
BLAKE2b-256 checksum How to use checksums |
98050d16c66d49f78610407cda6a18c6ef2c262accb3501aef2eebd214b9ea99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Security for loadconfig 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.