Skip to content
GitHub

Configure a PyPI proxy cache for pip and uv

Use Depsilo as a PyPI proxy cache for pip, uv, and Poetry with project or virtualenv settings, existing dependency files, and checks for package requests and cache hits.

BEFOREhttps://pypi.org/simple
AFTERhttp://localhost:23333/pypi/simple/

pip, uv, Poetry, Pipenv, and PDM all use Depsilo’s /pypi/simple/ endpoint.

Prefer command, project, or project virtualenv settings. Record the previous index and merge the required fields without replacing existing configuration files.

Start with command options. They apply only to this install and do not write user configuration. Replace requirements.txt with your project’s dependency file:

终端窗口
python -m pip install -r requirements.txt \
--index-url http://localhost:23333/pypi/simple/ \
--trusted-host localhost:23333

Omit --trusted-host when using HTTPS with a valid certificate.

For persistent settings, activate the project’s virtualenv and merge the following into its configuration: $VIRTUAL_ENV/pip.conf on Unix/macOS or %VIRTUAL_ENV%\pip.ini on Windows. Use python -m pip config debug to find the location. pip does not automatically read pip.conf from the repository root.

Project virtualenv pip configuration
[global]
index-url = http://localhost:23333/pypi/simple/
# Plain HTTP only:
trusted-host =
localhost:23333

If trusted-host already has entries, add the Depsilo host and port to that list. [global] means all pip subcommands; the file location determines the configuration scope.

Optional: user-level configuration. Run this only when you want other projects for the current user to use Depsilo:

终端窗口
python -m pip config --user set global.index-url http://localhost:23333/pypi/simple/

Back up the user file first. For HTTP, also merge trusted-host into that file without replacing its existing list. In an activated virtualenv, python -m pip config --site set global.index-url URL explicitly targets that environment. See pip configuration for scope and precedence; bare pip config set does not guarantee a virtualenv-scoped change.

  1. Check that the instance is ready

    终端窗口
    curl -fsS http://localhost:23333/ready
  2. Make a request without changing the environment

    终端窗口
    python -m pip install --dry-run --ignore-installed --no-cache-dir --no-deps \
    --index-url http://localhost:23333/pypi/simple/ \
    --trusted-host localhost:23333 six

    This command tests connectivity without installing a package. Omit --trusted-host for HTTPS. pip may only fetch index entries and package metadata; do not assume it downloads a complete wheel or source archive.

  3. Confirm the traffic in Admin

    Open Access logs (/admin/logs) in Admin and match the request time, PyPI package, and status. Distinguish index and metadata requests from package files. A successful client command or a local cache hit does not establish a Depsilo artifact cache hit.

  4. Verify artifact caching separately

    Verify caching shows how to download an artifact independently of the package manager’s local cache and inspect the matching logs, using an npm tarball as its example. For Python downloads, check the actual wheel or source archive requests rather than index logs. The first download may already be a hit if the server cache is warm.

Override the index with CI environment variables without rewriting a requirements file. Replace the example hostname with a Depsilo address the runner can actually reach:

终端窗口
export PIP_INDEX_URL=http://depsilo.internal:23333/pypi/simple/
# Plain HTTP only:
export PIP_TRUSTED_HOST=depsilo.internal:23333
python -m pip install -r requirements.txt

If CI runs inside a container, localhost refers to that container, not to Depsilo on the host.

HTTPS with a valid certificate needs no exception. trusted-host allows pip to trust a host without valid HTTPS; this page uses it only for plaintext HTTP examples. After switching to HTTPS, remove only the old Depsilo exception and preserve existing settings for other sources.

Command options apply only to that invocation. For persistent settings, restore the previous index in the virtualenv or user file you changed. Remove only the Depsilo trust exception you added and preserve other fields. Do not add a parallel public fallback as a rollback mechanism.

Which endpoint do other Python clients use?

Section titled “Which endpoint do other Python clients use?”

Pipenv and PDM also use /pypi/simple/. Select the matching client in the Portal and copy its project-scoped configuration.

If requests bypass Depsilo or fail with a 451 response, see Troubleshooting.