Skip to content

Rashaad1268/PyEnv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyEnv

Install using

pip install git+https://github.com/Rashaad1268/PyEnv.git#egg=pyenv

Example

The .env file

string="hello world"
integer=1234
list=[1 , 2 , 3, 4 ,5,'Hello world']
dict={"key": "value", "pi": 3.141, 10: 20}

The python code to read those valeus

import pyenv


env = pyenv.Env()  # It will read the .env file in the cwd if you don't specify env the file name

print(env["string"])
# Output: hello world
print(env["integer"])
# Output: 1234```
print(env["list"])
# Output: [1, 2, 3, 4, 5, 'Hello world']
print(env["dict"])
# Output: {'key': 'value', 'pi': Decimal('3.141'), 10: 20}

Notes

Parsing nested values like [[1, 2, 3], [1, 2, 3], [1, 2, 3]] don't work. Check #1 for additional information

About

A python module to parse .env files

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published