Skip to content

Document when to add, drop and change the default Python version - #7743

Merged
albertvillanova merged 3 commits into
mainfrom
python-version-policy
Oct 19, 2026
Merged

albertvillanova merged 3 commits into
mainfrom
python-version-policy

Conversation

@albertvillanova

@albertvillanova albertvillanova commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

This PR documents in the contributing guide when TRL adds a Python version, when it drops one, and which version CI and the Docker images run by default.

Fix #7742.

Motivation

These decisions have been made case by case. The default Python for CI moved to 3.12 in #2298 and to 3.13 in #7648, each time on a different argument, and the timing of a drop depends on an end-of-life date that the CPython schedule only gives as a month. #7742 proposes the criteria; this PR writes them down so any maintainer can apply them the same way each October.

Solution

The criteria follow what TRL already does:

Changes

  • Add a "Python versions" section to the contributing guide, next to the dependency version floors, covering adding, dropping and the default version

Note

Low Risk
Documentation-only change to CONTRIBUTING.md with no runtime or CI behavior changes.

Overview
Adds a Python versions subsection to CONTRIBUTING.md, next to dependency version floors, so maintainers have written criteria instead of deciding ad hoc each October.

The section ties TRL to the CPython 5-year support cycle and spells out when to add a version (wheels from PyTorch/core deps, tests green, update pyproject.toml classifiers and the nightly matrix in .github/workflows/tests_python_versions.yml), when to drop one (after the final EOL release, bump the minimum-versions job to the new oldest), and how to pick the default for PR CI, docs, releases, and Docker (most-used version per pypistats, reviewed yearly; minimum-versions stays on oldest supported Python).

Reviewed by Cursor Bugbot for commit 99b5fc7. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added the 📚 documentation Improvements or additions to documentation label Oct 15, 2026
@bot-ci-comment

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Comment thread CONTRIBUTING.md Outdated

* **Adding a new version**: once PyTorch and the core dependencies publish wheels for it and the test suite passes, add it to the classifiers in `pyproject.toml` and to the nightly matrix in `.github/workflows/tests_python_versions.yml`.
* **Dropping a version**: drop it once it reaches end of life. The schedule only gives the month, and the actual end of life is the date of the final release, which can fall anywhere in that month, so drop it after that release is out. A version that old is always past the 2-year mark of [Dependency version floors](#dependency-version-floors).
* **Default version**: PR CI, the documentation build, the release workflow and the Docker images run on a single Python version, and the nightly matrix covers the other supported ones. The default is the version most TRL users run, as shown by the download stats on [pypistats](https://pypistats.org/packages/trl). Review it every October, after the new CPython release, and switch when another version has overtaken it. A newer version that few users run would leave the version most of them use tested only nightly.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

pypistats

ah nice, I used our own telemetry for #7648 but happy to see they are in line

@qgallouedec qgallouedec left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! If the min-versions job moves to 3.11 (see #7744), the default-version bullet should say that job runs on the oldest supported Python.

@albertvillanova

Copy link
Copy Markdown
Member Author

Done: the default-version bullet now says the minimum-versions job runs on the oldest supported Python, and the dropping bullet says to move that job to the new oldest version when a version is dropped.

@albertvillanova
albertvillanova merged commit bf38f33 into main Oct 19, 2026
5 checks passed
@albertvillanova
albertvillanova deleted the python-version-policy branch October 19, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📚 documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agree on when to add, drop and change the default Python version

2 participants