Skip to main content

small tool for project config management

Project description

Simple project config for Python.

You can read configuration from environ or local file with it.

Usuage

Suppose there are some config files.

# filename: default.yml
server:
    port: 80
    hostname: localhost
# filename: override.yml
server:
    port: 443
    hostname: localhost
    backends:
      - 127.0.0.1:80

You can read configuration via this way

$: env SERVER.PORT=8080 ipython
Python 3.6.9 (default, Nov  7 2019, 10:44:02)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help.\

In [1]: from p_config import Config

In [2]: config = Config('default.yml')

In [3]: config['SERVER.PORT']
Out[3]: 80

In [4]: config['SERVER.HOSTNAME']
Out[4]: 'localhost'

In [5]: config.load('override.yml')  # update configuration via local file

In [6]: config['SERVER.PORT']
Out[6]: 443

In [7]: config['SERVER.BACKENDS']
Out[7]: ['127.0.0.1:8080']

In [8]: config.load_env()  # update configuration via environ

In [9]: config['SERVER.PORT']
Out[9]: '8080'

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

p_config-1.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

p_config-1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file p_config-1.0.tar.gz.

File metadata

  • Download URL: p_config-1.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9

File hashes

Hashes for p_config-1.0.tar.gz
Algorithm Hash digest
SHA256 85e72397497ba88a4a1fdf39843f6c87396821fa514a959d4ecc902c198d8ff5
MD5 cbcae62fb889d20e20a2b1fad77237bd
BLAKE2b-256 c74249f717088fb841f7c3281a40b1153c31e41f6f4f66ec3dcbc12840a7eff2

See more details on using hashes here.

File details

Details for the file p_config-1.0-py3-none-any.whl.

File metadata

  • Download URL: p_config-1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9

File hashes

Hashes for p_config-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f8c5b5d4e5d3739af1e3a6aa8d073dcfc12d526382ed7f6eedae58797c542aca
MD5 6e5efa2ce33ef71ca49659634c3efd48
BLAKE2b-256 48f74e6dcb554395158136ac2b96e232104bd5098a098ed32bc11083489cd6e0

See more details on using hashes here.

Supported by

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