Skip to main content

os.environ on steroids

Project description

# Env2

os.environ on stereoids

env2 allows raising errors on missing environment variables without too much bolierplate code. This is very useful when developing microservices that depends on environment variables.

## How it works

With env2 you can replace this:

import os

var = os.environ.get('key', None)
if not var:
raise Exception(f'{key} not found in environment variables')
return var

With this:

from env2 import env2

var = env2('key')

env2 will automatically raise on a missing key, to avoid that:

from env2 import env2

var = env2('key', raise_error=False)

env2 allows to set default values as well:

from env2 import env2

var = env2('key', default='key2')

## License

This software is under [WTFPL]( license

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

env2-0.0.0.tar.gz (2.9 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page