Skip to content

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

License

Notifications You must be signed in to change notification settings

wendytang/poetry-dotenv-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 67.3%
  • Python 32.7%