From 35b3e393dba90c61bc7cf5777e66c144e9f46cef Mon Sep 17 00:00:00 2001 From: Ian Foote Date: Sun, 23 Feb 2014 19:45:17 +0000 Subject: [PATCH 1/2] Pep8 fixes --- svg_wheel.py | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/svg_wheel.py b/svg_wheel.py index ad4b6dc..61dae59 100644 --- a/svg_wheel.py +++ b/svg_wheel.py @@ -24,7 +24,8 @@ TAU = 2*math.pi -def annular_sector_path(center_x, center_y, inner_radius, outer_radius, start, stop): +def annular_sector_path( + center_x, center_y, inner_radius, outer_radius, start, stop): points = { 'inner_radius': inner_radius, 'outer_radius': outer_radius, @@ -41,8 +42,10 @@ def annular_sector_path(center_x, center_y, inner_radius, outer_radius, start, s return PATH_TEMPLATE.format(**points) -def add_annular_sector(wheel, center, inner_radius, outer_radius, start, stop, style_class): - return et.SubElement(wheel, 'path', +def add_annular_sector( + wheel, center, inner_radius, outer_radius, start, stop, style_class): + return et.SubElement( + wheel, 'path', d=annular_sector_path( center_x=center[0], center_y=center[1], inner_radius=inner_radius, outer_radius=outer_radius, @@ -61,39 +64,47 @@ def angles(index, total): def add_fraction(wheel, packages, total): text_attributes = { - 'text-anchor': 'middle', - 'dominant-baseline': 'central', - 'font-size': str(2*OFFSET), - 'font-family': '"Helvetica Neue",Helvetica,Arial,sans-serif', - 'fill': '#333333', - } + 'text-anchor': 'middle', + 'dominant-baseline': 'central', + 'font-size': str(2*OFFSET), + 'font-family': '"Helvetica Neue",Helvetica,Arial,sans-serif', + 'fill': '#333333', + } # Packages with some sort of wheel wheel_packages = sum(package['wheel'] for package in packages) - packages_with_wheels = et.SubElement(wheel, 'text', + packages_with_wheels = et.SubElement( + wheel, 'text', x=str(CENTER), y=str(CENTER - OFFSET), attrib=text_attributes, ) - packages_with_wheels.text='{}'.format(wheel_packages) + packages_with_wheels.text = '{}'.format(wheel_packages) # Dividing line - et.SubElement(wheel, 'line', + et.SubElement( + wheel, 'line', x1=str(CENTER - FRACTION_LINE//2), y1=str(CENTER), x2=str(CENTER + FRACTION_LINE//2), y2=str(CENTER), attrib={'stroke': '#333333', 'stroke-width': '2'}, - ) + ) # Total packages - total_packages = et.SubElement(wheel, 'text', + total_packages = et.SubElement( + wheel, 'text', x=str(CENTER), y=str(CENTER + OFFSET), attrib=text_attributes, ) - total_packages.text='{}'.format(total) + total_packages.text = '{}'.format(total) def generate_svg_wheel(packages, total): - wheel = et.Element('svg', viewBox='0 0 {0} {0}'.format(2*CENTER), version='1.1', xmlns='http://www.w3.org/2000/svg') + wheel = et.Element( + 'svg', + viewBox='0 0 {0} {0}'.format(2*CENTER), + version='1.1', + xmlns='http://www.w3.org/2000/svg', + ) for index, result in enumerate(packages): start, stop = angles(index, total) @@ -112,4 +123,3 @@ def generate_svg_wheel(packages, total): with open('wheel.svg', 'w') as svg: svg.write(HEADERS) svg.write(et.tostring(wheel)) - From a44557f79b93b67240717290b4c9b7c76bb78f89 Mon Sep 17 00:00:00 2001 From: Ian Foote Date: Sun, 23 Feb 2014 20:49:04 +0000 Subject: [PATCH 2/2] Remove distinction between generic and platform wheels Use more neutral colour scheme for packages without wheels --- index.html | 7 +++---- utils.py | 16 +++------------- wheel.css | 12 +++--------- 3 files changed, 9 insertions(+), 26 deletions(-) diff --git a/index.html b/index.html index 1e0a0e1..3beac7e 100644 --- a/index.html +++ b/index.html @@ -50,11 +50,10 @@

What are wheels?

What is this list?

This site shows the top 360 most-downloaded packages on PyPI showing which have been uploaded as wheel archives.

-

My package is red. What can I do?

+

My package is white. What can I do?

If you have a pure python package that is not using 2to3 for Python 3 support, you've got it easy. Make sure Wheel is installed…

 pip install wheel
diff --git a/utils.py b/utils.py index f7806fc..8f89e8f 100644 --- a/utils.py +++ b/utils.py @@ -37,7 +37,6 @@ def annotate_wheels(packages): num_packages = len(packages) for index, package in enumerate(packages): print index + 1, num_packages, package['name'] - generic_wheel = False has_wheel = False url = get_json_url(package['name']) response = SESSION.get(url) @@ -48,25 +47,16 @@ def annotate_wheels(packages): for download in data['urls']: if download['packagetype'] == 'bdist_wheel': has_wheel = True - generic_wheel = download['filename'].endswith('none-any.whl') package['wheel'] = has_wheel - package['generic_wheel'] = generic_wheel # Display logic. I know, I'm sorry. package['value'] = 1 - if generic_wheel: + if has_wheel: package['css_class'] = 'success' - package['color'] = '#47a447' package['icon'] = u'\u2713' # Check mark - package['title'] = 'This package provides a generic wheel that should work everywhere.' - elif has_wheel: - package['css_class'] = 'warning' - package['color'] = '#ed9c28' - package['icon'] = '?' - package['title'] = 'This package only has platform or achitecture-specific builds.' + package['title'] = 'This package provides a wheel.' else: - package['css_class'] = 'danger' - package['color'] = '#d2322d' + package['css_class'] = 'default' package['icon'] = u'\u2717' # Ballot X package['title'] = 'This package has no wheel archives uploaded (yet!).' diff --git a/wheel.css b/wheel.css index 2137336..04661bb 100644 --- a/wheel.css +++ b/wheel.css @@ -4,14 +4,8 @@ fill: #5CB85C; } -.danger { - stroke: #D43F3A; +.default { + stroke: #cccccc; stroke-width: 1; - fill: #D9534F; -} - -.warning { - stroke: #F0AD4E; - stroke-width: 1; - fill: #F0AD4E; + fill: #ffffff; }