Load Poetry package sources from environment variables
Project description
poetry-source-env
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.
Installation
poetry self add poetry-source-env
Usage
Normally, you would define a package source in pyproject.toml
like this:
[[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:
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:
export FOO_INDEX_NAME="foo"
export FOO_INDEX_URL="https://foo.bar/simple"
[[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:
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file poetry_source_env-2.0.0.tar.gz
.
File metadata
- Download URL: poetry_source_env-2.0.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.0 CPython/3.11.1 Linux/5.15.0-1037-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69c3f93a094ade8426e0b348dfdf5676b3e35bee8dca8fd43d177eaf9a98cdea |
|
MD5 | 992327856ae257a9d76cedd374667cc3 |
|
BLAKE2b-256 | 5585d1871ca6a19ad1403ec9bfd27487315eb89ec8effdf57c8ccbbae035a910 |
File details
Details for the file poetry_source_env-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: poetry_source_env-2.0.0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.0 CPython/3.11.1 Linux/5.15.0-1037-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ebf21f4bccd8bf98dea35c59d55315b8225c61d2bc6958d8472148433bd5638 |
|
MD5 | c730a70e12c34aeef6c7b78d65841a53 |
|
BLAKE2b-256 | 487a133a24bc90a0a42961239f5d867e094f04983baa68740f66567cadabf6e7 |