Simple python configuration tool
ezcfg is a python package that allow you to easily maintain and access configuration throughout your project
- easy registration of configuration
- easy access to configuration
- easy type validation of configuration
- easy loading of configuration from json, ini, or environment variables
How to install
pip install ezcfg
How to use
register your first configuration
from ezcfg.config import ezcfg
ezcfg.register_config(name='myfirstconfig', config_type=str, default='configvalue')
# Access of configuration
print(ezcfg.myfirstconfig)
# "configvalue"
load your config from ini, json, and environment variables
from ezcfg.config import ezcfg
ezcfg.register_config(name='myfirstconfig', config_type=str, default='configvalue')
# load config from json file
ezcfg.load_config_from_json_file('myconfigpath.json')
# load config from ini file
ezcfg.load_config_from_ini_file('myconfigpath.ini', section='DEFAULT')
# load config from environment variables
# you first need to set env_var name
ezcfg.register_config(name='myfirstconfig', config_type=str, default='configvalue', env_var='MYFIRSTCONFIG')
# this will load from MYFIRSTCONFIG env var
ezcfg.load_config_from_env()
automatic type checking
from ezcfg.config import ezcfg
# will raise TypeError
ezcfg.register_config(name='myfirstconfig', config_type=int, default='configvalue')
status
Release files for ezcfg 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ezcfg-0.1.3.tar.gz | 2.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ezcfg-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.8 kB
Release files / ezcfg-0.1.3.tar.gz
| Download URL | ezcfg-0.1.3.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b929c4036f253c5d00eeb7034c610bd455fcd1c9d9304ef95c18d3ddeab2cf15
|
|
BLAKE2b-256 checksum How to use checksums |
402e55e88b2a1d6928c235ec142571318220b0930b72d7ac1210923c8f13a2b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5
|
Release files / ezcfg-0.1.3-py3-none-any.whl
| Download URL | ezcfg-0.1.3-py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8bfd0b9460b2307e0bf277f9125d21fbba4db0c13dec47f9f40a39bdd785d34
|
|
BLAKE2b-256 checksum How to use checksums |
0c0bd5103a6ca5e7fa6c4301992d643ec975b1fea3e7ae9fa40563c1a0148640
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5
|