Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wuriyanto48/pyenvar
Python's .env loader
https://github.com/wuriyanto48/pyenvar
configuration dotenv dotenv-loader dotenv-python pip python
Last synced: about 1 month ago
JSON representation
Python's .env loader
- Host: GitHub
- URL: https://github.com/wuriyanto48/pyenvar
- Owner: wuriyanto48
- License: mit
- Created: 2020-11-06T07:11:42.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-11-09T03:31:34.000Z (about 4 years ago)
- Last Synced: 2024-09-18T06:31:24.745Z (3 months ago)
- Topics: configuration, dotenv, dotenv-loader, dotenv-python, pip, python
- Language: Python
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
## pyenvar
[![Build Status](https://travis-ci.org/wuriyanto48/pyenvar.svg?branch=master)](https://travis-ci.org/wuriyanto48/pyenvar)
Python's `.env` loader is a dotenv package for `Python` based on https://github.com/motdotla/dotenv (`dotenv` module for `nodejs`) with zero dependency
### Install
```shell
$ pip install pyenvar
```### Unit test
Make sure to running `unit tests` before pushing
```shell
$ 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
```.env
USERNAME=admin
PASSWORD='12345'
```#### Basic usage
```python
import os
import pyenvarpyenvar.load()
print(os.environ.keys())
username = os.environ.get('USERNAME')
print(username)
```#### Custom .env path
```python
import os
import pyenvarpyenvar.load(path='./config/.env', encoding='utf-8')
print(os.environ.keys())
username = os.environ.get('USERNAME')
print(username)
```#### Pyenvar CLI
```shell
$ pyenvar-cli /path/to/.env
```