Simple python configuration tool
Project description
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
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
ezcfg-0.1.3.tar.gz
(2.8 kB
view details)
Built Distribution
ezcfg-0.1.3-py3-none-any.whl
(3.0 kB
view details)
File details
Details for the file ezcfg-0.1.3.tar.gz
.
File metadata
- Download URL: ezcfg-0.1.3.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
b929c4036f253c5d00eeb7034c610bd455fcd1c9d9304ef95c18d3ddeab2cf15
|
|
MD5 |
4e1e4a25ce7756f27290c004bd276f30
|
|
BLAKE2b-256 |
402e55e88b2a1d6928c235ec142571318220b0930b72d7ac1210923c8f13a2b1
|
File details
Details for the file ezcfg-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: ezcfg-0.1.3-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
b8bfd0b9460b2307e0bf277f9125d21fbba4db0c13dec47f9f40a39bdd785d34
|
|
MD5 |
974889b8897bb17b247aad5b03940947
|
|
BLAKE2b-256 |
0c0bd5103a6ca5e7fa6c4301992d643ec975b1fea3e7ae9fa40563c1a0148640
|