Poetry plugin that adds support for pypi.org mirrors and pull-through caches
Project description
poetry-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
.
Environment variable example
POETRY_PYPI_MIRROR_URL=https://example.org/repository/pypi-proxy/simple/ poetry add pendulum
...or...
export POETRY_PYPI_MIRROR_URL=https://example.org/repository/pypi-proxy/simple/
poetry add cleo # uses mirror specified in first line
poetry lock # also uses mirror specified in first line
Compatibility
poetry-plugin-pypi-mirror depends on poetry internals which can change between poetry releases. It's important to ensure compatibility between the poetry version in use and the plugin version in use.
Poetry version(s) | Compatible plugin version(s) |
---|---|
>= 1.3, < 1.5 | ^0.3.1 |
~1.2.1 | < 0.3.0 |
See also
- python-poetry/poetry#1632 - poetry feature request to add support for global repository URL replacement
Project details
Release history Release notifications | RSS feed
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
Hashes for poetry_plugin_pypi_mirror-0.3.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78a51e883c64f121db17b88634899d7c33a88982256a32f630a0bebf07b3f3eb |
|
MD5 | 78c76b27838eb008df1d2b17824dde0c |
|
BLAKE2b-256 | e11e63b3de8fd69f2b48a66cca33e2076f0c46bd1f4c5ba824433132cb9426bd |
Hashes for poetry_plugin_pypi_mirror-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63e988bce2bf61f76d92ed025a61799f09842f57c8a66f8563a51ac63a620fd0 |
|
MD5 | 4aeb4c6918aae674528280f2be3ec72c |
|
BLAKE2b-256 | d3c6c3aa54b2c91220914e7ee3b016b69072c13700d72e6c285c8bd020ccd893 |