Skip to content

[release/2.15] Raise the minimum Python to 3.11 in the package metadata - #202273

Merged
atalman merged 1 commit into
pytorch:release/2.15from
atalman:pyproject_min_py311_r215
Oct 27, 2026
Merged

atalman merged 1 commit into
pytorch:release/2.15from
atalman:pyproject_min_py311_r215

Conversation

@atalman

@atalman atalman commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Release-branch copy of #202271 (main). Same two-file change; it applies cleanly to release/2.15.

Summary

Raise the minimum Python in the package metadata from 3.10 to 3.11, to match what 2.15 builds.

  • pyproject.toml: requires-python = ">=3.11", and remove the Programming Language :: Python :: 3.10 classifier.
  • README.md: the source-build prerequisite says "Python 3.11 or later".

Why

FULL_PYTHON_VERSIONS on release/2.15 starts at 3.11, and the 2.15.0 wheels on the test channel are cp311 to cp315 (plus cp314t and cp315t), with no cp310. The 2.15 releng notes say the same: "PyTorch 2.15 raises the minimum supported Python version for binaries to 3.11". But the 2.15.0 wheels carry:

Requires-Python: >=3.10
Classifier: Programming Language :: Python :: 3.10

That advertises 3.10 on PyPI and pip show, and makes uv and Poetry try to resolve 2.15 for Python 3.10 and fail on a missing wheel instead of reporting that 3.11 is required. The RC wheels already on the test channel have the old metadata; GA wheels built from this branch after this lands will not.

Testing

pyproject.toml parses (tomllib), and project.requires-python is >=3.11 with the classifiers 3 :: Only, 3.11 to 3.15. I did not build a wheel or an sdist from this change.

Same change as pytorch#202271 on main. PyTorch 2.15 builds no cp310 wheels (FULL_PYTHON_VERSIONS starts at 3.11), but pyproject.toml still declares requires-python >=3.10 and the 3.10 classifier, so the 2.15 wheels advertise a Python they are not built for. Set requires-python to >=3.11, drop the 3.10 classifier and update the README prerequisite.
@pytorch-bot pytorch-bot Bot added the topic: not user facing topic category label Oct 27, 2026
@pytorch-bot

pytorch-bot Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/202273

Note: Links to docs will display an error until the docs builds have been completed.

⏳ No Failures, 22 Pending

As of commit 0c5eff6 with merge base 2cce586 (image):
💚 Looks good so far! There are no failures yet. 💚

🟡 GREEN LIGHT - PR requires human review:

  • Never trivial: removes public support
    • pyproject.toml raises requires-python from >=3.10 to >=3.11, so pip refuses source/sdist installs on 3.10
    • Drops the Programming Language :: Python :: 3.10 classifier from published package metadata
  • Release and publish plumbing
    • Targets release/2.15 and changes the metadata GA wheels ship to PyPI, a path the skill names never trivial
  • Socialization
    • Moves a user-facing limit (minimum supported Python), which release managers and users need to know landed

reason: not_trivial
Reviewed commit: 0c5eff6

Inference job

🐛 Report a wrong verdict

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorchgreenlight pytorchgreenlight Bot added the GL/human GreenLight marked as needing human review label Oct 27, 2026

@huydhn huydhn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stamped!

@atalman
atalman merged commit d0f2af8 into pytorch:release/2.15 Oct 27, 2026
34 of 48 checks passed
@pytorchbot pytorchbot added the in progress PR is being worked on by the author, until the automated review accepts it label Oct 27, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated review of 0c5eff6: nothing blocking; ready for human review.

This PR raises requires-python in pyproject.toml to >=3.11, drops the Python 3.10 classifier, and changes the README's source-build prerequisite to Python 3.11, which matches the 2.15 row of RELEASE.md. The review found no issues. Recommendation: Approve.

This review is AI-generated and advisory. Each new automated review replaces the previous one.

atalman added a commit that referenced this pull request Oct 28, 2026
… removed (#202303)

Follow-up to #202273. Ruff takes its target version from requires-python; at >=3.11 it enables UP035, UP036, UP044, UP017 and UP041 and flags 257 places in 162 files that still carry Python 3.10 compatibility code, so the Lint job fails on release/2.15. Pin target-version to py310 so lint is unchanged. Same change as the pin added to #202271 on main.

Co-authored-by: Andrey Talman <[email protected]>
pytorchmergebot pushed a commit that referenced this pull request Nov 3, 2026
)

