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
Metadata
Release files for pyenvar 1.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyenvar-1.0.6.tar.gz | 3.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyenvar-1.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.1 kB
Release files / pyenvar-1.0.6.tar.gz
| Download URL | pyenvar-1.0.6.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
13414158f520a0f01849ab0f91a74e6836e54c9909ade0f442d76126b51df097
|
|
BLAKE2b-256 checksum How to use checksums |
52a5b8907c9aee13acff7346ffca53e2839f94bd12548c599d3bb02f09edf64f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.4
|
Release files / pyenvar-1.0.6-py3-none-any.whl
| Download URL | pyenvar-1.0.6-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ab6ed375a1ac432c3623fc8b77636b7dff2b6ff33dc4b0ea9c6646306163f84
|
|
BLAKE2b-256 checksum How to use checksums |
1f58fafa2a5ec1af2213ecbf0288befb838af214b45ac6797123a26bc42f0e45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.4
|