Skip to main content

Easy injection of environment variables from .env files.

Project description

If you spend a lot of time switching between multiple Python projects and using several virtual environment, you’ll be familiar with the pain of injecting the right environment variables into your scripts. You can use autoenv, but it doesn’t automatically load the virtual environment for you, so you need to litter the .env file with bash commands. Or you can use a postactivate hook in virtualenvwrapper, but that would mean not having a standardized, default location for all the needed environment variables. And what if you use an IDE like PyCharm, which doesn’t load variables from .env files?

Envious solves the problem by loading configurations from an .env file in the working directory directly from within your Python code, injecting environment variables if they’re not already defined, while keeping those that are already set.

Installation

To install envious, simply type:

$ pip install envious

Usage

To have your project import environment variables from an .env file, first create the file in the root folder of your project:

ENVIRONMENT=development
MONGODB_URL=http://localhost:27017/mydb
REDIS_URL=http://localhost:6379/0

Then add the following to the Python app entry point:

from envious import load_env

load_env()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

envious-0.1.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

envious-0.1.macosx-10.9-x86_64.exe (65.7 kB view details)

Uploaded Source

File details

Details for the file envious-0.1.tar.gz.

File metadata

  • Download URL: envious-0.1.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for envious-0.1.tar.gz
Algorithm Hash digest
SHA256 f11e231f714eeae72209a435d2b9a3947847db7212ef6bb6786c9be65c8bf61a
MD5 666e71d3701d8d092ffd7ce286e919c5
BLAKE2b-256 41e36aab50a2032e800540985d7a25d0e3632d03d5a098e3eca20cdb94ae26d4

See more details on using hashes here.

File details

Details for the file envious-0.1.macosx-10.9-x86_64.exe.

File metadata

File hashes

Hashes for envious-0.1.macosx-10.9-x86_64.exe
Algorithm Hash digest
SHA256 90d67468baab2fec91308c3fb2e1aafe9628dc0e18613520b52d51f4712efaed
MD5 6dca40079de62ccc12e7feaa122d6bf7
BLAKE2b-256 97603f0ec1bf35877854dc96c0af1cc0f32025a771e6ffdd922d76fd87849e7c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page