Go through the following checklist
- [x] Passes lint (checked `ruff` and the PYFMT adapter directly, not through `lintrunner`)
- [ ] Added/updated tests
- [ ] Updated documentation (if applicable)
- [ ] Included benchmark results (for PRs impacting perf)

---

## Linked issue or supporting maintainer

Follow-up to #202271 / #202273, which raised `requires-python` to `>=3.11` and (via #202303 on `release/2.15`) pinned ruff to 3.10 until this cleanup.

## BC-breaking?

No. Lint configuration and Python 3.11-only syntax/imports only. Behaviour is unchanged: the rewritten `sys.version_info >= (3, 11)` branches were already the live ones.

## Summary (human written only)

Removes `target-version = "py310"` from `[tool.ruff]` so ruff takes its target from `requires-python` (3.11) again, and applies the findings that turns on.

## Agent details (if applicable)

Drafted with Claude Code; diff reviewed by hand. The commit message follows.

Without the pin, `ruff check .` (ruff 0.14.4, the version lintrunner pins) goes from 941 to 1115 findings: 174 new, in 143 files, from five rules.

| Rule | Count | What | Fix |
|---|---|---|---|
| UP035 | 103 | `typing_extensions` imports that are in `typing` / `collections.abc` on 3.11 | safe |
| UP044 | 30 | `Unpack[...]` | unsafe |
| UP017 | 20 | `timezone.utc` -> `UTC` | safe |
| UP036 | 19 | obsolete `sys.version_info` checks | unsafe |
| UP041 | 2 | aliased errors | safe |

Changes:

- Delete the pin.
- `ruff check --fix --unsafe-fixes` for those five rules. I read the UP036 rewrites (e.g. `torch/_inductor/await_utils.py`, the `bisect_left` paths in `torch/fx/proxy.py` and `symbolic_shapes.py`); each keeps the 3.11 branch.
- Clean up what the fixes leave behind (27 unused imports and similar, all safe fixes), then `usort` + `ruff format` on the 94 files where moving imports changed their order. One `import tomllib` in `test/spincli/test_spin.py` was left out of order and is moved by hand.
- Python 3.11 across the lint tooling, instead of carving out the adapters. lintrunner runs 15 adapters with `uv run --python 3.10`, where the autofix's `import tomllib` and `typing.Self` would not exist. Rather than pin them to a 3.10 ruff target, the second commit moves those 15 `--python 3.10` entries in `.lintrunner.toml` and their `requires-python` script headers to 3.11, drops the `tomli ; python_version < '3.11'` dependency markers, and applies the same fixes to `tools/linter/adapters/**`. `mypy-strict.ini` moves from `python_version = 3.10` to 3.11 too.

Not changed: `pyrefly.toml` (`python-version = "3.12"`), and the `B905` entry in `[tool.ruff.lint] ignore`, whose comment says "TODO: Remove Python-3.10 specific suppressions". I did not check what removing it would change; it is a separate cleanup.

This touches 161 files (+294/-427) across `torch/`, `torchgen/`, `test/`, `.github/scripts` and `tools`, so it will conflict with in-flight PRs; the sooner it lands the fewer rebases.

## Testing

With `ruff==0.14.4` and the repo config, on the tree at this PR's base:

- Before the change (pin in place): 941 findings.
- With the pin removed and no fixes: 1115 findings (174 new).
- This PR: 939 findings, none beyond the 941 baseline.
- `pyfmt_linter.py` (usort + ruff format) on the changed `.py` files introduces nothing new; it flags only `torch/utils/checkpoint.py`, which it also flags without this change.
- Smoke-tested under `uv run --python 3.11 --script`: `pyfmt_linter`, `pyproject_linter` and `cmake_minimum_required_linter` (clean on `pyproject.toml`), and `license_files_linter` starts. The other moved adapters were not run individually.
- All 139 changed `.py`/`.pyi` files parse on CPython 3.11.

Not run: `lintrunner` end to end, `mypy --config-file mypy-strict.ini` on 3.11 (used by `test/test_type_hints.py`), and the test suites. CI is the verification for those.

Authored with an AI assistant; the diff was reviewed by hand.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Pull Request resolved: #203051
Approved by: https://github.com/williamwen42, https://github.com/justinchuby, https://github.com/d4l3k
dominikjastrzebskix pushed a commit to dominikjastrzebskix/pytorch that referenced this pull request Nov 5, 2026
…rch#203051)

