Skip to main content

Decorator for convenient loading of environment variables

Project description

@environment

https://img.shields.io/pypi/v/atenvironment.svg https://img.shields.io/travis/eghuro/atenvironment.svg Documentation Status Updates https://codecov.io/gh/eghuro/atenvironment/branch/master/graph/badge.svg

Decorator for convenient loading of environment variables

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. In case the token is not in environment an atenvironment.EnvironMiss exception is raised.

See the docummentation for more details.

History

0.1.0 (2018-06-12)

  • First release on PyPI.

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

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

atenvironment-0.2.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

atenvironment-0.2.0-py2.py3-none-any.whl (3.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file atenvironment-0.2.0.tar.gz.

File metadata

File hashes

Hashes for atenvironment-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2390b61c65ad008c94f7f8d91932a390f708a5b80c7be8da74f8b1cdb9ae5663
MD5 e7be7fef30e8c2ca5afb94bf285c4501
BLAKE2b-256 8eb9c58075a8c915224ad14cf7a447b95e60a874f9c49b6a88b01c3a15fc48c1

See more details on using hashes here.

File details

Details for the file atenvironment-0.2.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for atenvironment-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 aefd0835ad63deb83a19ef6fc444e62708ec6364eb0fbf0d0334abb2ac96ef88
MD5 20e4b67498762ae469ef1367f2f7dc0a
BLAKE2b-256 f1b12f47bed9e22fe85aae09f66e54ca54772facc299254eaf9b7419183f5d87

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page