{"id":24251,"library":"poetry-plugin-dotenv","title":"Poetry Plugin Dotenv","description":"Automatically loads environment variables from .env files before running Poetry commands. Currently at version 3.3.0, with active development and monthly releases.","status":"active","version":"3.3.0","language":"python","source_language":"en","source_url":"https://github.com/pivoshenko/poetry-plugin-dotenv","tags":["poetry","plugin","dotenv","environment-variables"],"install":[{"cmd":"pip install poetry-plugin-dotenv","lang":"bash","label":"PyPI"}],"dependencies":[],"imports":[{"note":"The plugin class is in the plugin submodule, not the package root.","wrong":"from poetry_plugin_dotenv import PoetryPluginDotenv","symbol":"PoetryPluginDotenv","correct":"from poetry_plugin_dotenv.plugin import PoetryPluginDotenv"},{"note":"Older alias; direct import from package root fails.","wrong":"from poetry_plugin_dotenv import DotenvPlugin","symbol":"DotenvPlugin","correct":"from poetry_plugin_dotenv.plugin import DotenvPlugin"}],"quickstart":{"code":"pip install poetry-plugin-dotenv\npoetry config plugins.poetry-plugin-dotenv.enabled true\n# Create .env file with your variables\n# Then run any poetry command - they will be loaded automatically\necho \"MY_VAR=hello\" > .env\npoetry run python -c \"import os; print(os.environ.get('MY_VAR', 'not set'))\"","lang":"bash","description":"Install the plugin, enable it, create a .env file, and run a poetry command to see the variable loaded."},"warnings":[{"fix":"export POETRY_DOTENV_SHELL=1 before using 'poetry shell'","message":"The plugin does not load .env files for 'poetry shell' by default; you must set the environment variable POETRY_DOTENV_SHELL=1 to enable that.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"export POETRY_DOTENV_PATH=.env.development or use the --dotenv-path option if available","message":"By default, the plugin loads only one .env file. If you have multiple dotenv files (e.g., .env.development), you must set the POETRY_DOTENV_PATH environment variable.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"pipx inject poetry poetry-plugin-dotenv","message":"Poetry 2.0 changed plugin loading. The plugin must be installed in the same Python environment as Poetry. If you use pipx, install it with: pipx inject poetry poetry-plugin-dotenv","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install the plugin in Poetry's environment: 'pipx inject poetry poetry-plugin-dotenv' or 'pip install poetry-plugin-dotenv' in the same virtualenv.","cause":"The plugin is not installed in the same environment as Poetry, or Poetry version is too old.","error":"ModuleNotFoundError: No module named 'poetry.plugins'"},{"fix":"Run 'poetry self add poetry-plugin-dotenv' or 'pipx inject poetry poetry-plugin-dotenv' and then 'poetry config plugins.poetry-plugin-dotenv.enabled true'.","cause":"The plugin's configuration was not enabled or there is a version mismatch with Poetry.","error":"Error: The Poetry Plugin Dotenv is not configured properly. Please check your installation."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}