Go through the following checklist
- [x] Passes lint (checked `ruff` and the PYFMT adapter directly, not through `lintrunner`)
- [ ] Added/updated tests
- [ ] Updated documentation (if applicable)
- [ ] Included benchmark results (for PRs impacting perf)

---

## Linked issue or supporting maintainer

Follow-up to pytorch#202271 / pytorch#202273, which raised `requires-python` to `>=3.11` and (via pytorch#202303 on `release/2.15`) pinned ruff to 3.10 until this cleanup.

## BC-breaking?

No. Lint configuration and Python 3.11-only syntax/imports only. Behaviour is unchanged: the rewritten `sys.version_info >= (3, 11)` branches were already the live ones.

## Summary (human written only)

Removes `target-version = "py310"` from `[tool.ruff]` so ruff takes its target from `requires-python` (3.11) again, and applies the findings that turns on.

## Agent details (if applicable)

Drafted with Claude Code; diff reviewed by hand. The commit message follows.

Without the pin, `ruff check .` (ruff 0.14.4, the version lintrunner pins) goes from 941 to 1115 findings: 174 new, in 143 files, from five rules.

| Rule | Count | What | Fix |
|---|---|---|---|
| UP035 | 103 | `typing_extensions` imports that are in `typing` / `collections.abc` on 3.11 | safe |
| UP044 | 30 | `Unpack[...]` | unsafe |
| UP017 | 20 | `timezone.utc` -> `UTC` | safe |
| UP036 | 19 | obsolete `sys.version_info` checks | unsafe |
| UP041 | 2 | aliased errors | safe |

Changes:

- Delete the pin.
- `ruff check --fix --unsafe-fixes` for those five rules. I read the UP036 rewrites (e.g. `torch/_inductor/await_utils.py`, the `bisect_left` paths in `torch/fx/proxy.py` and `symbolic_shapes.py`); each keeps the 3.11 branch.
- Clean up what the fixes leave behind (27 unused imports and similar, all safe fixes), then `usort` + `ruff format` on the 94 files where moving imports changed their order. One `import tomllib` in `test/spincli/test_spin.py` was left out of order and is moved by hand.
- Python 3.11 across the lint tooling, instead of carving out the adapters. lintrunner runs 15 adapters with `uv run --python 3.10`, where the autofix's `import tomllib` and `typing.Self` would not exist. Rather than pin them to a 3.10 ruff target, the second commit moves those 15 `--python 3.10` entries in `.lintrunner.toml` and their `requires-python` script headers to 3.11, drops the `tomli ; python_version < '3.11'` dependency markers, and applies the same fixes to `tools/linter/adapters/**`. `mypy-strict.ini` moves from `python_version = 3.10` to 3.11 too.

Not changed: `pyrefly.toml` (`python-version = "3.12"`), and the `B905` entry in `[tool.ruff.lint] ignore`, whose comment says "TODO: Remove Python-3.10 specific suppressions". I did not check what removing it would change; it is a separate cleanup.

This touches 161 files (+294/-427) across `torch/`, `torchgen/`, `test/`, `.github/scripts` and `tools`, so it will conflict with in-flight PRs; the sooner it lands the fewer rebases.

## Testing

With `ruff==0.14.4` and the repo config, on the tree at this PR's base:

- Before the change (pin in place): 941 findings.
- With the pin removed and no fixes: 1115 findings (174 new).
- This PR: 939 findings, none beyond the 941 baseline.
- `pyfmt_linter.py` (usort + ruff format) on the changed `.py` files introduces nothing new; it flags only `torch/utils/checkpoint.py`, which it also flags without this change.
- Smoke-tested under `uv run --python 3.11 --script`: `pyfmt_linter`, `pyproject_linter` and `cmake_minimum_required_linter` (clean on `pyproject.toml`), and `license_files_linter` starts. The other moved adapters were not run individually.
- All 139 changed `.py`/`.pyi` files parse on CPython 3.11.

Not run: `lintrunner` end to end, `mypy --config-file mypy-strict.ini` on 3.11 (used by `test/test_type_hints.py`), and the test suites. CI is the verification for those.

Authored with an AI assistant; the diff was reviewed by hand.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Pull Request resolved: pytorch#203051
Approved by: https://github.com/williamwen42, https://github.com/justinchuby, https://github.com/d4l3k
dominikjastrzebskix pushed a commit to dominikjastrzebskix/pytorch that referenced this pull request Nov 9, 2026
…rch#203051)

