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 |
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
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| poetry_dotenv_plugin-0.2.0.tar.gz | 3.0 kB | Without provenance | Details for poetry_dotenv_plugin-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| poetry_dotenv_plugin-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for poetry_dotenv_plugin-0.2.0-py3-none-any.whl |
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
|
Security for poetry-dotenv-plugin 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.