{"id":35219076,"url":"https://github.com/epicwink/proxpi","last_synced_at":"2026-04-27T03:01:20.640Z","repository":{"id":39974130,"uuid":"247687618","full_name":"EpicWink/proxpi","owner":"EpicWink","description":"PyPI caching proxy","archived":false,"fork":false,"pushed_at":"2026-04-24T07:20:47.000Z","size":522,"stargazers_count":193,"open_issues_count":16,"forks_count":32,"subscribers_count":5,"default_branch":"master","last_synced_at":"2026-04-24T08:28:45.577Z","etag":null,"topics":["cache","index","mirror","pypi","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EpicWink.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-03-16T11:42:21.000Z","updated_at":"2026-04-24T06:44:01.000Z","dependencies_parsed_at":"2023-02-18T02:31:14.383Z","dependency_job_id":"4ec8b683-74cf-4c89-9b7c-e4e01512877f","html_url":"https://github.com/EpicWink/proxpi","commit_stats":{"total_commits":145,"total_committers":4,"mean_commits":36.25,"dds":0.03448275862068961,"last_synced_commit":"73542fc57c16a5065aef99e7a467e45bc24c01ad"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"purl":"pkg:github/EpicWink/proxpi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EpicWink%2Fproxpi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EpicWink%2Fproxpi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EpicWink%2Fproxpi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EpicWink%2Fproxpi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EpicWink","download_url":"https://codeload.github.com/EpicWink/proxpi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EpicWink%2Fproxpi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32320683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cache","index","mirror","pypi","python"],"created_at":"2025-12-29T23:34:04.840Z","updated_at":"2026-04-27T03:01:20.633Z","avatar_url":"https://github.com/EpicWink.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# proxpi\n[![Build status](\nhttps://github.com/EpicWink/proxpi/actions/workflows/test-python-package.yml/badge.svg?branch=master)](\nhttps://github.com/EpicWink/proxpi/actions?query=branch%3Amaster+workflow%3Atest)\n[![codecov](https://codecov.io/gh/EpicWink/proxpi/branch/master/graph/badge.svg)](\nhttps://codecov.io/gh/EpicWink/proxpi)\n[![PyPI - Version](https://img.shields.io/pypi/v/proxpi?logo=pypi)](\nhttps://pypi.org/project/proxpi/)\n\nPyPI caching proxy\n\n* Host a proxy PyPI mirror server with caching\n  * Cache the index (project list and projects' file list)\n  * Cache the project files\n* Proxy multiple package indices\n* Provide and consume both JSON and HTML\n  [APIs](https://packaging.python.org/en/latest/specifications/simple-repository-api/)\n* Set index cache times-to-live (individually for each index)\n* Set files cache max-size on disk\n* Manually invalidate index cache\n\nSee [Alternatives](#alternatives).\n\n## Usage\n### Start server\nChoose between running inside [Docker](https://www.docker.com/) container if you want to\nrun in a known-working environment, or outside via a Python app (instructions here are\nfor the [Flask](https://flask.palletsprojects.com/en/latest/) development server) if you\nwant more control over the environment.\n\n\u003e **Note**: the index cache and the management of the file cache runs in memory, but is\n\u003e not synchronised across multiple processes, so use multiple threads instead of\n\u003e multiple processes. The cache is thread-safe.\n\n#### Docker\nUses a [Gunicorn](https://gunicorn.org/) WSGI server\n```bash\ndocker run -p 5000:5000 epicwink/proxpi\n```\n\nWithout arguments, runs with 2 threads. If passing arguments, make sure to bind to an\nexported address (or all with `0.0.0.0`) on port 5000 (ie `--bind 0.0.0.0:5000`).\n\n##### Compose\nAlternatively, use [Docker Compose](https://docs.docker.com/compose/)\n```bash\ndocker compose up\n```\n\n#### Local\n##### Install\n```bash\npip install proxpi\n```\n\nInstall `proxpi[pretty]` instead to get coloured logging and tracebacks (disable by\nsetting environment variable `NO_COLOR=1`).\n\n##### Run server\n```bash\nFLASK_APP=proxpi.server flask run\n```\n\nSee `flask run --help` for more information on address and port binding, and certificate\nspecification to use HTTPS. Alternatively, bring your own WSGI server.\n\n### Use proxy\nUse PIP's index-URL flag to install packages via the proxy\n\n```bash\npip install --index-url http://127.0.0.1:5000/index/ simplejson\n```\n\n### Cache invalidation\nEither head to http://127.0.0.1:5000/ in the browser, or run:\n```bash\ncurl -X DELETE http://127.0.0.1:5000/cache/simplejson\ncurl -X DELETE http://127.0.0.1:5000/cache/list\n```\n\nIf you need to invalidate a locally cached file, restart the server: files should never\nchange in a package index.\n\n### Environment variables\n* `PROXPI_INDEX_URL`: index URL, default: https://pypi.org/simple/\n* `PROXPI_INDEX_TTL`: index cache time-to-live in seconds,\n   default: 30 minutes. Disable index-cache by setting this to 0\n* `PROXPI_EXTRA_INDEX_URLS`: extra index URLs (comma-separated)\n* `PROXPI_EXTRA_INDEX_TTLS`: corresponding extra index cache times-to-live in seconds\n   (comma-separated), default: 3 minutes, cache disabled when 0\n* `PROXPI_CACHE_SIZE`: size of downloaded project files cache (bytes), default 5GB.\n  Disable files-cache by setting this to 0\n* `PROXPI_CACHE_DIR`: downloaded project files cache directory path, default: a new\n  temporary directory\n* `PROXPI_BINARY_FILE_MIME_TYPE=1`: force file-response content-type to\n  `\"application/octet-stream\"` instead of letting Flask guess it\n* `PROXPI_DISABLE_INDEX_SSL_VERIFICATION=1`: don't verify any index SSL certificates\n* `PROXPI_DOWNLOAD_TIMEOUT`: time (in seconds) before `proxpi` will redirect to the\n  proxied index server for file downloads instead of waiting for the download,\n  default: 0.9\n* `PROXPI_CONNECT_TIMEOUT`: time (in seconds) `proxpi` will wait for a socket to\n  connect to the index server before `requests` raises a `ConnectTimeout` error\n  to prevent indefinite blocking, default: none, or 3.1 if read-timeout provided\n* `PROXPI_READ_TIMEOUT`: time (in seconds) `proxpi` will wait for chunks of data\n  from the index server before `requests` raises a `ReadTimeout` error to prevent\n  indefinite blocking, default: none, or 20 if connect-timeout provided\n* `PROXPI_LOGGING_LEVEL`: Python\n  [logging level](https://docs.python.org/3/library/logging.html#levels); default:\n  `INFO`\n\n### Considerations with CI\n`proxpi` was designed with three goals (particularly for continuous integration (CI)):\n* to reduce load on PyPI package serving\n* to reduce `pip install` times\n* not require modification to the current workflow\n\nSpecifically, `proxpi` was designed to run for CI services such as\n[Travis](https://travis-ci.org/),\n[Jenkins](https://jenkins.io/),\n[GitLab CI](https://docs.gitlab.com/ee/ci/),\n[Azure Pipelines](https://azure.microsoft.com/en-us/services/devops/pipelines/)\nand [GitHub Actions](https://github.com/features/actions).\n\n`proxpi` works by caching index requests (ie which versions, wheel-types, etc are\navailable for a given project, the index cache) and the project files themselves (to a\nlocal directory, the package cache). This means they will cache identical requests after\nthe first request, and will be useless for just one `pip install`.\n\n#### Cache persistence\nAs a basic end-user of these services, for at least most of these services you won't be\nable to keep a `proxpi` server running between multiple invocations of your project(s)\nCI pipeline: CI invocations are designed to be independent. This means the best that you\ncan do is start the cache for just the current job.\n\nA more advanced user of these CI services can bring their own runner (personally, my\nneeds are for running GitLab CI). This means you can run `proxpi` on a fully-controlled\nserver (eg [EC2](https://aws.amazon.com/ec2/) instance), and proxy PyPI requests (during\na `pip` command) through the local cache. See the instructions\n[below](#gitlab-ci-instructions).\n\nHopefully, in the future these CI services will all implement their own transparent\ncaching for PyPI. For example, Azure already has\n[Azure Artifacts](https://azure.microsoft.com/en-au/services/devops/artifacts/) which\nprovides much more functionality than `proxpi`, but won't reduce `pip install` times for\nCI services not using Azure.\n\n#### GitLab CI instructions\nThis implementation leverages the index URL configurable of `pip` and Docker networks.\nThis is to be run on a server you have console access to.\n\n1. Create a Docker bridge network\n   ```shell\n   docker network create gitlab-runner-network\n   ```\n\n1. Start a GitLab CI Docker runner using\n   [their documentation](https://docs.gitlab.com/runner/install/docker.html)\n\n2. Run the `proxpi` Docker container\n   ```bash\n   docker run \\\n     --detach \\\n     --network gitlab-runner-network \\\n     --volume proxpi-cache:/var/cache/proxpi \\\n     --env PROXPI_CACHE_DIR=/var/cache/proxpi \\\n     --name proxpi epicwink/proxpi:latest\n   ```\n   You don't need to expose a port (the `-p` flag) as we'll be using an internal\n   Docker network.\n\n4. Set `pip`'s index URL to the `proxpi` server by setting it in the runner environment.\n   Set `runners[0].docker.network_mode` to `gitlab-runner-network`.\n   Add `PIP_INDEX_URL=http://proxpi:5000/index/` and `PIP_TRUSTED_HOST=proxpi`\n   to `runners.environment` in the GitLab CI runner configuration TOML. For example, you\n   may end up with the following configuration:\n   ```toml\n   [[runners]]\n     name = \"awesome-ci-01\"\n     url = \"https://gitlab.com/\"\n     token = \"SECRET\"\n     executor = \"docker\"\n     environment = [\n       \"DOCKER_TLS_CERTDIR=/certs\",\n       \"PIP_INDEX_URL=http://proxpi:5000/index/\",\n       \"PIP_TRUSTED_HOST=proxpi\",\n     ]\n\n   [[runners.docker]]\n     network_mode = \"gitlab-runner-network\"\n     ...\n   ```\n\nThis is designed to not require any changes to the GitLab CI project configuration (ie\n`gitlab-ci.yml`), unless it already sets the index URL for some reason (if that's the\ncase, you're probably already using a cache).\n\nAnother option is to set up a proxy, but that's more effort than the above method.\n\n## Alternatives\n* [simpleindex](https://pypi.org/project/simpleindex/): routes URLs to multiple\n  indices (including PyPI), supports local (or S3 with a plygin) directory of packages,\n  no caching without custom plugins\n\n* [bandersnatch](https://pypi.org/project/bandersnatch/): mirrors one index (eg PyPI),\n  storing packages locally, or on S3 with a plugin. Manual update, no proxy\n\n* [devpi](https://pypi.org/project/devpi/): heavyweight, runs a full index (or multiple)\n  in addition to mirroring (in place of proxying), supports proxying (with inheritance),\n  supports package upload, server replication and fail-over\n\n* [pypiserver](https://pypi.org/project/pypiserver/): serves local directory of\n  packages, proxy to PyPI when not-found, supports package upload, no caching\n\n* [`dumb-pypi`](https://pypi.org/project/dumb-pypi/): generates a static website of a\n  package index pointing to statically-located files, no hosting (therefore no caching\n  nor proxying unless configured in server)\n\n* [PyPI Cloud](https://pypi.org/project/pypicloud/): serves local or cloud-storage\n  directory of packages, with redirecting/cached proxying to indexes, authentication and\n  authorisation.\n\n* [`pypiprivate`](https://pypi.org/project/pypiprivate/): serves local (or S3-hosted)\n  directory of packages, no proxy to package indices (including PyPI)\n\n* [Pulp](https://pypi.org/project/pulpcore/): generic content repository, can host\n  multiple ecosystems' packages.\n  [Python package index plugin](https://pypi.org/project/pulp-python/) supports local/S3\n  mirrors, package upload, proxying to multiple indices, no caching\n\n* [`pip2pi`](https://pypi.org/project/pip2pi/): manual syncing of specific packages,\n  no proxy\n\n* [`nginx_pypi_cache`](https://github.com/hauntsaninja/nginx_pypi_cache): caching proxy\n  using [nginx](https://nginx.org/en/), single index\n\n* [Flask-Pypi-Proxy](https://pypi.org/project/Flask-Pypi-Proxy/): unmaintained, no cache\n  size limit, no caching index pages\n\n* [`http.server`](https://docs.python.org/3/library/http.server.html): standard-library,\n  hosts directory exactly as laid out, no proxy to package indices (eg PyPI)\n\n* [Apache with `mod_rewrite`](\n  https://httpd.apache.org/docs/current/mod/mod_rewrite.html): I'm not familiar with\n  Apache, but it likely has the capability to proxy and cache (with eg `mod_cache_disk`)\n\n* [Gemfury](https://fury.co/l/pypi-server): hosted, managed. Private index is not free,\n  documentation doesn't say anything about proxying\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepicwink%2Fproxpi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fepicwink%2Fproxpi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepicwink%2Fproxpi/lists"}