def fetch_all_py3_projects(): """ A job to be run periodically (e.g. daily) to update the Python 3 compatible projects from PyPI. """ redis = get_redis() # try to get the old fetch id first old_key_name = redis.get(TROVE_KEY_NAME) # then populate a set of Python 3 projects in Redis new_key_name = uuid.uuid4().hex projects = all_py3_projects(get_overrides()) pipeline = redis.pipeline() for project in projects: pipeline.sadd(new_key_name, str(project)) pipeline.set(TROVE_KEY_NAME, new_key_name) # get rid of the old fetch set if needed if old_key_name is not None: pipeline.delete(old_key_name) # return number of Python 3 projects compatible_count = len(projects) pipeline.set(TROVE_COUNT_KEY, compatible_count) pipeline.execute() return compatible_count
def test_all_py3_projects_explicit_overrides(self): added_port = 'asdfasdfasdfadsffffdasfdfdfdf' projects = pypi.all_py3_projects(set([added_port])) if hasattr(self, 'assertIn'): self.assertIn(added_port, projects) else: self.assertTrue(added_port in projects)
def test_all_py3_projects(self): projects = pypi.all_py3_projects() if hasattr(self, 'assertGreater'): self.assertGreater(len(projects), 3000) else: self.assertTrue(len(projects) > 3000) self.assertTrue(all(project == project.lower() for project in projects)) self.assertTrue(frozenset(pypi.overrides().keys()).issubset(projects))
def check(projects): """Check the specified projects for Python 3 compatibility.""" log = logging.getLogger('ciu') log.info('{0} top-level projects to check'.format(len(projects))) print('Finding and checking dependencies ...') blockers = dependencies.blocking_dependencies(projects, pypi.all_py3_projects()) print('') for line in message(blockers): print(line) print('') for line in pprint_blockers(blockers): print(' ', line)
def check(projects): """Check the specified projects for Python 3 compatibility.""" # Without this, the 'ciu' logger will emit nothing. logging.basicConfig(format='[%(levelname)s] %(message)s') log = logging.getLogger('ciu') log.info('{0} top-level projects to check'.format(len(projects))) print('Finding and checking dependencies ...') blockers = dependencies.blocking_dependencies(projects, pypi.all_py3_projects()) print('') for line in message(blockers): print(line) print('') for line in pprint_blockers(blockers): print(' ', line)
def check(requirements_paths=[], metadata=[], projects=[]): """Return True if all of the specified dependencies have been ported to Python 3. The requirements_paths argument takes a sequence of file paths to requirements files. The 'metadata' argument takes a sequence of strings representing metadata. The 'projects' argument takes a sequence of project names. Any project that is not listed on PyPI will be considered ported. """ dependencies = main.projects_from_requirements(requirements_paths) dependencies.extend(main.projects_from_metadata(metadata)) dependencies.extend(projects) dependencies = set(name.lower() for name in dependencies) py3_projects = pypi.all_py3_projects() all_projects = pypi.all_projects() for dependency in dependencies: if dependency in all_projects and dependency not in py3_projects: return False return True
data=payload, headers={'Content-Type': 'text/xml'}, ) if response.status_code == 200: result = xmlrpclib.loads(response.content)[0][0] return result else: # Some error occurred pass def get_json_url(package_name): return BASE_URL + '/' + package_name + '/json' py3_packages = all_py3_projects() def annotate_wheels(packages): print('Getting package data...') num_packages = len(packages) for index, package in enumerate(packages): print index + 1, num_packages, package['name'] package['value'] = 1 if package['name'].lower() in py3_packages: package['py3support'] = True package['css_class'] = 'success' package['icon'] = u'\u2713' # Check mark package['title'] = 'This package supports Python 3 :)' else:
BASE_URL, data=payload, headers={'Content-Type': 'text/xml'}, ) if response.status_code == 200: result = xmlrpclib.loads(response.content)[0][0] return result else: # Some error occurred pass def get_json_url(package_name): return BASE_URL + '/' + package_name + '/json' py3_packages = all_py3_projects() def annotate_wheels(packages): print('Getting package data...') num_packages = len(packages) for index, package in enumerate(packages): print index + 1, num_packages, package['name'] package['value'] = 1 if package['name'].lower() in py3_packages: package['py3support'] = True package['css_class'] = 'success' package['icon'] = u'\u2713' # Check mark package['title'] = 'This package supports Python 3 :)' else: package['py3support'] = False
def test_all_py3_projects_explicit_overrides(self): added_port = 'asdfasdfasdfadsffffdasfdfdfdf' projects = pypi.all_py3_projects(set([added_port])) self.assertIn(added_port, projects)