Python's .env loader is a dotenv package for Python based on https://github.com/motdotla/dotenv (dotenv module for nodejs) with zero dependency
$ pip install pyenvarMake sure to running unit tests before pushing
$ make testMake sure the .env file is in your project's root folder
myproject
- src/
- __init__.py
- main.py
- .env
Assumed the .env file looks like this
USERNAME=admin
PASSWORD='12345'import os
import pyenvar
pyenvar.load()
print(os.environ.keys())
username = os.environ.get('USERNAME')
print(username)import os
import pyenvar
pyenvar.load(path='./config/.env', encoding='utf-8')
print(os.environ.keys())
username = os.environ.get('USERNAME')
print(username)$ pyenvar-cli /path/to/.env