Poetry plugin that adds support for pypi.org mirrors and pull-through caches
Maintained. Last release 2 months ago, commits in 1 of the last 26 weeks. Weaker on commit activity and contributor spread.
pip install poetry-plugin-pypi-mirrorpoetry-plugin-pypi-mirror
Description
poetry-plugin-pypi-mirror is a plugin for poetry, the Python packaging and dependency manager. It enables poetry to substitute connections to pypi.org with connections to a pypi.org mirror or pull-through cache without requiring project configuration changes. This is ideal for situations where an access-restricted or otherwise unsuitable-for-general-use pypi.org mirror must be used by a subset of project contributors. For example:
- A private PyPI mirror internal to a business, required by company policy
- A limited-access PyPI mirror in a region where pypi.org is restricted
- A regional mirror that is more performant for a few users, and less performant for everyone else
These mirrors can be used without this plugin by adding them as project
repositories. However, this
requires the mirror to be included in the project's configuration, and this also
results in source entries for the mirror appearing in poetry.lock. Since only
a subset of project contributors can use these mirrors, that subset of users
would need to replace and remove references to the mirror repository each time
they want to contribute their changes back to the project. This is suboptimal.
Usage
Installation
Follow poetry's plugin installation instructions, replacing poetry-plugin with poetry-plugin-pypi-mirror.
Specifying a mirror
To specify a mirror, you can either define plugins.pypi_mirror.url in poetry's
configuration, or set
environment variable POETRY_PYPI_MIRROR_URL to the full URL for a PEP
503-compatible mirror. When both are set the
environment variable will be used.
Poetry config example
[plugins]
[plugins.pypi_mirror]
url = "https://example.org/repository/pypi-proxy/simple/"
... in either a project's
poetry.toml (for per-project configuration), or the user's config.toml.