Hierarchical Conf
A library for loading configurations (or other metadata) hierarchically based on the current environment
| Source | Downloads | Page | Installation Command |
|---|---|---|---|
| PyPi | Link | pip install hierarchical-conf |
Build status
| Develop | Stable | Documentation | Sonar |
|---|---|---|---|
This library supports Python version 3.7+.
To check library main features you can check Hierarchical Conf's Documentation, which is hosted by Read the Docs.
How to use
Short
An example of how to use the library getting configurations:
from hierarchical_conf.hierarchical_conf import HierarchicalConf
hierarchical_conf = HierarchicalConf(searched_paths=[PROJECT_ROOT])
my_config = hierarchical_conf.get_config("my_config_key")
Long
This tool retrieve the configurations from (YAML) files according to the current environment and files precedence.
It receives a list of paths and searches each one for environment configuration files in an orderly
fashion, loading them when found and overwriting duplicated configuration keys by the value of the key
available in the file loaded at last.
The YAML configuration files are expected to be named with prefixes based on the working environment,
retrieved by the value of a pre-existent operational system environment's variable named ENVIRONMENT.
E.g.: Given the respective environments dev and production configuration files below:
dev_conf.yml:
foo: bar_dev
foo2: bar_dev2
production_conf.yml:
foo: bar_prod
foo2: bar_prod2
and given we are at development environment (ENVIRONMENT=dev), the following code will load the
configuration file from the development environment file (/my_path/dev_conf.yml).
hconf = HierarchicalConf(conf_files_paths=['/my_path/'])
foo_conf = hconf.get_config("foo")
print(foo_conf)
# prints: bar_dev
Given ENVIRONMENT=production, the code above will load the configuration file from
the production environment file (/my_path/production_conf.yml) and print: bar_prod.
To learn more use cases in practice (and about the keys overwriting), see Hierarchical Conf examples
Requirements and Installation
The Hierarchical Conf depends on Python 3.7+
Python Package Index hosts reference to a pip-installable module of this library, using it is as straightforward as including it on your project's requirements.
pip install hierarchical-conf
License
Contributing
All contributions are welcome! Feel free to open Pull Requests. Check the development and contributing guidelines described in CONTRIBUTING.md
Made with ❤️ by the Data Engineering team from QuintoAndar
Metadata
Release files for hierarchical-conf 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hierarchical_conf-1.0.4.tar.gz | 4.8 kB | Without provenance | Details for hierarchical_conf-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hierarchical_conf-1.0.4-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for hierarchical_conf-1.0.4-py2.py3-none-any.whl |
Total release size: 9.6 kB
Release files / hierarchical_conf-1.0.4.tar.gz
| Download URL | hierarchical_conf-1.0.4.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
abeb70822e1bb955ada057861fa5b7d7b4b2b04523720949431598724d56d527
|
|
BLAKE2b-256 checksum How to use checksums |
130511e10beaf1d7d970f8564ec7e5c071505b7025c3c00cd451e02fa4e1f9d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.7.12
|
Release files / hierarchical_conf-1.0.4-py2.py3-none-any.whl
| Download URL | hierarchical_conf-1.0.4-py2.py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
9915ed286d6cd294daab8d75260d910c33d1a8bceaafdce9c6b32323d18752d9
|
|
BLAKE2b-256 checksum How to use checksums |
7e375f8a7d177ad37fba6ea5d335317d80d18dfe64d7430896233d56e3f2993b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.7.12
|
Security for hierarchical-conf 1.0.4
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.