I love Poetry, but one thing I always find frustrating is having to add an additional package to my environments to read from .env files and access them as environment variables. I quite often default to Pipenv for simple projects to get round this. Turns out there’s now another way.
You can install 1.2.0a2 and get it the plugin right now like this:
poetry self update --preview poetry plugin add poetry-dotenv-plugin
Then you should find anything you’ve added to your .env file is accessible to use in your project as an environment variable.
If you’re using Poetry 1.2+ the plugin command is now slightly different:
poetry self add poetry-dotenv-plugin
Updated 29th September 2022 to include differences on final 1.2 release.