🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

env-tools

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

env-tools

Tools for using .env files in Python

2.4.0
Maintainers
1

env-tools

A simple module for loading and applying .env files.

Works in Python 2 and Python 3.

Running tests

$ py.test

Or, with tox (test with multiple Python versions):

$ tox

Example

.env

VARIABLE_A=123
VARIABLE_B="testing, testing"

example.py

import os

from env_tools import apply_env

# loads '.env' by default, to load another file use
# apply_env(load_env('filename'))
apply_env()

assert os.environ['VARIABLE_A'] == '123'
assert os.environ['VARIABLE_B'] == 'testing, testing'

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts