Skip to main content

A python library to read and parse environment variables

Project description

PyPI version Build/Lint/Test

envutils

This python library contains some utils functions to read and parse environment variables.

It can be installed with:

pip3 install envutils

Usage examples:

# Set some example values for demonstration purposes
>>> import os
>>> os.environ['MY_ENV'] = 'my_value'
>>> os.environ['MY_INT_ENV'] = '42'
>>> os.environ['MY_BOOL_ENV'] = 'True'

>>> from envutils import envutils

# Read env variable as string
>>> envutils.get_from_environment('MY_ENV', 'my_default_value')
'my_value'

# Read env variable as int
>>> envutils.get_int_from_environment('MY_INT_ENV', 666)
42

# Read env variable as boolean
>>> envutils.get_bool_from_environment('MY_BOOL_ENV', False)
True

# Read a non-existing env variable
>>> envutils.get_from_environment('UNSET_ENV', 'my_default_value')
'my_default_value'

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

envutils-1.0.0.tar.gz (2.4 kB view hashes)

Uploaded Source

Built Distribution

envutils-1.0.0-py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 3

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