@environment
Decorator for convenient loading of environment variables. @environment allows you to declare dependencies on environment variables so that it’s clear what needs to be set. Also, any error handling is moved away making the code clearer.
Free software: MIT license
Documentation: https://atenvironment.readthedocs.io.
Getting started
Install @environment from pip:
pip install atenvironment
Using @environment is as simple as:
from atenvironment import environment
@environment('API_KEY', 'TOKEN')
def check(a, b, c, key, token):
# API_KEY is in key
# TOKEN is in token
Then call the function as:
check(a, b, c)
Environment variables are checked and provided to the function as trailing parameters in order of declaration. In case the token is not in environment an atenvironment.EnvironMiss exception is raised. You can also provide your own error handling function. In addition, some environment variables can be loaded directly into object variable in case instance property is to be initialized.
See the docummentation for more details.
History
0.2.0 (2018-06-24)
on error: optional function to be called if any of the environment tokens in value is not present in environment
in self: optional variable name in case instance property is to be initialized
package slightly restructured
0.1.0 (2018-06-12)
First release on PyPI.
Metadata
Release files for atenvironment 0.2.1
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 | |
|---|---|---|---|---|
| atenvironment-0.2.1.tar.gz | 10.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| atenvironment-0.2.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 15.4 kB
Release files / atenvironment-0.2.1.tar.gz
| Download URL | atenvironment-0.2.1.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e5740392550ceff9e8de5aada86da2f6410f5b808445e68bb768ca7fe2adcbfb
|
|
BLAKE2b-256 checksum How to use checksums |
81eec648ac44824516c7964fec6727cb75ef6088dc59059aeaab351efe1e245e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
|
Release files / atenvironment-0.2.1-py2.py3-none-any.whl
| Download URL | atenvironment-0.2.1-py2.py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
db729dc0266f0a074b8d26c03f46bdb3e88d9070a4e1091f12b2b2fcdc8669bb
|
|
BLAKE2b-256 checksum How to use checksums |
e5e169d8b9ec853f0441c4ca8d79c6dc1343cdb5d8a78d34d14e6742f6386b32
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
|
Security for atenvironment 0.2.1
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.