Zoran Pandovski
By Zoran Pandovski

Python package download stats from PyPI

Python package download stats from PyPI

The download stats were removed from PyPi modules. There were few reasons for that as explained in the mailing list. So, now the best available option to get the statistics is to use the Google BigQuery database. To use it you only need a Google account and enabled BigQuery API.

The most useful query is to count the package downloads:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
SELECT

  COUNT(*) AS num_downloads,

  SUBSTR(_TABLE_SUFFIX, 1, 6) AS `month`

FROM `the-psf.pypi.downloads*`

WHERE

  file.project = 'YOUR_PACKAGE_NAME'

  AND

  details.installer.name = 'pip'

  AND _TABLE_SUFFIX

    BETWEEN FORMAT_DATE(

      '%Y%m01', DATE_SUB(CURRENT_DATE(), INTERVAL 10 MONTH))

    AND FORMAT_DATE('%Y%m%d', CURRENT_DATE())

GROUP BY `month`

ORDER BY `month` DESC

The above query uses the the-psf.pypi.downloads table that contains information about downloads. It selects the package and filters the data to contain only pip installs(no mirrors downloads) in the last 10 months.

Other useful columns from the the-psf.pypi.downloads are:

Column Info Example

|—|—|—|

file.project The package name requests
file.version Version of the package 1.2.1
details.installer.name Installer name pip, bandersnatch
details.python Python version 2.7, 3.6, 3.7.3