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

Display the packages with wheels compatible with the newest Python #163

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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: 6 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,17 @@ <h3 id="advantages">Advantages of wheels</h3>
<h2 id="about-list">What is this list?</h2>
<p>This site shows the top 360 most-downloaded packages on <a href="https://pypi.org/">PyPI</a> showing which have been uploaded as wheel archives.</p>
<ul>
<li><span class="text-success">Green</span> packages offer wheels,</li>
<li><span class="text-success">Green</span> packages offer wheels compatible with the newest Python version (updated shortly before its final release),</li>
Copy link

Choose a reason for hiding this comment

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

Suggestion: Let's mention the actual version from NEWEST_PYTHON_VER somewhere, please

Copy link
Author

Choose a reason for hiding this comment

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

It's displayed when you hover over the green packages on the list. However I agree, it could be made more visible.

Copy link
Author

Choose a reason for hiding this comment

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

I amended this on the line 77 of the diff

<li><span class="text-warning">Orange</span> packages offer older wheels,</li>
<li><span class="text-muted">White</span> packages have no wheel archives uploaded (yet!).</li>
</ul>
<p>Currently, Python 3.13 is considered the newest Python version.</p>
Copy link

Choose a reason for hiding this comment

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

Thanks. Is it possible to use the NEWEST_PYTHON_VER value here? Otherwise I am afraid the version might get out of sync later.

Copy link
Author

Choose a reason for hiding this comment

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

AFAIK, we'd have to generate index.html from a template rather than use the file verbatim as it is now. So I guess that would require pulling jinja2 and adding the generating machinery? Maybe there is an easier way?

<p>Packages that are known to be deprecated are not included. (For example distribute). If your package is incorrectly listed, please <a href="https://github.com/meshy/pythonwheels/issues/">create a ticket</a>.</p>
<p>This used to show the all-time most-downloaded packages. The all-time list is no longer available, and the packages in <a href="https://hugovk.github.io/top-pypi-packages/">the last-30-days list</a> will change to reflect more closely what the Python community is using.
<p>This is not the official website for wheels, just a nice visual way to measure adoption. To see the authoritative guide on wheels and other aspects of Python packaging, see the <a href="https://packaging.python.org">Python Packaging User Guide</a>.</p>
<h2 id="creating-new-version-wheels">My package is orange. What can I do?</h2>
<p>If you have a package that doesn't publish the wheels for the newest Python yet, consider releasing them on PyPI. This will make it possible for Python users to start developing with a new Python version from the day of its release.</p>
<p>Alternatively, you can consider porting your project to the <a href="https://docs.python.org/3/c-api/stable.html#stable-application-binary-interface">stable ABI</a>.</p>
<h2 id="creating-wheels">My package is white. What can I do?</h2>
<h3 id="pure-wheel">Pure Python</h3>
<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>
Expand Down
19 changes: 18 additions & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@

SESSION = requests.Session()

# Updated ~ when the release candidates start to appear
# Goal: to have as many as possible wheels ready to use from the day it's released
NEWEST_PYTHON_VER = "3.13"
NEWEST_PYTHON_ABI_TAG = "cp313"


def get_json_url(package_name):
return BASE_URL + "/" + package_name + "/json"
Expand All @@ -31,6 +36,7 @@ def annotate_wheels(packages):
for index, package in enumerate(packages):
print(index + 1, num_packages, package["name"])
has_wheel = False
has_newest_wheel = False
url = get_json_url(package["name"])
response = SESSION.get(url)
if response.status_code != 200:
Expand All @@ -40,13 +46,24 @@ def annotate_wheels(packages):
for download in data["urls"]:
if download["packagetype"] == "bdist_wheel":
has_wheel = True
abi_tag = download["filename"].split("-")[-2]
# wheel can be universal or compiled for the specific Python version
# there can be additional letters at the end of the abi tag
# e.g. "cp313t" built for free-threading
if abi_tag in ["none", "abi3"] or abi_tag.startswith(NEWEST_PYTHON_ABI_TAG):
has_newest_wheel = True
package["wheel"] = has_wheel
package["newest_wheel"] = has_newest_wheel

# Display logic. I know, I'm sorry.
package["value"] = 1
if has_wheel:
if has_newest_wheel:
package["css_class"] = "success"
package["icon"] = "\u2713" # Check mark
package["title"] = f"This package provides a wheel compatible with Python {NEWEST_PYTHON_VER}."
elif has_wheel:
package["css_class"] = "warning"
package["icon"] = "\u23FA" # Circle
package["title"] = "This package provides a wheel."
else:
package["css_class"] = "default"
Expand Down
6 changes: 6 additions & 0 deletions wheel.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
fill: #5CB85C;
}

.warning {
stroke: #d58512;
stroke-width: 1;
fill: #ed9c28;
}

.default {
stroke: #cccccc;
stroke-width: 1;
Expand Down