Last active
January 15, 2016 13:18
-
-
Save kristaps/86406a1970eaab11d11f to your computer and use it in GitHub Desktop.
Show python package PYPI upload times. Helpful when, for example, your tests start failing and you'd like to investigate what recent package updates might have caused the breakage.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
import json | |
from pip.operations.freeze import freeze | |
import urllib | |
URL_TEMPLATE = "https://pypi.python.org/pypi/{pkg}/{version}/json" | |
for pkg_spec in freeze(): | |
pkg, version = pkg_spec.split('==') | |
upload_time = None | |
response = urllib.urlopen(URL_TEMPLATE.format(pkg=pkg, version=version)) | |
if response.getcode() == 200: | |
data = json.loads(response.read()) | |
for url in data['urls']: | |
if url['python_version'] == 'source': | |
upload_time = url['upload_time'] | |
break | |
print("{:25} {:10} {}".format(pkg, version, upload_time)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment