Setup PyPI Proxy with DevGuard Dependency Proxy
Setup
- Registry URL:
http://localhost:8080/api/v1/dependency-proxy/pypi/simple - Configuration: Set via
pip.confor environment variables
Using a configuration file
Create or edit pip.conf:
[global]
index-url = http://localhost:8080/api/v1/dependency-proxy/pypi/simple
trusted-host = localhostUsing enviromental variables
export PIP_INDEX_URL="http://localhost:8080/api/v1/dependency-proxy/pypi/simple"
export PIP_TRUSTED_HOST="localhost"
pip install requestsTesting
DevGuard includes test packages for verifying the proxy functionality:
fake-malicious-pypi-package
These test packages are safe to use and will always be blocked by the proxy.
API Reference
Proxy Endpoints
GET /api/v1/dependency-proxy/pypi/*- PyPI proxy
Response Headers
X-Cache: HIT|MISS- Indicates if the response was served from cacheX-Proxy-Type: pypi- Identifies the proxy typeX-Malicious-Package: blocked- Present when a package is blocked
Status Codes
200 OK- Package successfully proxied403 Forbidden- Malicious package blocked503 Service Unavailable- Database not yet loaded502 Bad Gateway- Upstream registry error