Skip to main content

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 Config as per args specified
  • Pass in env_prefix to read values from environment variables
    • env_prefix will be prefixed to the keys before reading the environment variable
    • Ex. env_prefix="CFG_" will effectively translate cfgmgr.getkey('foo') to os.getenv('CFG_foo')
  • Values are resolved dynamically, so cfgmgr.getkey will respect environment variables set via os.environ (Useful in test cases)
  • file_path attempts 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')
  • find_file, if True, will crawl upwards from cwd until it finds a match for file_path
  • include_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 raise IncludeCycleError.

getkey and setkey

  • Getter and setter for individual keys on the global default Config object
  • getkey(key, default=None) returns the resolved value, or default if absent
  • setkey(key, value) sets an override (highest priority)
  • Both raise AttributeError if make_config has not been called prior to the call

get

  • Returns the global default Config object itself (a MutableMapping), or None if make_config has 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)

Source distribution for cfg-mgr 1.0.0
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)

Table of built distributions (wheels) for cfg-mgr 1.0.0
File Interpreter ABI Platform Actions
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 log

Release 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 log

Security 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.

Select from 2 files

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 log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page