envconfig
envconfig is a simple but effective way to configure your Python application through environment variables.
Inspired by kelseyhightower/envconfig.
Features:
- Extremely simple setup,
- Zero third-party dependencies,
- Well tested,
- Well documented,
- Fun to use ;)
Quickstart
import envconfig
class Config:
# Declare two config variables with type string.
aws_access_key_id: str
aws_secret_access_key: str
# Provide a default - envconfig uses the type that the attribute is initialized with
# so you don't need to repeat yourself.
aws_region = 'us-east-1'
# HTTP config
num_retries = 15
retry_strategy: str
timeout: int = 15 # seconds
# Create an instance of your config object and let envconfig process it!
config = Config()
envconfig.process(config)
# Access class attributes
aws_client = Client(
access_key_id=config.aws_access_key_id,
secret_access_key=config.aws_secret_access_key,
region=config.aws_region,
)
Development
Cloning and Building
envconfig is written in Python 3.6 and is tested on Python 3.6 and above.
Simply check out the repository, create a virtualenv, and go to town!
git clone https://github.com/makramkd/envconfig # or git@github.com:makramkd/envconfig.git if you prefer
cd envconfig
pyenv local 3.6.3 # ensure python 3.6
python -m venv .venv # create venv
source .venv/bin/activate
pip install -r test_requirements.txt # for coverage, flake8
You can install envconfig in your virtual environment by running:
python setup.py install
Running unit tests and linter
All unit tests are built using the unittest module from the standard library.
python -m unittest discover tests/
Or, if you want a coverage report:
coverage run -m unittest discover tests
coverage report # show coverage report on stdout
coverage html && open htmlcov/index.html # show interactive coverage report in the browser
To run the linter:
./run_linter.sh
Contributions
Contributing is easy. Create a pull request, add tests, and get it approved!
Metadata
Release files for pyenvconfig 0.1.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 | Provenance | |
|---|---|---|---|---|
| pyenvconfig-0.1.0.tar.gz | 4.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyenvconfig-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.5 kB
Release files / pyenvconfig-0.1.0.tar.gz
| Download URL | pyenvconfig-0.1.0.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
89a8ac61ef53a24f26f93e00ce7ee039cbc0e9e1b8a56f4476ec3c572ce79028
|
|
BLAKE2b-256 checksum How to use checksums |
35017d70c96dbcd0b0978dbfbfd3006088dd3cdf26a4e7d08783aa1dcc886c1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.8.0 tqdm/4.56.0 CPython/3.8.7
|
Release files / pyenvconfig-0.1.0-py3-none-any.whl
| Download URL | pyenvconfig-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
38425413ad5a712d69264782b869e8fae1e6673ab028c4ee453c5527bc069415
|
|
BLAKE2b-256 checksum How to use checksums |
27ed276858a6818271a455709d863b182f06e878aeef9d7b850bcdf18d4dcba3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.8.0 tqdm/4.56.0 CPython/3.8.7
|
Security for pyenvconfig 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.