merge-conf
A configuration aggregator for multiple configuration sources.
Using this library, it is easy to combine multiple configuration or settings sources. The following items can be combined:
- a fixed object with default settings
- command-line arguments
- environment variables
- configuration files like
- .env files
- python files
- ConfigParser style ini files
- toml files
- yaml files
- json files
The basic entry point is the so called MultiConfigurationSource. It can be initialized with an optional, existing configuration object. Multiple ConfigurationSource objects can be added. These objects will be traversed in order of insertion. Each of these instances create a dictionary of configuration entries that will be used to extend or override the previous ones. The resulting object can be received using the read_configuration method.
Example
import merge_conf
config = None # Create existing object
arguments = None # Argument parser result namespace
source = merge_conf.MultiConfigurationSource(config)
source.add(merge_conf.ConfigFileConfigurationSource(
# Configuration file path
))
source.add(merge_conf.EnvironmentVariableSource("MY_APP"))
source.add(merge_conf.ArgParseSource(arguments))
config = source.read_configuration()
In this example, the configuration object will be created first. Then, the configuration file will be created. Afterwards, all environment variables starting with MY_APP_ will be used for configuration. The final configuration item will be fetched from the argparse module.
The trick is to created the configuration namespaces with a little sure instinct, so that items can be overridden.
Installing
The package can be installed using pip. Most support comes out of the box, but for the following features an extra must be activated:
.env file support (dotenv) yaml file support (yaml) toml file support (toml)
Licensing
This library is published under BSD-3-Clause license.
Versioning
This library follows semantic versioning 2.0. Any breaking change will produce a new major release. Versions below 1.0 are considered to have a unstable interface.
Metadata
Release files for merge-conf 0.9.0
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 |
|---|---|---|---|---|
| merge-conf-0.9.0.tar.gz | 15.2 kB | Without provenance | Details for merge-conf-0.9.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| merge_conf-0.9.0-py3-none-any.whl | Python 3 | none | any | Details for merge_conf-0.9.0-py3-none-any.whl |
Total release size: 34.0 kB
Release files / merge-conf-0.9.0.tar.gz
| Download URL | merge-conf-0.9.0.tar.gz |
|---|---|
| Size | 15.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb5d1e7609b7ed649dbb45188d4cc56f503da6e47f66e22110cd296cf59c9a4a
|
|
BLAKE2b-256 checksum How to use checksums |
52d687eaab1bd6545f4d059e9f61431b341a8989e98ff2d701bb5d8bde2befb8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1
|
Release files / merge_conf-0.9.0-py3-none-any.whl
| Download URL | merge_conf-0.9.0-py3-none-any.whl |
|---|---|
| Size | 18.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7655f433085aea638684251922d95ba9f3a5ef088b51d9de5ab3803a6c7115c8
|
|
BLAKE2b-256 checksum How to use checksums |
10fd3616ef58087c821497463f46c767103adc79f99dd9a95bd8e5abd8217eb3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1
|
Security for merge-conf 0.9.0
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.