PyPI Stats

Search

All packages
Top packages

Track packages

PyPI Stats API


PyPI Stats provides a simple JSON API for retrieving aggregate download stats and time series for packages. The following are the valid endpoints using host: https://pypistats.org/

NOTES

Etiquette

If you plan on using the API to download historical data for every python package in the database (e.g. for some personal data exploration), DON'T. This website runs on limited resources and you will degrade the site performance by doing this. It will also take a very long time.

You are much better off extracting the data directly from the Google BigQuery pypi downloads tables. You can query up to 1TB of data FREE every month before having to pay. The volume of data queried for this website falls well under that limit (each month of data is less than 100 GB queried) and you will have your data in a relatively short amount of time. Here is a quick guide.

If you want to regularly fetch download counts for a particular package or set of packages, cache your results. The data provided here is updated once daily, so you should not need to fetch results from the same API endpoint more than once per day.

Rate Limiting

IP-based rate limiting is imposed application-wide.

API Client

The pypistats package is a python client and CLI tool for easily accessing, aggregating, and formatting results from the API. To install, use pip:

pip install -U pypistats
Refer to the documentation for usage.

Endpoints

/api/packages/<package>/recent

Retrieve the aggregate download quantities for the last day/week/month.

Query arguments:

Example response:
{
  "data": {
    "last_day": 1,
    "last_month": 2,
    "last_week": 3
  },
  "package": "package_name",
  "type": "recent_downloads"
}

/api/packages/<package>/overall

Retrieve the aggregate daily download time series with or without mirror downloads.

Query arguments:

Example response:
{
  "data": [
    {
      "category": "with_mirrors",
      "date": "2018-02-08",
      "downloads": 1
    },
    {
      "category": "without_mirrors",
      "date": "2018-02-08",
      "downloads": 1
    }
  ],
  "package": "package_name",
  "type": "overall_downloads"
}

/api/packages/<package>/python_major

Retrieve the aggregate daily download time series by Python major version number.

Query arguments:

Example response:
{
  "data": [
    {
      "category": "2",
      "date": "2018-02-08",
      "downloads": 1
    },
    {
      "category": "3",
      "date": "2018-02-08",
      "downloads": 1
    },
    {
      "category": "null",
      "date": "2018-02-08",
      "downloads": 1
    }
  ],
  "package": "package_name",
  "type": "python_major_downloads"
}

/api/packages/<package>/python_minor

Retrieve the aggregate daily download time series by Python minor version number.

Query arguments:

Example response:
{
  "data": [
    {
      "category": "2.6",
      "date": "2018-02-08",
      "downloads": 1
    },
    {
      "category": "2.7",
      "date": "2018-02-08",
      "downloads": 1
    },
    {
      "category": "3.2",
      "date": "2018-02-08",
      "downloads": 1
    },
    {
      "category": "3.3",
      "date": "2018-02-08",
      "downloads": 1
    },
    {
      "category": "3.4",
      "date": "2018-02-08",
      "downloads": 1
    },
    {
      "category": "3.5",
      "date": "2018-02-08",
      "downloads": 1
    },
    {
      "category": "3.6",
      "date": "2018-02-08",
      "downloads": 1
    },
    {
      "category": "3.7",
      "date": "2018-02-08",
      "downloads": 1
    },
    {
      "category": "null",
      "date": "2018-02-08",
      "downloads": 1
    }
  ],
  "package": "package_name",
  "type": "python_minor_downloads"
}

/api/packages/<package>/system

Retrieve the aggregate daily download time series by operating system.

Query arguments:

Example response:
{
  "data": [
    {
      "category": "darwin",
      "date": "2018-02-08",
      "downloads": 1
    },
    {
      "category": "linux",
      "date": "2018-02-08",
      "downloads": 1
    },
    {
      "category": "null",
      "date": "2018-02-08",
      "downloads": 1
    },
    {
      "category": "other",
      "date": "2018-02-08",
      "downloads": 1
    },
    {
      "category": "windows",
      "date": "2018-02-08",
      "downloads": 1
    }
  ],
  "package": "package_name",
  "type": "system_downloads"
}