Skip to content

Instantly share code, notes, and snippets.

@sesh
Last active January 25, 2017 01:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sesh/9e7cd1b7164a40a656c52fb5809b5d79 to your computer and use it in GitHub Desktop.
Save sesh/9e7cd1b7164a40a656c52fb5809b5d79 to your computer and use it in GitHub Desktop.

TIL from reading an early Jan post on the Django mailing list. Turns out that PyPI is making a whole bunch of data available on Google BigQuery.

In a subsequent post, Alex Gaynor gave us a query that extracts Python versions used to download a package on PyPI in the previous two weeks:

SELECT
  REGEXP_EXTRACT(details.python, r"^([^\.]+\.[^\.]+\.[^\.]+)") as python_version,
  COUNT(*) as download_count,
FROM
  TABLE_DATE_RANGE(
    [the-psf:pypi.downloads],
    DATE_ADD(CURRENT_TIMESTAMP(), -2, "week"),
    CURRENT_TIMESTAMP()
  )
WHERE
  LOWER(file.project) = 'django'
GROUP BY
  python_version,
ORDER BY
  download_count DESC
LIMIT 100

Alex's post contains a table for download of Django (Python 3.5.2 is the most popular, quite a relief there!)

Here's the top 10 for piprot (not as popular as I'd hoped):

Row python_version download_count
1 null 826
2 3.4.5 572
3 2.7.9 220
4 3.5.2 179
5 2.7.6 170
6 2.7.13 163
7 2.7.12 87
8 3.5.1 57
9 3.3.6 34
10 3.4.4 34

Alex's post: https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/django-developers/Qab-hRG-SKs/0u1J-fNQFAAJ Original PyPI announcement from May 2016: https://mail.python.org/pipermail/distutils-sig/2016-May/028986.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment