Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

poetry-dotenv-plugin

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

poetry-dotenv-plugin

A Poetry plugin to automatically load environment variables from .env files

  • 0.2.0
  • PyPI
  • Socket score

Maintainers
1

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 varPoetry env var
PIPENV_DOTENV_LOCATIONPOETRY_DOTENV_LOCATION
PIPENV_DONT_LOAD_ENVPOETRY_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

Footnotes

  1. See #16 for background.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc