PyPI Package Stats

CLI and library for PyPI download stats and metadata via the pypistats API, with disk caching.

PyPI download totals, metadata, and breakdowns from one integration

When it’s useful

Maintainers and internal tooling authors want adoption signals from PyPI without hand-rolling HTTP clients against pypistats, re-parsing the same JSON in every script, or hammering an API that applies per-IP rate limits.

What you can do

  • Fetch package metadata together with last day, week, month, and 180-day download counts, using the pypistats API as documented upstream.
  • Read Python version and operating system mix as top-five / top-four breakdowns over the last 30 days (the shape the API returns).
  • Use the project as a typed Python library, or install the cli extra for Rich tables or JSON in the terminal.
  • Rely on on-disk caching with a configurable TTL (default one hour), plus helpers to clear the cache or inspect its size and location.

Limits and fit

Version and OS slices are 30-day views; numbers are typically about a day or two behind live traffic, and everything depends on pypistats staying available. Rate limits are enforced by that service (its docs describe on the order of a few requests per second and a few dozen per minute); caching is meant to cut repeat calls. Python 3.8+. Reference material is in the GitHub repository and at ysskrishna.github.io/pypi-package-stats.

Frequently asked questions

What download windows and breakdowns can it fetch?

Via the pypistats API it returns package metadata with last day, week, month, and 180-day download counts, plus top-five Python version and top-four operating system mix over the last 30 days.

Can I use it as a library or only as a CLI?

Both. Install pip install pypi-package-stats for the typed library, or pip install pypi-package-stats[cli] for Rich tables or JSON in the terminal. Metadata fields include name, version, description, author, license, home page, and PyPI URL.

How does caching work?

Results use on-disk caching with a configurable TTL (default one hour), plus helpers to clear the cache or inspect its size and location. Caching is meant to cut repeat calls against pypistats rate limits.

How fresh are the numbers?

Version and OS slices are 30-day views. Numbers are typically about a day or two behind live traffic and depend on pypistats availability. Requires Python 3.8+.

Continue exploring