Last active
August 29, 2015 14:19
-
-
Save vsajip/03e9fc99bceec3e5b1cf to your computer and use it in GitHub Desktop.
Script to find blockers to Python 3 adoption across all of PyPI
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
from collections import Counter | |
import logging | |
from pprint import pprint | |
import sys | |
import caniusepython3 | |
from caniusepython3.dependencies import blocking_dependencies | |
logger = logging.getLogger(__name__) | |
def logging_excepthook(t, v, tb): | |
""" | |
Ensure that uncaught exceptions are logged. | |
""" | |
logger.error('uncaught exception: %s', v, exc_info=(t, v, tb)) | |
sys.excepthook = logging_excepthook | |
logging.basicConfig(level=logging.DEBUG, filename='cu3test.log', filemode='w', | |
format='%(levelname)-8s %(name)-20s %(message)s') | |
all_py_projects = sorted(caniusepython3.pypi.all_projects()) | |
print('got all projects (%d)' % len(all_py_projects)) | |
py3_projects = caniusepython3.pypi.all_py3_projects() | |
print('got all Py3 projects (%d)' % len(py3_projects)) | |
# Zap the locator cache if memory is low | |
# from distlib.locators import default_locator | |
# default_locator._cache = None | |
all_blockers = blocking_dependencies(all_py_projects, py3_projects) | |
print('got all blockers') | |
blocker_list = [] | |
for blockers_subset in all_blockers: | |
print(blockers_subset) | |
for blocker in blockers_subset: | |
print(blocker) | |
blocker_list.append(blocker) | |
blockers_counter = Counter(blocker_list) | |
pprint(blockers_counter.most_common()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment