Skip to content

Instantly share code, notes, and snippets.

@dstufft
Created April 14, 2014 09:32
Show Gist options
  • Select an option

  • Save dstufft/10632092 to your computer and use it in GitHub Desktop.

Select an option

Save dstufft/10632092 to your computer and use it in GitHub Desktop.

Everything is pip 1.4+ all downloads starting 2014-01-02 and ending with 2014-04-13.

SELECT python_type, array_to_string(python_release[0:2], '.') AS python_release, COUNT(*)
FROM (
    SELECT
        python_type,
        string_to_array(
            (
                CASE WHEN (python_release IS NULL OR python_release = '')
                THEN python_version ELSE python_release END
            ),
            '.'
        ) AS python_release
    FROM downloads
    WHERE installer_type = 'pip' AND installer_version != '' AND package_name = 'Jinja2'
) AS d
GROUP BY python_type, array_to_string(python_release[0:2], '.')
ORDER BY COUNT(*) DESC;

 python_type | python_release | count
-------------+----------------+--------
 cpython     | 2.7            | 729939
 cpython     | 2.6            | 120757
 cpython     | 3.3            |  52737
 cpython     | 3.4            |   5730
 pypy        | 2.2            |   5690
 cpython     | 3.2            |   3659
 pypy        | 2.0            |    218
 pypy        | 2.1            |    116
 pypy        | 1.8            |     55
 pypy        | 1.9            |     37
 pypy        | 2.3            |     30
 cpython     | 3.5            |      5
 cpython     | 3.1            |      3
(13 rows)
SELECT python_type, array_to_string(python_release[0:2], '.') AS python_release, COUNT(*)
FROM (
    SELECT
        python_type,
        string_to_array(
            (
                CASE WHEN (python_release IS NULL OR python_release = '')
                THEN python_version ELSE python_release END
            ),
            '.'
        ) AS python_release
    FROM downloads
    WHERE installer_type = 'pip' AND installer_version != '' AND package_name = 'Werkzeug'
) AS d
GROUP BY python_type, array_to_string(python_release[0:2], '.')
ORDER BY COUNT(*) DESC;

 python_type | python_release | count
-------------+----------------+--------
 cpython     | 2.7            | 397860
 cpython     | 2.6            |  54362
 cpython     | 3.3            |  22790
 pypy        | 2.2            |   3843
 cpython     | 3.4            |   3624
 cpython     | 3.2            |   1084
 pypy        | 2.0            |    136
 pypy        | 2.1            |     29
 pypy        | 1.9            |     27
 pypy        | 1.8            |     16
 pypy        | 2.3            |     13
 cpython     | 3.1            |      1
(12 rows)
SELECT python_type, array_to_string(python_release[0:2], '.') AS python_release, COUNT(*)
FROM (
    SELECT
        python_type,
        string_to_array(
            (
                CASE WHEN (python_release IS NULL OR python_release = '')
                THEN python_version ELSE python_release END
            ),
            '.'
        ) AS python_release
    FROM downloads
    WHERE installer_type = 'pip' AND installer_version != '' AND package_name = 'MarkupSafe'
) AS d
GROUP BY python_type, array_to_string(python_release[0:2], '.')
ORDER BY COUNT(*) DESC;

 python_type | python_release | count
-------------+----------------+--------
 cpython     | 2.7            | 744464
 cpython     | 2.6            | 129429
 cpython     | 3.3            |  57639
 pypy        | 2.2            |   6107
 cpython     | 3.4            |   6094
 cpython     | 3.2            |   2504
 pypy        | 2.0            |    270
 pypy        | 2.1            |     79
 pypy        | 1.8            |     53
 pypy        | 1.9            |     52
 pypy        | 2.3            |     27
 cpython     | 3.5            |      7
 jython      | 2.7            |      3
 cpython     | 3.1            |      2
(14 rows)
SELECT python_type, array_to_string(python_release[0:2], '.') AS python_release, COUNT(*)
FROM (
    SELECT
        python_type,
        string_to_array(
            (
                CASE WHEN (python_release IS NULL OR python_release = '')
                THEN python_version ELSE python_release END
            ),
            '.'
        ) AS python_release
    FROM downloads
    WHERE installer_type = 'pip' AND installer_version != '' AND package_name = 'Sphinx'
) AS d
GROUP BY python_type, array_to_string(python_release[0:2], '.')
ORDER BY COUNT(*) DESC;

 python_type | python_release | count
-------------+----------------+--------
 cpython     | 2.7            | 313255
 cpython     | 2.6            |  58954
 cpython     | 3.3            |  26621
 pypy        | 2.2            |   2256
 cpython     | 3.2            |   1773
 cpython     | 3.4            |   1247
 pypy        | 2.0            |     47
 pypy        | 1.8            |     34
 pypy        | 1.9            |     10
 pypy        | 2.1            |     10
 cpython     | 3.5            |      4
 pypy        | 2.3            |      4
(12 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment