Skip to main content

Simple out-of-box configs

Project description

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.get('key')
cfgmgr.set('key', 'new_val')

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.get('foo') to os.getenv('CFG_foo')
  • Values are resolved dynamically, so cfgmgr.get 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 support is present. TOML, YAML and dotenv are planned.
    • 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

get and set

  • Getter and Setter for the global default Config object
  • raise AttributeError if make_config has not been called prior to a get/set call

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cfg_mgr-0.2.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cfg_mgr-0.2.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file cfg_mgr-0.2.0.tar.gz.

File metadata

  • Download URL: cfg_mgr-0.2.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cfg_mgr-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d5b05e1af688f3bb07ac77055d58911cde63c29533dc09e91c3e1914d3cf463a
MD5 f515b646c2f05348985d4dd1b90d2672
BLAKE2b-256 5389e5aa5c98fff3509e9706a85469436c12750442d79b7806d97ddcc2300b5f

See more details on using hashes here.

Provenance

The following attestation bundles were made for cfg_mgr-0.2.0.tar.gz:

Publisher: release.yml on raghavj98/cfgmgr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cfg_mgr-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: cfg_mgr-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cfg_mgr-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3bb00ac3ea3a30e72d8a10c09b00c3050f13345bc2fa24fbb1e6d02223f046d1
MD5 ed7323a780a8f73166354a2c3dbba56b
BLAKE2b-256 94eef6a889fceecfbd534b43cc1bc0d69a63dfd12aa86a1b48702066ad9b26d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for cfg_mgr-0.2.0-py3-none-any.whl:

Publisher: release.yml on raghavj98/cfgmgr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page