Last updated:
0 purchases
pyenvar 1.0.6
pyenvar
Python's .env is a loader based on https://github.com/motdotla/dotenv (dotenv module for nodejs) with zero dependency
Install
$ pip install pyenvar
Unit test
Make sure to running unit tests before pushing
$ make test
Usage
Make 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'
Basic usage
import os
import pyenvar
pyenvar.load()
print(os.environ.keys())
username = os.environ.get('USERNAME')
print(username)
Custom .env path
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
$ pyenvar-cli /path/to/.env
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.