Skip to content

A python library to read and parse environment variables.

License

Notifications You must be signed in to change notification settings

mfilippo/envutils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyPI version Build/Lint/Test


███████╗███╗   ██╗██╗   ██╗██╗   ██╗████████╗██╗██╗     ███████╗
██╔════╝████╗  ██║██║   ██║██║   ██║╚══██╔══╝██║██║     ██╔════╝
█████╗  ██╔██╗ ██║██║   ██║██║   ██║   ██║   ██║██║     ███████╗
██╔══╝  ██║╚██╗██║╚██╗ ██╔╝██║   ██║   ██║   ██║██║     ╚════██║
███████╗██║ ╚████║ ╚████╔╝ ╚██████╔╝   ██║   ██║███████╗███████║
╚══════╝╚═╝  ╚═══╝  ╚═══╝   ╚═════╝    ╚═╝   ╚═╝╚══════╝╚══════╝
                                                                

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'

About

A python library to read and parse environment variables.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages