← All tools

hugovk/pypistats

Popularity 75 Updated Development & Build

Command-line interface to PyPI Stats API to get download stats for Python packages

githubauto-collected

Installation

A directly usable install command is not verified yet. Check the project documentation or releases.

pypistats

Python interface to PyPI Stats API to get aggregate download statistics on Python packages on the Python Package Index without having to execute queries directly against Google BigQuery.

Data is available for the last 180 days. (For longer time periods, pypinfo can help, you'll need an API key and get free quota.)

Installation

From PyPI

python3 -m pip install --upgrade pypistats

From source

git clone https://github.com/hugovk/pypistats
cd pypistats
python3 -m pip install .

Example command-line use

Run pypistats with a subcommand (corresponding to PyPI Stats endpoints), then options for that subcommand.

Top-level help:

from scripts.runcommand import run run("pypistats --help") ]]] --

$ pypistats --help
usage: pypistats [-h] [-V] {recent,overall,python_major,python_minor,system} ...

positional arguments:
  {recent,overall,python_major,python_minor,system}

options:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit

Help for a subcommand:

$ pypistats recent --help
usage: pypistats recent [-h] [-p {day,week,month}]
                        [-f {html,json,pretty,md,markdown,rst,tsv}] [-j] [-v]
                        [package]

Retrieve the aggregate download quantities for the last 1/7/30 days, excluding
downloads from mirrors

positional arguments:
  package               package name, or dir to check pyproject.toml/setup.cfg
                        (default: .)

-h, --help show this help message and exit -p, --period {day,week,month} -f, --format {html,json,pretty,md,markdown,rst,tsv} The format of output (default: pretty) -j, --json Shortcut for "-f json" (default: False) -v, --verbose Print debug messages to stderr (default: False)


<!-- [[[end]]] -->

Get recent downloads:

<!-- [[[cog run("pypistats recent pillow") ]]] -->

$ pypistats recent pillow ┌───────────┬─────────────┬────────────┐ │ lastday │ lastmonth │ lastweek │ ├───────────┼─────────────┼────────────┤ │ 5,537,706 │ 225,816,599 │ 58,094,476 │ └───────────┴─────────────┴────────────┘