Skip to main content

Poetry Dotenv Plugin

CI

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

Overriding existing environment variables

By default, this plugin will override existing environment variables. This is because this plugin was built to make onboarding for users coming from pipenv as seamless as possible. If you want to prevent existing environment variables from being overridden, you can set the POETRY_DOTENV_DONT_OVERRIDE environment variable to true.1

  1. See #16 for background. ↩

Metadata

Release files for poetry-dotenv-plugin 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for poetry-dotenv-plugin 0.2.0
File Size Uploaded
poetry_dotenv_plugin-0.2.0.tar.gz 3.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for poetry-dotenv-plugin 0.2.0
File Interpreter ABI Platform
poetry_dotenv_plugin-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.0 kB

Release files / poetry_dotenv_plugin-0.2.0.tar.gz

Download URL poetry_dotenv_plugin-0.2.0.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9bdd0a96d81ba5f2e75bda7c8944e2c5132b0c615c44452770dd1e7f1aca62f6
BLAKE2b-256 checksum
How to use checksums
8f7a6f329eee5b9e57669f00c12b6d2b811dc1b394741518f967a3ed75131dc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-1041-azure

Release files / poetry_dotenv_plugin-0.2.0-py3-none-any.whl

Download URL poetry_dotenv_plugin-0.2.0-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc2fd816a96e32586afb6507f01de6070a8a50877207ae20efa7c6a75648143a
BLAKE2b-256 checksum
How to use checksums
746085248a2c3a983e9052fe1458e88ceb524a882dc718f223c910414a1ca63a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-1041-azure

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page