Ejemplo n.º 1
0
def generate(num_package, cache, overrides):
    """Generate top package list that are Python 2 only

    :param num_package: maximum number of packages to list
    """

    top_packages = utils.get_top_packages()
    py2_packages_with_info = utils.get_py2_packages(top_packages, cache,
                                                    overrides)
    github_packages = utils.get_github_packages(py2_packages_with_info)

    top_py2_packages = []
    print_progress(0, num_package)
    for i, package in enumerate(github_packages):
        if i < num_package:
            top_py2_packages.append(package)

            # print progress
            print_progress(i + 1, num_package, package['name'])

        else:
            break
    print()

    # sort by GitHub star instead of PyPI counts
    top_py2_packages.sort(key=lambda p: (-p['stars'], -p['downloads']))
    for package in top_py2_packages:
        print(package['stars'], package['name'], package['url'])

    return top_py2_packages
Ejemplo n.º 2
0
def main():
    packages = remove_irrelevant_packages(get_top_packages(), TO_CHART)
    annotate_wheels(packages)
    wheel_types = ['manylinux1_py3', 'manylinux1_py2',
                   'win32_py3', 'win32_py2',
                   'win_amd64_py3', 'win_amd64_py2',
                   'macos_py2', 'macos_py2']
    packages = [p for p in packages if p['is_c_module'] or any([p[t] for t in wheel_types])]
    save_to_file(packages, 'results.json')
    generate_svg_wheel(packages, len(packages))
Ejemplo n.º 3
0
 def test_get_top_packages(self):
     """Tests getting top N packages."""
     N = 3
     package_file_count = Counter({
         'package1': 1,
         'package2': 3,
         'package3': 4,
         'package4': 2
     })
     result = utils.get_top_packages(3, package_file_count)
     self.assertEqual(result, [('package3', 4), ('package2', 3),
                               ('package4', 2)])
Ejemplo n.º 4
0
def main():
    # Prepare args
    parser = utils.create_arg_parser()
    args = parser.parse_args()

    ok = '{}OK{}'.format(colors.GREEN, colors.ENDC)

    # Create mirror, base_dir and contents_filename.
    print('Initial setup ... ', end='')
    mirror = utils.create_ftp_mirror(args.country)
    base_dir = utils.create_base_dir(args.dist, args.comp)
    contents_filename = utils.create_contents_filename(args.architecture)
    print(ok)

    # Establish ftp connection.
    print('Establishing FTP connection ... ', end='')
    ftp = utils.create_ftp_connection(mirror, base_dir)
    print(ok)

    # Download Contents-xxx.gz file.
    print('Downloading {}{}{} ... '.format(colors.WARNING, contents_filename,
                                           colors.ENDC),
          end='')
    utils.download_contents(ftp, contents_filename)
    print(ok)

    # Destroy ftp connection as we no longer need it.
    print('Closing FTP connection ... ', end='')
    utils.destroy_ftp_connection(ftp)
    print(ok)

    # Create a Counter object to store statistics.
    package_entries = Counter()

    # Begin parsing.
    print('Parsing ... ', end='')
    with utils.gunzip_file(contents_filename) as contents_file:
        for line in contents_file.readlines():
            utils.parse_line_and_update_entries(line, package_entries)
    print(ok)

    # Get Top N packages by number of associated files.
    print('Analyzing data ... ', end='')
    top_packages = utils.get_top_packages(args.top, package_entries)
    print(ok)

    # Print stats.
    utils.print_stats(top_packages)
Ejemplo n.º 5
0
def main():
    packages = remove_irrelevant_packages(get_top_packages(), TO_CHART)
    annotate_wheels(packages)
    save_to_file(packages, 'results.json')
    generate_svg_wheel(packages, TO_CHART)
Ejemplo n.º 6
0
def main(to_chart=360, versions=["2.6"]):
    packages = remove_irrelevant_packages(get_top_packages(), to_chart)
    annotate_support(packages, versions)
    save_to_file(packages, "results.json")
    generate_svg_wheel(packages, to_chart, versions)
Ejemplo n.º 7
0
def main():
    packages = remove_irrelevant_packages(get_top_packages(), TO_CHART)
    annotate_wheels(packages)
    save_to_file(packages, 'results.json')
Ejemplo n.º 8
0
def main():
    packages = remove_irrelevant_packages(get_top_packages(), int(TO_CHART * 1.05))
    packages = annotate_pep8(packages)
    packages = remove_irrelevant_packages(packages, TO_CHART)
    save_to_file(packages, 'results.json')
    generate_svg_wheel(packages, len(packages))