Skip to the content.

pip, uv, Poetry, PDM

Point the Python installers at the proxy’s PyPI upstream instead of pypi.org. The examples use the upstream name pypi; replace it with the name your operator gave the upstream (what you need).

   
Upstream type pip
Package source https://proxy.example.com/v1/pypi/simple/ (the Simple index)
Clients pip, uv, Poetry, PDM
Tested pip 25.0: in CI on every push and in the client lab. uv 0.13, Poetry 2.5, PDM 2.29: in the client lab.

Configure

The index URL ends in /simple/. One index is enough: the proxy rewrites the file links in the pages it serves, so wheels and sdists (hosted on files.pythonhosted.org) come back through it too.

pip

pip.conf — ~/.config/pip/pip.conf on Linux, ~/Library/Application Support/pip/pip.conf on macOS, %APPDATA%\pip\pip.ini on Windows:

[global]
index-url = https://proxy.example.com/v1/pypi/simple/

In a CI job or a Dockerfile:

export PIP_INDEX_URL=https://proxy.example.com/v1/pypi/simple/

For one command, --index-url takes the same URL.

uv

A default index in ~/.config/uv/uv.toml (or under [tool.uv] in a project’s pyproject.toml):

[[index]]
name = "proxy"
url = "https://proxy.example.com/v1/pypi/simple/"
default = true

Or in the environment:

export UV_DEFAULT_INDEX=https://proxy.example.com/v1/pypi/simple/

Poetry

A primary source in the project’s pyproject.toml:

[[tool.poetry.source]]
name = "proxy"
url = "https://proxy.example.com/v1/pypi/simple/"
priority = "primary"

PDM

pdm config pypi.url https://proxy.example.com/v1/pypi/simple/

Authenticate

Only when the proxy has access control switched on. The proxy takes your proxy token as the password of HTTP Basic authentication, with any user name (pullthrough below) — never a PyPI token.

pip — in the index URL:

index-url = https://pullthrough:<token>@proxy.example.com/v1/pypi/simple/

or, to keep the token out of pip.conf, the environment and requirements files, in ~/.netrc (mode 600), which pip reads for the index’s host:

machine proxy.example.com
  login pullthrough
  password <token>

uv — per index name, in the environment (PROXY is the index’s name, upper-cased):

export UV_INDEX_PROXY_USERNAME=pullthrough
export UV_INDEX_PROXY_PASSWORD="<token>"

or in the URL, where the index itself is set in the environment:

export UV_DEFAULT_INDEX=https://pullthrough:<token>@proxy.example.com/v1/pypi/simple/

Poetry — per source name, in Poetry’s own configuration:

poetry config http-basic.proxy pullthrough "<token>"

PDM:

pdm config pypi.username pullthrough
pdm config pypi.password "<token>"

Trust a private CA

Only when the proxy’s certificate is issued by a CA that is not in the trust store the client uses (pip and Poetry bring their own).

pip — in pip.conf, or in the environment:

cert = /etc/ssl/corp-ca.pem
export PIP_CERT=/etc/ssl/corp-ca.pem

uv:

export SSL_CERT_FILE=/etc/ssl/corp-ca.pem

Poetry — per source name:

poetry config certificates.proxy.cert /etc/ssl/corp-ca.pem

PDM:

pdm config pypi.ca_certs /etc/ssl/corp-ca.pem

Check that it works

An install says where it looks and where each file comes from — both must name the proxy:

Looking in indexes: https://proxy.example.com/v1/pypi/simple/
Collecting six==1.16.0
  Downloading https://proxy.example.com/v1/pypi/files/https/files.pythonhosted.org/packages/d9/5a/…/six-1.16.0-py2.py3-none-any.whl (11 kB)

ptctl selftest checks every upstream at once (client CLI).

Good to know

On the proxy

upstreams:
  pypi:
    type: pip
    url: https://pypi.org

Simple pages are served live with their file links rewritten to the proxy’s /files/… route (which is why server.publicUrl must be set); files are cached immutably, and only from the hosts in settings.fileHosts (files.pythonhosted.org by default). Details: backends: pip.