Python-box based custom config python package.
Project description
Easily Launch Config (el_config)
Python-box based custom config package for simple python projects.
Features
- Python-box based config
- Custom base config module
- Load environment variables
- YAML or JSON based configs
- Update with extra configs
- Pre-load config
- Validate config
- Freeze config
- Config as dictioary
Installation
1. Prerequisites
- Python (>= v3.7)
- PyPi (>= v21)
2. Install el-config
A. [RECOMMENDED] PyPi install
# Install or upgrade el-config package:
pip install --upgrade el-config
# To uninstall package:
pip uninstall -y el-config
B. Manually add to PYTHONPATH (Recommended for development)
# Clone repository by git:
git clone git@bitbucket.org:ellexiinc/el_config.git
cd el_config
# Install python dependencies:
pip install --upgrade pip
cat requirements.txt | xargs -n 1 -L 1 pip install --no-cache-dir
# Add current path to PYTHONPATH:
export PYTHONPATH="${PWD}:${PYTHONPATH}"
C. Manually compile and setup (Not recommended)
# Clone repository by git:
git clone git@bitbucket.org:ellexiinc/el_config.git
cd el_config
# Building python package:
pip install --upgrade pip setuptools wheel
python setup.py build
# Install python dependencies with built package to current python environment:
python setup.py install --record installed_files.txt
# To remove only installed el-config package:
head -n 1 installed_files.txt | xargs rm -vrf
# Or to remove all installed files and packages:
cat installed_files.txt | xargs rm -vrf
Usage/Examples
- Sample python file - https://bitbucket.org/ellexiinc/el_config/src/master/sample.py
- Import el_config module:
from el_config import ConfigBase
def _pre_load(config):
config.test = '123'
return config
_valid_schema = {
'test':
{
'type': 'integer',
'coerce': int
}
}
_cb = ConfigBase(pre_load=_pre_load, valid_schema=_valid_schema)
_cb.load()
config = _cb.config
print(config)
Running Tests
To run tests, run the following command:
pytest tests/test_*.py
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
el_config-0.1.13.tar.gz
(4.9 kB
view details)
File details
Details for the file el_config-0.1.13.tar.gz
.
File metadata
- Download URL: el_config-0.1.13.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fea87deaed98375d81d284a843eb926bb1e570edd71f36fa26ffa5fbda5239e |
|
MD5 | 9e6e923694a6a6ce64a5513a43e3527b |
|
BLAKE2b-256 | 11669a7460f9b19ca0d90d780fd16cacb218e40bbf97e61a56a4ee5e1ce2a157 |