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.

Filename, size & hash SHA256 hash help File type Python version Upload date
atenvironment-0.2.0-py2.py3-none-any.whl (3.3 kB) Copy SHA256 hash SHA256 Wheel py2.py3
atenvironment-0.2.0.tar.gz (10.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page