Hierarchical python configuration with files, environment variables, command-line arguments.
See GitHub for detailed documentation.
Example
from pconf import Pconf
import json
"""
Setup pconf config source hierarchy as:
1. Environment variables
2. A JSON file located at 'path/to/config.json'
"""
Pconf.env()
Pconf.file('path/to/config.json', encoding='json')
# Get all the config values parsed from the sources
config = Pconf.get()
# Just print everything nicely
print json.dumps(config, sort_keys=True, indent=4)
Run the above script:
pip install pconf
python example.py
The output should be something like this:
{
"HOSTNAME": "bb30700d22d8",
"TERM": "xterm",
"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"PWD": "/",
"SHLVL": "1",
"HOME": "/root",
"no_proxy": "*.local, 169.254/16",
"_": "/usr/bin/env",
"example": {
"another": "stuff",
"key": "value"
}
}
Metadata
Release files for pconf 1.12.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 | |
|---|---|---|---|
| pconf-1.12.0.tar.gz | 11.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pconf-1.12.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.5 kB
Release files / pconf-1.12.0.tar.gz
| Download URL | pconf-1.12.0.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a372f829c255edca5903379ba91402a4374b359c998069b50e1d0c97d9900e2c
|
|
BLAKE2b-256 checksum How to use checksums |
74a7837a156810f796dedd1862f9d10b1d9e63ae1ca075ddd6caa42197736a51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / pconf-1.12.0-py3-none-any.whl
| Download URL | pconf-1.12.0-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
73d8f1bffa4e4875aef1588ba304aac75379aa8468c6308d33204a9d90340c10
|
|
BLAKE2b-256 checksum How to use checksums |
76164f726f85e80f9e52223daf0861e09cc398c5d5f3763ddd8fe346c6c1d338
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|