A wrapper of python-configuration
Project description
Python Configuration Wrapper
This lib is basically a wrapper of the python-configuration.
It aims at making configuration easy !
Features
Read multi-level configuration values from multiple sources (precedency ordered):
-
Command line arguments given by
--additional-configor-Cparameter.Example:
python app.py -C "database.dialect=postgresql" --additional-config "database.host=postgres.mydomain.org" -C "database.user=admin" -
Environment variables starting with prefix set in the
CONFIG_PREFIXenvironment variable. Level separator is__(double underscore).Example:
CONFIG_PREFIX=TEST TEST__database__user=root python app.py -
Config directories given by
--config-pathor-Pparameter. The value of this parameter must be a directory path in which the sub-directories are multi-level keys, and plain-text files content are values. It's very practical when using secrets in containers.Example:
mkdir /var/run/secrets/database -p echo -n 123456 > /var/run/secrets/database/password python app.py --config-path /var/run/secrets -
Config files given by
--config-fileor-Fparameter. File formats must be among those handled by python-configuration:- json
- ini
- yaml
- toml
- python
Example:
python app.py -F config.json --config-file config.yaml
Installation
pip install python-configuration-wrapper
Usage
# import the config object from the module
# you can do this in every python file you want
from python_configuration_wrapper import config
# get some value from a multi-level key
myvalue = config.myfirstlevel.mysecondlevel.mykey
Example
See test
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python-configuration-wrapper-1.0.6.tar.gz.
File metadata
- Download URL: python-configuration-wrapper-1.0.6.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.6.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fe553d56f49ebeeb450ec6b81b82650070c72063a851c4bbb489aa5cd7ad63d
|
|
| MD5 |
02061e8bb3457ef090343bb7805e712b
|
|
| BLAKE2b-256 |
18c9c1b8ddb9bd3d31f9f2564a560d3181e9e07286d5a94596d6d2b877692cf1
|
File details
Details for the file python_configuration_wrapper-1.0.6-py3-none-any.whl.
File metadata
- Download URL: python_configuration_wrapper-1.0.6-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.6.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cb4c6849817dfbf406ac8a176fcb159c9e46d0e024a968eb36cc66cee683e08
|
|
| MD5 |
52391a070c2ba285e3b7ceccebb910ba
|
|
| BLAKE2b-256 |
8bc23c5adac39bab86e82dbf1d3d4868a8d5ad0204cb58a45189affb39390717
|