Registry / data / pypistats

pypistats

JSON →
library1.13.0pypypi✓ verified 86d ago

Python interface to the PyPI Stats API (https://pypistats.org/api). Provides programmatic and CLI access to download statistics for Python packages. Current version 1.13.0, requires Python >=3.10. Releases approximately every few months.

pip install pypistats
INSTALL
IMPORT
SIG · PYPISTATS
P
pypistats
datapythonv1.13.0
Install
4.6s avg
Import
59ms
Disk
52MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.13.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.062s · 50.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.6s · import 0.056s · 51MB
52MB installed
● package 52MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pypistats
import pypistats
The main module is importable directly as a package.
recent
from pypistats import recent
import pypistats.recent
recent is a module inside the package; import it as shown.

Fetches recent download stats for a package in JSON format.

import pypistats # Get recent downloads for a package data = pypistats.recent('requests', format='json') print(data[:200]) # first 200 characters # CLI equivalent: pypistats recent requests
pypistats --version
Debug
Known issues
breakingDropped support for Python 3.9 in version 1.12.0.
fix
Upgrade to Python 3.10+ or pin pypistats<1.12.0.
affects: <1.12.0
breakingHTTP client changed from httpx to urllib3 in 1.12.0. Code relying on httpx internals will break.
fix
Use only the public API; do not depend on httpx-related behavior.
affects: >=1.12.0
deprecatedThe 'format=None' option returns raw Python data structure (added in 1.8.0); not formally deprecated but may change.
fix
Specify format='json' or other explicit format.
affects: >=1.8.0
gotchaPackage name validation: CLI accepts directory containing pyproject.toml/setup.cfg to infer package name (since 1.11.0), but the library API expects a string.
fix
Ensure you pass a string package name to the Python functions.
affects: >=1.11.0
gotchaThe CLI table format changed from MARKDOWN/SINGLE_BORDER to TableStyle in 1.8.0 to fix DeprecationWarnings.
fix
If parsing output, update your regex or use format='json'.
affects: >=1.8.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pypistats.recent'
Attempting to import submodule as if it's a nested package; `recent` is a module inside `pypistats` but should be imported with `from pypistats import recent`.
fix
Use `from pypistats import recent` or `import pypistats; pypistats.recent(...)`.
AttributeError: module 'pypistats' has no attribute 'recent'
Importing the package but forgetting to import the submodule.
fix
Explicitly `import pypistats.recent` (though `from pypistats import recent` is cleaner).
ValueError: Unsupported format: json
Passing invalid format string; valid values are 'json', 'csv', 'markdown', or None.
fix
Use one of the accepted formats: format='json' (or 'csv', 'markdown', None).
Upgrade
Version history
1.13.0latest on PyPI · released Jan 26, 2026
Audit
Dependencies
urllib3requiredHTTP client (replaced httpx in 1.12.0)
richoptionalCLI output formatting
Agent activity
15 hits · last 30 days
node
14
Resources
pypistats — pip install pypistats · libregistry