Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify colour scheme, remove distinction between generic and platform wheels #32

Merged
merged 2 commits into from
Feb 24, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@ <h2>What are wheels?</h2>
<h2>What is this list?</h2>
<p>This site shows the top 360 most-downloaded packages on <a href="https://pypi.python.org/pypi">PyPI</a> showing which have been uploaded as wheel archives.</p>
<ul>
<li><span class="text-success">Green</span> packages offer generic wheels that should work everywhere,</li>
<li><span class="text-warning">Orange</span> packages have only platform or architecture-specific builds, and</li>
<li><span class="text-danger">Red</span> packages have no wheel archives uploaded (yet!).</li>
<li><span class="text-success">Green</span> packages offer wheels,</li>
<li><span class="text-muted">White</span> packages have no wheel archives uploaded (yet!).</li>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used white instead of grey to continue using the default bootstrap colours.

</ul>
<h2>My package is red. What can I do?</h2>
<h2>My package is white. What can I do?</h2>
<p>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&hellip;</p>
<pre>
pip install wheel</pre>
Expand Down
44 changes: 27 additions & 17 deletions svg_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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)
Expand All @@ -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))

16 changes: 3 additions & 13 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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!).'

Expand Down
12 changes: 3 additions & 9 deletions wheel.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}