How g3tfun/pypidownloader works
pypidownloader is a small FastAPI proxy for pip. A client requests a package index, which the API fetches from upstream indexes, rewrites package-file links, and returns; file requests trigger a race among download mirrors and redirect to the winner, with pythonhosted as fallback. Both routes are implemented in api/index.py; internal calls are shown at the handler level because the sampled implementation is a single file.
Main entry points: index.py Mirror race
Components 11
Proxy API
- Index handler
api/index.py - Link rewriting
api/index.py - Index response
api/index.py - File handler
api/index.py - File redirect
api/index.py - Landing page
api/index.py
PyPI Upstreams
- Index sources
File Downloads
- Mirror race
api/index.py - File mirrors
- Official file host
Other components
- pip client
Connections 13
- pip client → Index handler: requests index
- Index handler → Index sources: fetches index
- Index sources → Index handler: returns content
- Index handler → Link rewriting: rewrites links
- Link rewriting → Index response: returns content
- Index response → pip client: serves index
- pip client → File handler: requests file
- File handler → Mirror race: finds mirror
- Mirror race → File mirrors: checks files
- Mirror race → Official file host: falls back
- Mirror race → File redirect: returns URL
- File redirect → pip client: redirects
- pip client → Landing page: opens home