Skip to main content

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

Authentication

If the mirror you're using requires authentication, you can add the credentials like you would for any other repository.

Please note that repository names are case-sensitive, so it is important that you configure the credentials for PyPI. pypi or other variations will not work.

poetry config http-basic.PyPI <username> <password/token>

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)
>= 2.1, < 2.6 ^0.6.5
>= 2.0, < 2.1 ^0.5.0
>= 1.3, < 2 ^0.4.2
~1.2.1 < 0.3.0

Contributing

To contribute, open a pull request.

Sign your work

All commits must be signed to be accepted. Your signature certifies that you have the right to submit your contribution(s) to the project, in accordance with the principles described in the Developer Certificate of Origin.

Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

To sign your commits, use the template below to generate a signature, and then add that signature to your commit message(s):

Signed-off-by: Your Name <Your.Name@example.com>

You must use your true name. Pseudonyms are not permitted.

If you have set git's user.name and user.email, you can sign commits easily at commit time using git commit -s.

See also

Metadata

Release files for poetry-plugin-pypi-mirror 0.6.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for poetry-plugin-pypi-mirror 0.6.5
File Size Uploaded
poetry_plugin_pypi_mirror-0.6.5.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for poetry-plugin-pypi-mirror 0.6.5
File Interpreter ABI Platform
poetry_plugin_pypi_mirror-0.6.5-py3-none-any.whl Python 3 none any Details

Total release size: 13.3 kB

Release files / poetry_plugin_pypi_mirror-0.6.5.tar.gz

Download URL poetry_plugin_pypi_mirror-0.6.5.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a0be127a4e225a0634feb7544c16da720f65908d43f1774cc0873639a4acbaaa
BLAKE2b-256 checksum
How to use checksums
c71da2b997c2d17e62cb0e221322699e40f3d25cc99f963878d9d960c8534e26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.14.7 Linux/7.2.6-arch2-1

Release files / poetry_plugin_pypi_mirror-0.6.5-py3-none-any.whl

Download URL poetry_plugin_pypi_mirror-0.6.5-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a361e170f3189d3ea8e87a27932920a7934a72f6185d983d9643133c689dbd82
BLAKE2b-256 checksum
How to use checksums
8ffcb171e1bd88545b9082893d57245de952ac1c1b95bfca322e6f56ec0f697d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.14.7 Linux/7.2.6-arch2-1

Release history Release notifications | RSS feed

This release

0.6.5 This release

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page