A Poetry plugin to automatically load environment variables from .env files
Project description
Poetry Dotenv Plugin
A Poetry plugin that automatically loads environment variables from .env
files into the environment before poetry commands are run.
Supports Python 3.7+
$ cat .env
MY_ENV_VAR='Hello World'
$ poetry run python -c 'import os; print(os.environ.get("MY_ENV_VAR"))'
Hello World
This plugin depends on the python-dotenv
package for its functionality and therefore also supports features that python-dotenv
supports. Interpolating variables using POSIX variable expansion for example.
Origins
Initial implementation based on the event handler application plugin example in the Poetry docs.
Install
poetry self add poetry-dotenv-plugin
Coming from Pipenv
If you are transitioning from pipenv
there shouldn't be much to change with regard to the .env
loading. If you were a user of pipenv
's environment variables to control .env
loading then you can use the analogous environment variables listed below.
Pipenv env var | Poetry env var |
---|---|
PIPENV_DOTENV_LOCATION | POETRY_DOTENV_LOCATION |
PIPENV_DONT_LOAD_ENV | POETRY_DONT_LOAD_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
Built Distribution
Hashes for poetry-dotenv-plugin-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f231eebae8404197915b8d19eeeef6ac8d988f6d7fe045c4c113bd65ca430052 |
|
MD5 | cb6f1688858690b0bb65f46426527bdc |
|
BLAKE2b-256 | d965f2bb6bac66df294790af8878ea63c6a7e4902275d06efdfe34eca15d153e |
Hashes for poetry_dotenv_plugin-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e9d242975aeb84f08fd97cc2b127d8c626079d33101b2c0a74a5cb3c8ae0080 |
|
MD5 | f5469a5722b2737511e6b89be05e731a |
|
BLAKE2b-256 | 7b5cd16f9ac082aecbbc71de656ae10bac11bec6af4ae66ce1eb3a7cb391d363 |