> ⚠️ __Warning__
>
> This package has been deprecated and is no longer maintained, `poetry-dotenv` has moved to [`poetry-plugin-dotenv`](https://pypi.org/project/poetry-plugin-dotenv)
<div align="center">
<a href="https://pypi.org/project/poetry-plugin-dotenv">
<img alt="logo" src="https://github.com/volopivoshenko/poetry-plugin-dotenv/blob/main/docs/static/assets/logo.svg?raw=True" height=200>
</a>
</div>
<p align="center">
<a href="https://opensource.org/licenses/MIT">
<img alt="license" src="https://img.shields.io/pypi/l/poetry-plugin-dotenv?logo=opensourceinitiative">
</a>
<a href="https://pypi.org/project/poetry-plugin-dotenv">
<img alt="python" src="https://img.shields.io/pypi/pyversions/poetry-plugin-dotenv?logo=python">
</a>
<a href="https://pypi.org/project/poetry-plugin-dotenv">
<img alt="pypi" src="https://img.shields.io/pypi/v/poetry-plugin-dotenv?logo=pypi">
</a>
<a href="https://github.com/volopivoshenko/poetry-plugin-dotenv/releases">
<img alt="release" src="https://img.shields.io/github/v/release/volopivoshenko/poetry-plugin-dotenv?logo=github">
</a>
<a href="https://numpydoc.readthedocs.io/en/latest/format.html">
<img alt="numpydoc" src="https://img.shields.io/badge/docstrings-numpy-1f425f.svg?logo=numpy">
</a>
</p>
<p align="center">
<a href="https://github.com/psf/black">
<img alt="black" src="https://img.shields.io/badge/code_style-black-black.svg?logo=windowsterminal">
</a>
<a href="https://pycqa.github.io/isort/index.html">
<img alt="isort" src="https://img.shields.io/badge/imports-isort-black.svg?logo=windowsterminal">
</a>
<a href="https://wemake-python-stylegui.de/en/latest/index.html">
<img alt="wemake" src="https://img.shields.io/badge/style-wemake-black.svg?logo=windowsterminal">
</a>
<a href="https://mypy.readthedocs.io/en/stable/index.html">
<img alt="mypy" src="https://img.shields.io/badge/mypy-checked-success.svg?logo=python">
</a>
<a href="https://github.com/semantic-release/semantic-release">
<img alt="semantic_release" src="https://img.shields.io/badge/semantic_release-angular-e10079?logo=semantic-release">
</a>
</p>
<p align="center">
<a href="https://github.com/dependabot">
<img alt="dependabot" src="https://img.shields.io/badge/dependabot-enable-success?logo=Dependabot">
</a>
<a href="https://github.com/volopivoshenko/poetry-plugin-dotenv/actions/workflows/ci.yaml">
<img alt="CI" src="https://img.shields.io/github/actions/workflow/status/volopivoshenko/poetry-plugin-dotenv/ci.yaml?label=CI&logo=github">
</a>
<a href="https://github.com/volopivoshenko/poetry-plugin-dotenv/actions/workflows/cd.yaml">
<img alt="CD" src="https://img.shields.io/github/actions/workflow/status/volopivoshenko/poetry-plugin-dotenv/cd.yaml?label=CD&logo=github">
</a>
<a href="https://github.com/volopivoshenko/poetry-plugin-dotenv/actions/workflows/codeql.yaml">
<img alt="CodeQL" src="https://img.shields.io/github/actions/workflow/status/volopivoshenko/poetry-plugin-dotenv/codeql.yaml?label=CodeQL&logo=github">
</a>
<a href="https://github.com/volopivoshenko/poetry-plugin-dotenv/actions/workflows/dependency-review.yaml">
<img alt="Dependency Review" src="https://img.shields.io/github/actions/workflow/status/volopivoshenko/poetry-plugin-dotenv/dependency-review.yaml?label=Dependency%20Review&logo=github">
</a>
<a href="https://pypi.org/project/poetry-plugin-dotenv">
<img alt="wheel" src="https://img.shields.io/pypi/wheel/poetry-plugin-dotenv?logo=pypi">
</a>
</p>
<p align="center">
<a href="https://codecov.io/gh/volopivoshenko/poetry-plugin-dotenv">
<img alt="coverage" src="https://img.shields.io/codecov/c/gh/volopivoshenko/poetry-plugin-dotenv?logo=codecov&token=yyck08xfTN"/>
</a>
<a href="https://codeclimate.com/github/volopivoshenko/poetry-plugin-dotenv/maintainability">
<img alt="codeclimate" src="https://img.shields.io/codeclimate/maintainability/volopivoshenko/poetry-plugin-dotenv?logo=codeclimate">
</a>
<a href="https://pypi.org/project/poetry-plugin-dotenv">
<img alt="downloads" src="https://img.shields.io/pypi/dm/poetry-plugin-dotenv?logo=pypi">
</a>
<a href="https://github.com/volopivoshenko/poetry-plugin-dotenv/">
<img alt="stars" src="https://img.shields.io/github/stars/volopivoshenko/poetry-plugin-dotenv?logo=github">
</a>
</p>
<p align="center">
<a href="https://github.com/volopivoshenko/poetry-plugin-dotenv/issues">
<img alt="issues" src="https://img.shields.io/github/issues/volopivoshenko/poetry-plugin-dotenv?logo=github">
</a>
<a href="https://github.com/volopivoshenko/poetry-plugin-dotenv/issues">
<img alt="issues" src="https://img.shields.io/github/issues-closed/volopivoshenko/poetry-plugin-dotenv?logo=github">
</a>
<a href="https://github.com/volopivoshenko/poetry-plugin-dotenv/pulls">
<img alt="pr" src="https://img.shields.io/github/issues-pr/volopivoshenko/poetry-plugin-dotenv?logo=github">
</a>
<a href="https://github.com/volopivoshenko/poetry-plugin-dotenv/pulls">
<img alt="pr" src="https://img.shields.io/github/issues-pr-closed/volopivoshenko/poetry-plugin-dotenv?logo=github">
</a>
<a href="https://github.com/volopivoshenko/poetry-plugin-dotenv/graphs/contributors">
<img alt="contributors" src="https://img.shields.io/github/contributors/volopivoshenko/poetry-plugin-dotenv?logo=github">
</a>
<a href="https://github.com/volopivoshenko/poetry-plugin-dotenv/commits/main">
<img alt="commit" src="https://img.shields.io/github/last-commit/volopivoshenko/poetry-plugin-dotenv?logo=github">
</a>
</p>
<p align="center">
<!-- <a href="https://www.buymeacoffee.com/volopivoshenko" target="_blank">
<img alt="buymeacoffee" src="https://img.shields.io/badge/buy_me_-a_coffee-ff6964?logo=buymeacoffee">
</a> -->
<a href="https://stand-with-ukraine.pp.ua/">
<img alt="standwithukraine" src="https://img.shields.io/badge/Support-Ukraine-FFD500?style=flat&labelColor=005BBB">
</a>
<a href="https://stand-with-ukraine.pp.ua">
<img alt="standwithukraine" src="https://img.shields.io/badge/made_in-Ukraine-ffd700.svg?labelColor=0057b7">
</a>
</p>
- [🔮 Overview](#-overview)
- [⚙️ Installation](#️-installation)
- [👩🏻💻 Usage](#-usage)
# 🔮 Overview
`poetry-plugin-dotenv` - is the plugin that automatically loads environment variables from a dotenv file into the environment before `poetry` commands are run.
**This plugin doesn't have any dependencies, but therefore it also supports features that `python-dotenv` supports (e.g. templates, interpolating variables using `POSIX` variable expansions etc).**
# ⚙️ Installation
```bash
poetry self add poetry-plugin-dotenv
```
# 👩🏻💻 Usage
By default, plugin will load the `.env` file from the current working directory or "higher directories".
To prevent ``poetry`` from loading the dotenv file, set the ``POETRY_DONT_LOAD_DOTENV`` environment variable.
If your dotenv file is located in a different path or has a different name you may set the ``POETRY_DOTENV_LOCATION`` environment variable.
<img alt="logo" src="https://github.com/volopivoshenko/poetry-plugin-dotenv/blob/main/docs/static/assets/demo.gif?raw=True">
```dotenv
# .env
DB__HOST=localhost
DB__DBNAME=prod
DB__USER=admin
DB__PASSWORD=admin
DB__ENGINE=postgresql://${DB__USER}:${DB__PASSWORD}@${DB__HOST}/${DB__DBNAME}
```
```dotenv
# .env.dev
DB__HOST=localhost
DB__DBNAME=dev
DB__USER=root
DB__PASSWORD=root
DB__ENGINE=postgresql://${DB__USER}:${DB__PASSWORD}@${DB__HOST}/${DB__DBNAME}
```
```python
# main.py
import os
if __name__ == "__main__":
try:
print(f"Host: {os.environ['DB__HOST']!r}")
print(f"Name: {os.environ['DB__DBNAME']!r}")
print(f"Username: {os.environ['DB__USER']!r}")
print(f"Password: {os.environ['DB__PASSWORD']!r}")
print(f"Engine: {os.environ['DB__ENGINE']!r}")
except KeyError:
print("Environment variables not set!")
```
```bash
poetry run -vvv python main.py
# Loading environment variables from '.env'.
# Host: 'localhost'
# Name: 'prod'
# Username: 'admin'
# Password: 'admin'
# Engine 'postgresql://admin:admin@localhost/prod'
export POETRY_DOTENV_LOCATION=.env.dev && poetry run -vvv python main.py
# Loading environment variables from '.env.dev'.
# Host: 'localhost'
# Name: 'dev'
# Username: 'root'
# Password: 'root'
# Engine 'postgresql://root:root@localhost/dev'
export POETRY_DONT_LOAD_DOTENV=1 && poetry run -vvv python main.py
# Not loading environment variables.
```
Raw data
{
"_id": null,
"home_page": "https://github.com/volopivoshenko/poetry-dotenv",
"name": "poetry-dotenv",
"maintainer": "Volodymyr Pivoshenko",
"docs_url": null,
"requires_python": ">=3.8.1,<4.0",
"maintainer_email": "volodymyr.pivoshenko@gmail.com",
"keywords": "python,pypi,poetry,plugin,plugins,poetry-plugin,poetry-plugins,env,dotenv,cross-platform,hacktoberfest",
"author": "Volodymyr Pivoshenko",
"author_email": "volodymyr.pivoshenko@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/31/fa/157c9512491d0945fd085eda83dd36f4d0053025ce14271d3ead16406ea6/poetry_dotenv-0.4.0.tar.gz",
"platform": null,
"description": "> \u26a0\ufe0f __Warning__\n>\n> This package has been deprecated and is no longer maintained, `poetry-dotenv` has moved to [`poetry-plugin-dotenv`](https://pypi.org/project/poetry-plugin-dotenv)\n\n\n<div align=\"center\">\n <a href=\"https://pypi.org/project/poetry-plugin-dotenv\">\n <img alt=\"logo\" src=\"https://github.com/volopivoshenko/poetry-plugin-dotenv/blob/main/docs/static/assets/logo.svg?raw=True\" height=200>\n </a>\n</div>\n\n<p align=\"center\">\n <a href=\"https://opensource.org/licenses/MIT\">\n <img alt=\"license\" src=\"https://img.shields.io/pypi/l/poetry-plugin-dotenv?logo=opensourceinitiative\">\n </a>\n <a href=\"https://pypi.org/project/poetry-plugin-dotenv\">\n <img alt=\"python\" src=\"https://img.shields.io/pypi/pyversions/poetry-plugin-dotenv?logo=python\">\n </a>\n <a href=\"https://pypi.org/project/poetry-plugin-dotenv\">\n <img alt=\"pypi\" src=\"https://img.shields.io/pypi/v/poetry-plugin-dotenv?logo=pypi\">\n </a>\n <a href=\"https://github.com/volopivoshenko/poetry-plugin-dotenv/releases\">\n <img alt=\"release\" src=\"https://img.shields.io/github/v/release/volopivoshenko/poetry-plugin-dotenv?logo=github\">\n </a>\n <a href=\"https://numpydoc.readthedocs.io/en/latest/format.html\">\n <img alt=\"numpydoc\" src=\"https://img.shields.io/badge/docstrings-numpy-1f425f.svg?logo=numpy\">\n </a>\n</p>\n\n<p align=\"center\">\n <a href=\"https://github.com/psf/black\">\n <img alt=\"black\" src=\"https://img.shields.io/badge/code_style-black-black.svg?logo=windowsterminal\">\n </a>\n <a href=\"https://pycqa.github.io/isort/index.html\">\n <img alt=\"isort\" src=\"https://img.shields.io/badge/imports-isort-black.svg?logo=windowsterminal\">\n </a>\n <a href=\"https://wemake-python-stylegui.de/en/latest/index.html\">\n <img alt=\"wemake\" src=\"https://img.shields.io/badge/style-wemake-black.svg?logo=windowsterminal\">\n </a>\n <a href=\"https://mypy.readthedocs.io/en/stable/index.html\">\n <img alt=\"mypy\" src=\"https://img.shields.io/badge/mypy-checked-success.svg?logo=python\">\n </a>\n <a href=\"https://github.com/semantic-release/semantic-release\">\n <img alt=\"semantic_release\" src=\"https://img.shields.io/badge/semantic_release-angular-e10079?logo=semantic-release\">\n </a>\n</p>\n\n<p align=\"center\">\n <a href=\"https://github.com/dependabot\">\n <img alt=\"dependabot\" src=\"https://img.shields.io/badge/dependabot-enable-success?logo=Dependabot\">\n </a>\n <a href=\"https://github.com/volopivoshenko/poetry-plugin-dotenv/actions/workflows/ci.yaml\">\n <img alt=\"CI\" src=\"https://img.shields.io/github/actions/workflow/status/volopivoshenko/poetry-plugin-dotenv/ci.yaml?label=CI&logo=github\">\n </a>\n <a href=\"https://github.com/volopivoshenko/poetry-plugin-dotenv/actions/workflows/cd.yaml\">\n <img alt=\"CD\" src=\"https://img.shields.io/github/actions/workflow/status/volopivoshenko/poetry-plugin-dotenv/cd.yaml?label=CD&logo=github\">\n </a>\n <a href=\"https://github.com/volopivoshenko/poetry-plugin-dotenv/actions/workflows/codeql.yaml\">\n <img alt=\"CodeQL\" src=\"https://img.shields.io/github/actions/workflow/status/volopivoshenko/poetry-plugin-dotenv/codeql.yaml?label=CodeQL&logo=github\">\n </a>\n <a href=\"https://github.com/volopivoshenko/poetry-plugin-dotenv/actions/workflows/dependency-review.yaml\">\n <img alt=\"Dependency Review\" src=\"https://img.shields.io/github/actions/workflow/status/volopivoshenko/poetry-plugin-dotenv/dependency-review.yaml?label=Dependency%20Review&logo=github\">\n </a>\n <a href=\"https://pypi.org/project/poetry-plugin-dotenv\">\n <img alt=\"wheel\" src=\"https://img.shields.io/pypi/wheel/poetry-plugin-dotenv?logo=pypi\">\n </a>\n</p>\n\n<p align=\"center\">\n <a href=\"https://codecov.io/gh/volopivoshenko/poetry-plugin-dotenv\">\n <img alt=\"coverage\" src=\"https://img.shields.io/codecov/c/gh/volopivoshenko/poetry-plugin-dotenv?logo=codecov&token=yyck08xfTN\"/>\n </a>\n <a href=\"https://codeclimate.com/github/volopivoshenko/poetry-plugin-dotenv/maintainability\">\n <img alt=\"codeclimate\" src=\"https://img.shields.io/codeclimate/maintainability/volopivoshenko/poetry-plugin-dotenv?logo=codeclimate\">\n </a>\n <a href=\"https://pypi.org/project/poetry-plugin-dotenv\">\n <img alt=\"downloads\" src=\"https://img.shields.io/pypi/dm/poetry-plugin-dotenv?logo=pypi\">\n </a>\n <a href=\"https://github.com/volopivoshenko/poetry-plugin-dotenv/\">\n <img alt=\"stars\" src=\"https://img.shields.io/github/stars/volopivoshenko/poetry-plugin-dotenv?logo=github\">\n </a>\n</p>\n\n<p align=\"center\">\n <a href=\"https://github.com/volopivoshenko/poetry-plugin-dotenv/issues\">\n <img alt=\"issues\" src=\"https://img.shields.io/github/issues/volopivoshenko/poetry-plugin-dotenv?logo=github\">\n </a>\n <a href=\"https://github.com/volopivoshenko/poetry-plugin-dotenv/issues\">\n <img alt=\"issues\" src=\"https://img.shields.io/github/issues-closed/volopivoshenko/poetry-plugin-dotenv?logo=github\">\n </a>\n <a href=\"https://github.com/volopivoshenko/poetry-plugin-dotenv/pulls\">\n <img alt=\"pr\" src=\"https://img.shields.io/github/issues-pr/volopivoshenko/poetry-plugin-dotenv?logo=github\">\n </a>\n <a href=\"https://github.com/volopivoshenko/poetry-plugin-dotenv/pulls\">\n <img alt=\"pr\" src=\"https://img.shields.io/github/issues-pr-closed/volopivoshenko/poetry-plugin-dotenv?logo=github\">\n </a>\n <a href=\"https://github.com/volopivoshenko/poetry-plugin-dotenv/graphs/contributors\">\n <img alt=\"contributors\" src=\"https://img.shields.io/github/contributors/volopivoshenko/poetry-plugin-dotenv?logo=github\">\n </a>\n <a href=\"https://github.com/volopivoshenko/poetry-plugin-dotenv/commits/main\">\n <img alt=\"commit\" src=\"https://img.shields.io/github/last-commit/volopivoshenko/poetry-plugin-dotenv?logo=github\">\n </a>\n</p>\n\n<p align=\"center\">\n <!-- <a href=\"https://www.buymeacoffee.com/volopivoshenko\" target=\"_blank\">\n <img alt=\"buymeacoffee\" src=\"https://img.shields.io/badge/buy_me_-a_coffee-ff6964?logo=buymeacoffee\">\n </a> -->\n <a href=\"https://stand-with-ukraine.pp.ua/\">\n <img alt=\"standwithukraine\" src=\"https://img.shields.io/badge/Support-Ukraine-FFD500?style=flat&labelColor=005BBB\">\n </a>\n <a href=\"https://stand-with-ukraine.pp.ua\">\n <img alt=\"standwithukraine\" src=\"https://img.shields.io/badge/made_in-Ukraine-ffd700.svg?labelColor=0057b7\">\n </a>\n</p>\n\n\n\n- [\ud83d\udd2e Overview](#-overview)\n- [\u2699\ufe0f Installation](#\ufe0f-installation)\n- [\ud83d\udc69\ud83c\udffb\u200d\ud83d\udcbb Usage](#-usage)\n\n# \ud83d\udd2e Overview\n\n`poetry-plugin-dotenv` - is the plugin that automatically loads environment variables from a dotenv file into the environment before `poetry` commands are run.\n\n**This plugin doesn't have any dependencies, but therefore it also supports features that `python-dotenv` supports (e.g. templates, interpolating variables using `POSIX` variable expansions etc).**\n\n# \u2699\ufe0f Installation\n\n```bash\npoetry self add poetry-plugin-dotenv\n```\n\n# \ud83d\udc69\ud83c\udffb\u200d\ud83d\udcbb Usage\n\nBy default, plugin will load the `.env` file from the current working directory or \"higher directories\".\n\nTo prevent ``poetry`` from loading the dotenv file, set the ``POETRY_DONT_LOAD_DOTENV`` environment variable.\n\nIf your dotenv file is located in a different path or has a different name you may set the ``POETRY_DOTENV_LOCATION`` environment variable.\n\n<img alt=\"logo\" src=\"https://github.com/volopivoshenko/poetry-plugin-dotenv/blob/main/docs/static/assets/demo.gif?raw=True\">\n\n```dotenv\n# .env\nDB__HOST=localhost\nDB__DBNAME=prod\nDB__USER=admin\nDB__PASSWORD=admin\nDB__ENGINE=postgresql://${DB__USER}:${DB__PASSWORD}@${DB__HOST}/${DB__DBNAME}\n```\n\n```dotenv\n# .env.dev\nDB__HOST=localhost\nDB__DBNAME=dev\nDB__USER=root\nDB__PASSWORD=root\nDB__ENGINE=postgresql://${DB__USER}:${DB__PASSWORD}@${DB__HOST}/${DB__DBNAME}\n```\n\n```python\n# main.py\nimport os\n\n\nif __name__ == \"__main__\":\n try:\n print(f\"Host: {os.environ['DB__HOST']!r}\")\n print(f\"Name: {os.environ['DB__DBNAME']!r}\")\n print(f\"Username: {os.environ['DB__USER']!r}\")\n print(f\"Password: {os.environ['DB__PASSWORD']!r}\")\n print(f\"Engine: {os.environ['DB__ENGINE']!r}\")\n\n except KeyError:\n print(\"Environment variables not set!\")\n```\n\n```bash\npoetry run -vvv python main.py\n# Loading environment variables from '.env'.\n# Host: 'localhost'\n# Name: 'prod'\n# Username: 'admin'\n# Password: 'admin'\n# Engine 'postgresql://admin:admin@localhost/prod'\n\nexport POETRY_DOTENV_LOCATION=.env.dev && poetry run -vvv python main.py\n# Loading environment variables from '.env.dev'.\n# Host: 'localhost'\n# Name: 'dev'\n# Username: 'root'\n# Password: 'root'\n# Engine 'postgresql://root:root@localhost/dev'\n\nexport POETRY_DONT_LOAD_DOTENV=1 && poetry run -vvv python main.py\n# Not loading environment variables.\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "poetry-dotenv - is the plugin that automatically loads environment variables from a dotenv file into the environment before poetry commands are run.",
"version": "0.4.0",
"split_keywords": [
"python",
"pypi",
"poetry",
"plugin",
"plugins",
"poetry-plugin",
"poetry-plugins",
"env",
"dotenv",
"cross-platform",
"hacktoberfest"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c38f687c6572a8b8b1a78abe3d19cbac30eaba882c4f320085af00c60a284a5b",
"md5": "455f74ba94a5dd0dcca03c42002ff353",
"sha256": "b9e71fdd25ed9c49b3ad39cc12f5887d49f2f3806c0e4cf3f8a1d54304856b18"
},
"downloads": -1,
"filename": "poetry_dotenv-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "455f74ba94a5dd0dcca03c42002ff353",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8.1,<4.0",
"size": 11308,
"upload_time": "2023-04-07T17:14:59",
"upload_time_iso_8601": "2023-04-07T17:14:59.991650Z",
"url": "https://files.pythonhosted.org/packages/c3/8f/687c6572a8b8b1a78abe3d19cbac30eaba882c4f320085af00c60a284a5b/poetry_dotenv-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "31fa157c9512491d0945fd085eda83dd36f4d0053025ce14271d3ead16406ea6",
"md5": "4accb8fe52965a616369229f0ee5155f",
"sha256": "4e68aaf7d8a44fb89ab1d1d49f799d7bacbc365ed9b0ae9b46a68c816fa1a53b"
},
"downloads": -1,
"filename": "poetry_dotenv-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "4accb8fe52965a616369229f0ee5155f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8.1,<4.0",
"size": 22251,
"upload_time": "2023-04-07T17:15:01",
"upload_time_iso_8601": "2023-04-07T17:15:01.472492Z",
"url": "https://files.pythonhosted.org/packages/31/fa/157c9512491d0945fd085eda83dd36f4d0053025ce14271d3ead16406ea6/poetry_dotenv-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-07 17:15:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "volopivoshenko",
"github_project": "poetry-dotenv",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "poetry-dotenv"
}