Skip to content

Only show pre-releases when a release exists#2998

Open
hugovk wants to merge 1 commit into
python:mainfrom
hugovk:fix-prerelease-display
Open

Only show pre-releases when a release exists#2998
hugovk wants to merge 1 commit into
python:mainfrom
hugovk:fix-prerelease-display

Conversation

@hugovk
Copy link
Copy Markdown
Member

@hugovk hugovk commented May 11, 2026

Description

3.15 b1 has just been released. That means 3.16 now exists on the main branch 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:

image

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

Copilot AI review requested due to automatic review settings May 11, 2026 14:45
@hugovk hugovk requested a review from JacobCoffee as a code owner May 11, 2026 14:45
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 treat planned/feature/prerelease statuses as “pre-release”, but only display them when a published DB Release exists 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.

Comment on lines 210 to 212
# Get last release for EOL versions
minor = int(release.split(".")[1])
last_release = Release.objects.latest_python3(minor)
if last_release:
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Python 3.15 not shown on downloads page

2 participants