Go through the following checklist
- [x] Passes lint (checked `ruff` and the PYFMT adapter directly, not through `lintrunner`)
- [ ] Added/updated tests
- [ ] Updated documentation (if applicable)
- [ ] Included benchmark results (for PRs impacting perf)

---

## Linked issue or supporting maintainer

Follow-up to pytorch#202271 / pytorch#202273, which raised `requires-python` to `>=3.11` and (via pytorch#202303 on `release/2.15`) pinned ruff to 3.10 until this cleanup.

## BC-breaking?

No. Lint configuration and Python 3.11-only syntax/imports only. Behaviour is unchanged: the rewritten `sys.version_info >= (3, 11)` branches were already the live ones.

## Summary (human written only)

Removes `target-version = "py310"` from `[tool.ruff]` so ruff takes its target from `requires-python` (3.11) again, and applies the findings that turns on.

## Agent details (if applicable)

Drafted with Claude Code; diff reviewed by hand. The commit message follows.

Without the pin, `ruff check .` (ruff 0.14.4, the version lintrunner pins) goes from 941 to 1115 findings: 174 new, in 143 files, from five rules.

| Rule | Count | What | Fix |
|---|---|---|---|
| UP035 | 103 | `typing_extensions` imports that are in `typing` / `collections.abc` on 3.11 | safe |
| UP044 | 30 | `Unpack[...]` | unsafe |
| UP017 | 20 | `timezone.utc` -> `UTC` | safe |
| UP036 | 19 | obsolete `sys.version_info` checks | unsafe |
| UP041 | 2 | aliased errors | safe |

Changes:

- Delete the pin.
- `ruff check --fix --unsafe-fixes` for those five rules. I read the UP036 rewrites (e.g. `torch/_inductor/await_utils.py`, the `bisect_left` paths in `torch/fx/proxy.py` and `symbolic_shapes.py`); each keeps the 3.11 branch.
- Clean up what the fixes leave behind (27 unused imports and similar, all safe fixes), then `usort` + `ruff format` on the 94 files where moving imports changed their order. One `import tomllib` in `test/spincli/test_spin.py` was left out of order and is moved by hand.
- Python 3.11 across the lint tooling, instead of carving out the adapters. lintrunner runs 15 adapters with `uv run --python 3.10`, where the autofix's `import tomllib` and `typing.Self` would not exist. Rather than pin them to a 3.10 ruff target, the second commit moves those 15 `--python 3.10` entries in `.lintrunner.toml` and their `requires-python` script headers to 3.11, drops the `tomli ; python_version < '3.11'` dependency markers, and applies the same fixes to `tools/linter/adapters/**`. `mypy-strict.ini` moves from `python_version = 3.10` to 3.11 too.

Not changed: `pyrefly.toml` (`python-version = "3.12"`), and the `B905` entry in `[tool.ruff.lint] ignore`, whose comment says "TODO: Remove Python-3.10 specific suppressions". I did not check what removing it would change; it is a separate cleanup.

This touches 161 files (+294/-427) across `torch/`, `torchgen/`, `test/`, `.github/scripts` and `tools`, so it will conflict with in-flight PRs; the sooner it lands the fewer rebases.

## Testing

With `ruff==0.14.4` and the repo config, on the tree at this PR's base:

- Before the change (pin in place): 941 findings.
- With the pin removed and no fixes: 1115 findings (174 new).
- This PR: 939 findings, none beyond the 941 baseline.
- `pyfmt_linter.py` (usort + ruff format) on the changed `.py` files introduces nothing new; it flags only `torch/utils/checkpoint.py`, which it also flags without this change.
- Smoke-tested under `uv run --python 3.11 --script`: `pyfmt_linter`, `pyproject_linter` and `cmake_minimum_required_linter` (clean on `pyproject.toml`), and `license_files_linter` starts. The other moved adapters were not run individually.
- All 139 changed `.py`/`.pyi` files parse on CPython 3.11.

Not run: `lintrunner` end to end, `mypy --config-file mypy-strict.ini` on 3.11 (used by `test/test_type_hints.py`), and the test suites. CI is the verification for those.

Authored with an AI assistant; the diff was reviewed by hand.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Pull Request resolved: pytorch#203051
Approved by: https://github.com/williamwen42, https://github.com/justinchuby, https://github.com/d4l3k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GL/human GreenLight marked as needing human review in progress PR is being worked on by the author, until the automated review accepts it topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants