You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

poetry-source-env

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

poetry-source-env

Load Poetry package sources from environment variables

2.0.1
pipPyPI
Maintainers
1

poetry-source-env

PyPI - Python Version PyPI GitHub release (latest SemVer) PyPI - License Code style: 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

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:

NameTypeDescriptionRequired?Default
prefixstringThe prefix which poetry-source-env should expect source-defining environment variables to use. Has no effect if env is false.NoPOETRY_REPOSITORIES_
envbooleanWhether to read package source definitions from environment variables.Notrue
tomlbooleanWhether to expand environment variables in the tool.poetry.source section of pyproject.toml.Notrue

License

poetry-source-env is licensed under the MIT License.

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.