PyPIStats.dev is an open-source, SvelteKit-based replacement for PyPI Stats. It provides fast, on-demand Python package download analytics sourced from BigQuery, backed by PostgreSQL and Redis. The platform exposes a clean web UI and a standards-friendly JSON API suitable for programmatic use.
Key features:
This repository is designed to deploy with docker compose
as the primary (and only) method. The stack includes the web app, Postgres, and Redis.
.env
file at repo root (or in your platform’s UI — Coolify supports adding envs/secrets directly):DATABASE_URL=postgresql://pypistats:pypistats@db:5432/pypistats?schema=public
REDIS_URL=redis://redis:6379
# BigQuery
GOOGLE_PROJECT_ID=your-project
# Prefer JSON for container environments
GOOGLE_APPLICATION_CREDENTIALS_JSON={"type":"service_account","project_id":"...","private_key_id":"...","private_key":"-----BEGIN PRIVATE KEY-----\\n...\\n-----END PRIVATE KEY-----\\n","client_email":"...","client_id":"...","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_x509_cert_url":"..."}
docker compose up --build
The app will be available at http://localhost:3000
All endpoints return JSON. Examples (for package numpy
):
/api/packages/numpy/recent?period=month
/api/packages/numpy/overall?mirrors=false
/api/packages/numpy/python_major?version=3
/api/packages/numpy/python_minor?version=3.11
/api/packages/numpy/system?os=Linux
/api/packages/numpy/installer
Each API request triggers on-demand ingestion if the package is missing or stale (up to yesterday), then serves from the database and cache.
docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build
# App at http://localhost:5173
docker compose -f docker-compose.yml -f docker-compose.dev.yml exec web pnpm prisma migrate dev
Issues and PRs are welcome. Please ensure:
.env
/env_file
MIT