cfgmgr
Simple out of the box configurations for python projects
Basic usage
import cfgmgr
cfgmgr.make_config(env_prefix="CFG_", file_path="config.json", find_file=True)
some_val = cfgmgr.getkey('key')
cfgmgr.setkey('key', 'new_val')
config = cfgmgr.get() # the global Config object itself
make_config
- Initializes a global
Configas per args specified - Pass in
env_prefixto read values from environment variablesenv_prefixwill be prefixed to the keys before reading the environment variable- Ex.
env_prefix="CFG_"will effectively translatecfgmgr.getkey('foo')toos.getenv('CFG_foo')
- Values are resolved dynamically, so
cfgmgr.getkeywill respect environment variables set viaos.environ(Useful in test cases) file_pathattempts to resolve the extension and defers to the corresponding loader- JSON and env are always supported. TOML is supported on Python 3.11+ (
tomllib). YAML and dotenv are supported when their packages are installed —pip install cfg-mgr[yaml]/cfg-mgr[dotenv]. - Custom Loaders can be implemented and registered via a decorator
cfgmgr.fileloaders.register('.extension')
- JSON and env are always supported. TOML is supported on Python 3.11+ (
find_file, ifTrue, will crawl upwards fromcwduntil it finds a match forfile_pathinclude_key, if given, enables config includes: a config file may name another file under that key to be pulled in as a base. The including file overrides the included one; nested mappings are deep-merged. Include chains are followed recursively and cycles raiseIncludeCycleError.
getkey and setkey
- Getter and setter for individual keys on the global default
Configobject getkey(key, default=None)returns the resolved value, ordefaultif absentsetkey(key, value)sets an override (highest priority)- Both
raise AttributeErrorifmake_confighas not been called prior to the call
get
- Returns the global default
Configobject itself (aMutableMapping), orNoneifmake_confighas not been called - Use it for mapping-style access:
cfgmgr.get()['key'],'key' in cfgmgr.get(), iteration, etc.
Metadata
Release files for cfg-mgr 1.0.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 |
|---|---|---|---|---|
| cfg_mgr-1.0.0.tar.gz | 15.1 kB | With provenance | Details for cfg_mgr-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cfg_mgr-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for cfg_mgr-1.0.0-py3-none-any.whl |
Total release size: 23.8 kB
Release files / cfg_mgr-1.0.0.tar.gz
| Download URL | cfg_mgr-1.0.0.tar.gz |
|---|---|
| Size | 15.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef03534019c524dc953c49774eed824acefe731c5031c201cb87db7b113bd90a
|
|
BLAKE2b-256 checksum How to use checksums |
8b80e4143055e5a7c3500f2345dd3e3482b10a486e8d8f19e512561fbdec2484
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 18, 2026.
Transparency logRelease files / cfg_mgr-1.0.0-py3-none-any.whl
| Download URL | cfg_mgr-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
df17dfdfb48ab34cbf8a3c01a4d205e681ce53e1b4a5360e22df644bf1b0ebf5
|
|
BLAKE2b-256 checksum How to use checksums |
94c3f5b3c4c5d46fefc298373b6852837a221c1bd52505dec599dd2cfc622093
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 18, 2026.
Transparency logSecurity for cfg-mgr 1.0.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cfg_mgr-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 18, 2026.
Transparency logA 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.