.env loader for python
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyenvar-1.0.6.tar.gz
(3.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyenvar-1.0.6.tar.gz.
File metadata
- Download URL: pyenvar-1.0.6.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13414158f520a0f01849ab0f91a74e6836e54c9909ade0f442d76126b51df097
|
|
| MD5 |
66e04403acc86a7bc4486e0a68f0eca8
|
|
| BLAKE2b-256 |
52a5b8907c9aee13acff7346ffca53e2839f94bd12548c599d3bb02f09edf64f
|
File details
Details for the file pyenvar-1.0.6-py3-none-any.whl.
File metadata
- Download URL: pyenvar-1.0.6-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ab6ed375a1ac432c3623fc8b77636b7dff2b6ff33dc4b0ea9c6646306163f84
|
|
| MD5 |
38d8a3dfdafcf3836188d3deac8803b6
|
|
| BLAKE2b-256 |
1f58fafa2a5ec1af2213ecbf0288befb838af214b45ac6797123a26bc42f0e45
|