Only show pre-releases when a release exists#2998
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the “Active Python releases” rendering logic so that pre-release series (including versions currently marked as planned, feature, or prerelease by the PEPs release-cycle API) are only shown once there is at least one published Release record in the local database—ensuring the “Download” link can resolve to an actual /downloads/latest/pythonX.Y/ target. This addresses the missing Python 3.15 row reported in #2997 after the upstream API status changes.
Changes:
- Update
render_active_releases()to treatplanned/feature/prereleasestatuses as “pre-release”, but only display them when a published DBReleaseexists for that minor version. - Adjust and expand tests to cover the “show once a pre-release ships” behavior and the updated API status mapping assumptions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/downloads/templatetags/download_tags.py | Updates active-releases filtering to show pre-release series only when a matching published DB release exists. |
| apps/downloads/tests/test_template_tags.py | Updates mock API statuses and adds DB-backed tests to validate the new visibility rules. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Get last release for EOL versions | ||
| minor = int(release.split(".")[1]) | ||
| last_release = Release.objects.latest_python3(minor) | ||
| if last_release: |
There was a problem hiding this comment.
If the most-recent EOL entry in release_cycle is ever a Python 2.x version (e.g. 2.7)...
There'll never be a 2.8: https://peps.python.org/pep-0404/
Even less likely 15 years later.
Description
3.15 b1 has just been released. That means 3.16 now exists on the
mainbranch but won't have any releases until it hits alpha in October.python/peps#4962 changed the statuses in the API: https://peps.python.org/api/release-cycle.json
But https://www.python.org/downloads/ now shows 3.16 (but it has no downloads) and is missing 3.15:
Rather than juggling which actual status of the prereleases ("planned", "feature", "prerelease") actually has a release out, let's check if they have a release in the database. Then we know we can definitely link to the downloads page.
Closes