Skip to main content

Python Application Configuration.

Project description

Python Application Configuration. Py-config organizes hierarchical configurations for your app deployments.



pip install py-app-config

Best Practice

Firstly, you should have a config folder under the codebase of your application, like this:

├── config
│   ├──
│   ├── default.json
│   ├── development.json
│   ├── production.json
│   └── test.json

Secondly, set environment variable PY_ENV to one of the names of JOSN files in the config folder, and it defaults to be development.

In your under config folder, these codes can be used:

import os
from py_config import set_config_dir, get_config

config_dir = os.path.abspath(os.path.dirname(__file__))
config = get_config()

Then, you can use from config import config to import your app config in any other places in you codebase.

The final config would merge default.json and <PY_ENV>.json. See dict-recursive-update for the recursive update rules.


# Set the config directory path
    config_dir=None  # Directory path of `config` folder

# Get final config according to the `config_dir`.
# It should be executed every time after a new `config_dir` is set.



Project details

Download files

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

Files for py-app-config, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size py_app_config-1.0.0-py3-none-any.whl (4.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size py-app-config-1.0.0.tar.gz (2.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page