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.6+
$ 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 plugin 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.0a2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88ba55b27ca60e71df46780a1aca7735a7abd401c752143bb9fff922b81f514a |
|
MD5 | 610fa15b32211f19dac71a7587f77dc9 |
|
BLAKE2b-256 | e11d538de6349a9a1d2cf73fbe0be18a840c19d7fd80f8c43e528d0957c6a386 |
Hashes for poetry_dotenv_plugin-0.1.0a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7d18ef8325d697397eb7a64865d699b6be234d94a7faf33f561ec50941ae796 |
|
MD5 | bb50236857aee06ce215588210d586fa |
|
BLAKE2b-256 | 1283a6ccbbba89e6c92e22b11942c7d342979139a33021be2825bd08af23d3ed |