# poetry-source-env
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/poetry-source-env?logo=python&logoColor=white&style=for-the-badge)](https://pypi.org/project/poetry-source-env)
[![PyPI](https://img.shields.io/pypi/v/poetry-source-env?logo=pypi&color=green&logoColor=white&style=for-the-badge)](https://pypi.org/project/poetry-source-env)
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/celsiusnarhwal/poetry-source-env?logo=github&color=orange&logoColor=white&style=for-the-badge)](https://github.com/celsiusnarhwal/poetry-source-env/releases)
[![PyPI - License](https://img.shields.io/pypi/l/poetry-source-env?color=03cb98&style=for-the-badge)](https://github.com/celsiusnarhwal/poetry-source-env/blob/main/LICENSE.md)
[![Code style: Black](https://aegis.celsiusnarhwal.dev/badge/black?style=for-the-badge)](https://github.com/psf/black)
poetry-source-env is a Poetry plugin that lets you define private package sources for your project without exposing
their URLs in `pyproject.toml`. It can load package source definitions from environment variables and expand environment
variables in the `tool.poetry.source` section of `pyproject.toml`.
This plugin is intended as a workaround for python-poetry/poetry#5958 and will be deprecated if comparable functionality
is ever implemented in Poetry itself.
Note that poetry-source-env cannot resolve repositories when installing other Poetry plugins (Poetry does not
load plugins when running `poetry self` commands). If you need a python-poetry/poetry#5958 workaround for installing Poetry
plugins, see https://github.com/python-poetry/poetry/issues/5958#issuecomment-1479183720.
## Installation
```bash
poetry self add poetry-source-env
```
## Usage
Normally, you would define a package source in `pyproject.toml` like this:
```toml
[[tool.poetry.source]]
name = "foo"
url = "https://foo.bar/simple"
priority = "supplemental"
```
With poetry-source-env, you can define this source via environment variables, similar to how you can already
configure [publishable repositories](https://python-poetry.org/docs/repositories/#publishable-repositories:~:text=Alternatively%2C%20you%20can%20use%20environment%20variables%20to%20provide%20the%20credentials%3A):
```bash
export POETRY_REPOSITORIES_FOO_URL=https://foo.bar/simple
export POETRY_REPOSITORIES_FOO_PRIORITY=supplemental
```
If you prefer to keep the source defined in `pyproject.toml`, you can opt to conceal its name or URL, in whole or
in part, behind environment variables:
```bash
export FOO_INDEX_NAME="foo"
export FOO_INDEX_URL="https://foo.bar/simple"
```
```toml
[[tool.poetry.source]]
name = "${FOO_INDEX_NAME}"
url = "${FOO_INDEX_URL}"
priority = "supplemental"
```
If your source requires authentication, Poetry already supports defining its credentials via environment variables:
```bash
export POETRY_HTTP_BASIC_FOO_USERNAME=celsiusnarhwal
export POETRY_HTTP_BASIC_FOO_PASSWORD=superdupersecret
```
## Configuration
poetry-source-env's behavior can be configured via the `tool.poetry-source-env` section of `pyproject.toml`.
Supported configuration options include:
| **Name** | **Type** | **Description** | **Required?** | **Default** |
| -------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- | ------------- | ---------------------- |
| `prefix` | string | The prefix which poetry-source-env should expect source-defining environment variables to use. Has no effect if `env` is `false`. | No | `POETRY_REPOSITORIES_` |
| `env` | boolean | Whether to read package source definitions from environment variables. | No | `true` |
| `toml` | boolean | Whether to expand environment variables in the `tool.poetry.source` section of `pyproject.toml`. | No | `true` |
## License
poetry-source-env is licensed under the [MIT License](https://github.com/celsiusnarhwal/poetry-source-env/blob/main/LICENSE.md).
Raw data
{
"_id": null,
"home_page": "https://github.com/celsiusnarhwal/poetry-source-env",
"name": "poetry-source-env",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "celsius narhwal",
"author_email": "hello@celsiusnarhwal.dev",
"download_url": "https://files.pythonhosted.org/packages/e3/2f/10d1b6ab92e7f5ed6b778cd1eef80f215ad539cc4531019d63edf1386718/poetry_source_env-2.0.1.tar.gz",
"platform": null,
"description": "# poetry-source-env\n\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/poetry-source-env?logo=python&logoColor=white&style=for-the-badge)](https://pypi.org/project/poetry-source-env)\n[![PyPI](https://img.shields.io/pypi/v/poetry-source-env?logo=pypi&color=green&logoColor=white&style=for-the-badge)](https://pypi.org/project/poetry-source-env)\n[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/celsiusnarhwal/poetry-source-env?logo=github&color=orange&logoColor=white&style=for-the-badge)](https://github.com/celsiusnarhwal/poetry-source-env/releases)\n[![PyPI - License](https://img.shields.io/pypi/l/poetry-source-env?color=03cb98&style=for-the-badge)](https://github.com/celsiusnarhwal/poetry-source-env/blob/main/LICENSE.md)\n[![Code style: Black](https://aegis.celsiusnarhwal.dev/badge/black?style=for-the-badge)](https://github.com/psf/black)\n\npoetry-source-env is a Poetry plugin that lets you define private package sources for your project without exposing\ntheir URLs in `pyproject.toml`. It can load package source definitions from environment variables and expand environment\nvariables in the `tool.poetry.source` section of `pyproject.toml`.\n\nThis plugin is intended as a workaround for python-poetry/poetry#5958 and will be deprecated if comparable functionality\nis ever implemented in Poetry itself.\n\nNote that poetry-source-env cannot resolve repositories when installing other Poetry plugins (Poetry does not\nload plugins when running `poetry self` commands). If you need a python-poetry/poetry#5958 workaround for installing Poetry\nplugins, see https://github.com/python-poetry/poetry/issues/5958#issuecomment-1479183720.\n\n## Installation\n\n```bash\npoetry self add poetry-source-env\n```\n\n## Usage\n\nNormally, you would define a package source in `pyproject.toml` like this:\n\n```toml\n[[tool.poetry.source]]\nname = \"foo\"\nurl = \"https://foo.bar/simple\"\npriority = \"supplemental\"\n\n```\n\nWith poetry-source-env, you can define this source via environment variables, similar to how you can already\nconfigure [publishable repositories](https://python-poetry.org/docs/repositories/#publishable-repositories:~:text=Alternatively%2C%20you%20can%20use%20environment%20variables%20to%20provide%20the%20credentials%3A):\n\n```bash\nexport POETRY_REPOSITORIES_FOO_URL=https://foo.bar/simple\nexport POETRY_REPOSITORIES_FOO_PRIORITY=supplemental\n```\n\nIf you prefer to keep the source defined in `pyproject.toml`, you can opt to conceal its name or URL, in whole or\nin part, behind environment variables:\n\n```bash\nexport FOO_INDEX_NAME=\"foo\"\nexport FOO_INDEX_URL=\"https://foo.bar/simple\"\n```\n\n```toml\n[[tool.poetry.source]]\nname = \"${FOO_INDEX_NAME}\"\nurl = \"${FOO_INDEX_URL}\"\npriority = \"supplemental\"\n\n```\n\nIf your source requires authentication, Poetry already supports defining its credentials via environment variables:\n\n```bash\nexport POETRY_HTTP_BASIC_FOO_USERNAME=celsiusnarhwal\nexport POETRY_HTTP_BASIC_FOO_PASSWORD=superdupersecret\n```\n\n## Configuration\n\npoetry-source-env's behavior can be configured via the `tool.poetry-source-env` section of `pyproject.toml`.\n\nSupported configuration options include:\n\n| **Name** | **Type** | **Description** | **Required?** | **Default** |\n| -------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- | ------------- | ---------------------- |\n| `prefix` | string | The prefix which poetry-source-env should expect source-defining environment variables to use. Has no effect if `env` is `false`. | No | `POETRY_REPOSITORIES_` |\n| `env` | boolean | Whether to read package source definitions from environment variables. | No | `true` |\n| `toml` | boolean | Whether to expand environment variables in the `tool.poetry.source` section of `pyproject.toml`. | No | `true` |\n\n## License\n\npoetry-source-env is licensed under the [MIT License](https://github.com/celsiusnarhwal/poetry-source-env/blob/main/LICENSE.md).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Load Poetry package sources from environment variables",
"version": "2.0.1",
"project_urls": {
"Homepage": "https://github.com/celsiusnarhwal/poetry-source-env",
"Repository": "https://github.com/celsiusnarhwal/poetry-source-env"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3c4b03b55d997f25b926654cd2cf6a0549ff264b184f774752dfda45cc1d7623",
"md5": "ff0e3da6bfb42144de988002dc11ff64",
"sha256": "345b80aad0ab689de01227174c4f3421605b96a40a78797c6534b90ae92e7e13"
},
"downloads": -1,
"filename": "poetry_source_env-2.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ff0e3da6bfb42144de988002dc11ff64",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 4878,
"upload_time": "2023-06-15T20:44:10",
"upload_time_iso_8601": "2023-06-15T20:44:10.731246Z",
"url": "https://files.pythonhosted.org/packages/3c/4b/03b55d997f25b926654cd2cf6a0549ff264b184f774752dfda45cc1d7623/poetry_source_env-2.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e32f10d1b6ab92e7f5ed6b778cd1eef80f215ad539cc4531019d63edf1386718",
"md5": "6c07b0c486ab627bbc01596eea977661",
"sha256": "5f39b8a1f15170a838303ed0f62d8989c8f45ebfd9b2c887083d08745210c287"
},
"downloads": -1,
"filename": "poetry_source_env-2.0.1.tar.gz",
"has_sig": false,
"md5_digest": "6c07b0c486ab627bbc01596eea977661",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 3908,
"upload_time": "2023-06-15T20:44:12",
"upload_time_iso_8601": "2023-06-15T20:44:12.733951Z",
"url": "https://files.pythonhosted.org/packages/e3/2f/10d1b6ab92e7f5ed6b778cd1eef80f215ad539cc4531019d63edf1386718/poetry_source_env-2.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-15 20:44:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "celsiusnarhwal",
"github_project": "poetry-source-env",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "poetry-source-env"
}