Repository navigation
Conversation
PR Status: Approved 🚀Please fix all CI failures and trigger merge by commenting "@pytorchbot merge". ⚪ AUTOMATED REVIEW - Skipped, PR too large to review:
This PR is over the automated review's size limit, so it was not reviewed. Reviewed commit: 🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/203051
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 25 PendingAs of commit 73ab073 with merge base 4fb332d ( 🟡 GREEN LIGHT - OUTDATED (earlier commit) - PR requires human review:
reason: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Drop `target-version = "py310"` so ruff takes its target from requires-python again, and apply the pyupgrade findings that turns on: UP035 (typing_extensions imports now in typing), UP044 (Unpack), UP017 (timezone.utc -> UTC), UP036 (dead sys.version_info checks) and UP041. Imports are re-sorted and reformatted where the fixes moved them. tools/linter/adapters/** keeps a per-file py310 target: lintrunner runs those adapters with `uv run --python 3.10`, where `tomllib` and `typing.Self` do not exist. Co-authored-by: Claude Code
Drop the per-file py310 ruff target for tools/linter/adapters/** and move what it protected to 3.11 instead: the 15 `uv run --python 3.10` entries in .lintrunner.toml and their `requires-python` script headers, plus `python_version` in mypy-strict.ini. With that, the adapters use `tomllib` and `typing.Self` directly, and the `tomli ; python_version < '3.11'` dependency markers go away. Co-authored-by: Claude Code
`spin lint` rejected the 3.11 `uv run --script` linters with "must specify `--python 3.10`" before running any linter, which is why the lintrunner jobs failed without producing lint.json. Check for 3.11, and run lintrunner itself under 3.11. Co-authored-by: Claude Code
Removing the dead `sys.version_info >= (3, 11)` branches lost the `# pyrefly: ignore [bad-argument-type]` above `asyncio.Task(...)`, narrowed the `task_factory(...)` ignore to `arg-type`, and moved the dead Callable alias's `valid-type` ignore onto `TaskFactoryType = TaskFactory`. Restore the comments the 3.11 branch had. Co-authored-by: Claude Code
dd21a1c to
73ab073
Compare
|
@atalman has imported this pull request. If you are a Meta employee, you can view this in D129356013. |
|
@pytorchmergebot merge -f "lint is passing the signal was green already on this PR" |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
… 300 (#203217) Raise `MAX_CHANGED_FILES` in `hardened-pr-review-run.yml` from 100 to 300. PRs that touch many files with small per-file edits (lint autofixes, renames, version-pin bumps) were being recorded as `skipped_too_large` even though their diffs are small. For example, #203051 changes 161 files with a 106 KB diff. - `MAX_DIFF_BYTES` is unchanged at 400000, so a large diff is still skipped whatever its file count, and the context/cost bound on a single review is the same as before. - `MAX_CHANGED_FILES` is one workflow-level env read by both `prepare` and `review`, so the early gate and the real-diff gate move together. - No test pins the number: `scripts/pr_review/test_workflow_contract.py` only requires a single numeric workflow-level value (its `"100"` at line 831 is a stub input to a unit test). Tested: `python3 -m unittest scripts.pr_review.test_workflow_contract` — 183 tests, OK. Created with Claude Pull Request resolved: #203217 Approved by: https://github.com/huydhn
…202442 (base update) [ghstack-poisoned]
…ew (#203136) ✴️ iz2: When a PR is over the automated review's size gate (300 changed files or 400 KB of diff), the review only wrote an S3 telemetry row and Dr.CI showed a collapsed "Skipped, PR too large" line with no next step. Authors read that as the review being broken (#203051: 162 files, skipped under the earlier 100-file cap that #203217 raised to 300). The skip now posts a COMMENT review that says the PR is over the limit, suggests splitting it, and gives the opt-out command (`@pytorchbot label "no automated review"`). The bot never applies the label itself; that stays the author's call. - File-count path (decided in `prepare`): `announce` posts the notice with a new `post_review.py --too-large` mode. It already has the right token: `pull-requests: write`, no AWS, no environment, no PR code. - Diff-bytes path (decided in `review`): `publish` posts the same notice from the `skipped_too_large` row. - The notice hides earlier automated reviews like any new review. It dismisses no standing change request, since the large PR was not evaluated; after an opt-out that request stays until a maintainer dismisses it. It is not reposted while the newest visible review is the same notice; one marked in progress gets its body back. `fetch_pr_comments.py` never treats a notice as the latest verdict, so re-review interdiffs (#202667) also start from the last verdict's commit. - The command sits mid-line in a code span. pytorch-bot only runs commands that start a line (`cliParser.ts`), and the label text is validated, so the notice cannot trigger the bot. Test plan: `python3 -m unittest discover -s scripts/pr_review -t .` passes (654 tests). New tests cover the notice body and its bot-command safety, dedupe (including marked and defused notices), head move, opt-out, change-request handling, the interdiff base, and the workflow wiring. Known limit: if a smaller commit's review fails, the old notice is put back with the command defused until the next too-large run replaces it. Dr.CI shows that run's failure. Pull Request resolved: #203136 Approved by: https://github.com/huydhn
…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
… 300 (pytorch#203217) Raise `MAX_CHANGED_FILES` in `hardened-pr-review-run.yml` from 100 to 300. PRs that touch many files with small per-file edits (lint autofixes, renames, version-pin bumps) were being recorded as `skipped_too_large` even though their diffs are small. For example, pytorch#203051 changes 161 files with a 106 KB diff. - `MAX_DIFF_BYTES` is unchanged at 400000, so a large diff is still skipped whatever its file count, and the context/cost bound on a single review is the same as before. - `MAX_CHANGED_FILES` is one workflow-level env read by both `prepare` and `review`, so the early gate and the real-diff gate move together. - No test pins the number: `scripts/pr_review/test_workflow_contract.py` only requires a single numeric workflow-level value (its `"100"` at line 831 is a stub input to a unit test). Tested: `python3 -m unittest scripts.pr_review.test_workflow_contract` — 183 tests, OK. Created with Claude Pull Request resolved: pytorch#203217 Approved by: https://github.com/huydhn
…ew (pytorch#203136) ✴️ iz2: When a PR is over the automated review's size gate (300 changed files or 400 KB of diff), the review only wrote an S3 telemetry row and Dr.CI showed a collapsed "Skipped, PR too large" line with no next step. Authors read that as the review being broken (pytorch#203051: 162 files, skipped under the earlier 100-file cap that pytorch#203217 raised to 300). The skip now posts a COMMENT review that says the PR is over the limit, suggests splitting it, and gives the opt-out command (`@pytorchbot label "no automated review"`). The bot never applies the label itself; that stays the author's call. - File-count path (decided in `prepare`): `announce` posts the notice with a new `post_review.py --too-large` mode. It already has the right token: `pull-requests: write`, no AWS, no environment, no PR code. - Diff-bytes path (decided in `review`): `publish` posts the same notice from the `skipped_too_large` row. - The notice hides earlier automated reviews like any new review. It dismisses no standing change request, since the large PR was not evaluated; after an opt-out that request stays until a maintainer dismisses it. It is not reposted while the newest visible review is the same notice; one marked in progress gets its body back. `fetch_pr_comments.py` never treats a notice as the latest verdict, so re-review interdiffs (pytorch#202667) also start from the last verdict's commit. - The command sits mid-line in a code span. pytorch-bot only runs commands that start a line (`cliParser.ts`), and the label text is validated, so the notice cannot trigger the bot. Test plan: `python3 -m unittest discover -s scripts/pr_review -t .` passes (654 tests). New tests cover the notice body and its bot-command safety, dedupe (including marked and defused notices), head move, opt-out, change-request handling, the interdiff base, and the workflow wiring. Known limit: if a smaller commit's review fails, the old notice is put back with the command defused until the next too-large run replaces it. Dr.CI shows that run's failure. Pull Request resolved: pytorch#203136 Approved by: https://github.com/huydhn
…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
… 300 (pytorch#203217) Raise `MAX_CHANGED_FILES` in `hardened-pr-review-run.yml` from 100 to 300. PRs that touch many files with small per-file edits (lint autofixes, renames, version-pin bumps) were being recorded as `skipped_too_large` even though their diffs are small. For example, pytorch#203051 changes 161 files with a 106 KB diff. - `MAX_DIFF_BYTES` is unchanged at 400000, so a large diff is still skipped whatever its file count, and the context/cost bound on a single review is the same as before. - `MAX_CHANGED_FILES` is one workflow-level env read by both `prepare` and `review`, so the early gate and the real-diff gate move together. - No test pins the number: `scripts/pr_review/test_workflow_contract.py` only requires a single numeric workflow-level value (its `"100"` at line 831 is a stub input to a unit test). Tested: `python3 -m unittest scripts.pr_review.test_workflow_contract` — 183 tests, OK. Created with Claude Pull Request resolved: pytorch#203217 Approved by: https://github.com/huydhn
…ew (pytorch#203136) ✴️ iz2: When a PR is over the automated review's size gate (300 changed files or 400 KB of diff), the review only wrote an S3 telemetry row and Dr.CI showed a collapsed "Skipped, PR too large" line with no next step. Authors read that as the review being broken (pytorch#203051: 162 files, skipped under the earlier 100-file cap that pytorch#203217 raised to 300). The skip now posts a COMMENT review that says the PR is over the limit, suggests splitting it, and gives the opt-out command (`@pytorchbot label "no automated review"`). The bot never applies the label itself; that stays the author's call. - File-count path (decided in `prepare`): `announce` posts the notice with a new `post_review.py --too-large` mode. It already has the right token: `pull-requests: write`, no AWS, no environment, no PR code. - Diff-bytes path (decided in `review`): `publish` posts the same notice from the `skipped_too_large` row. - The notice hides earlier automated reviews like any new review. It dismisses no standing change request, since the large PR was not evaluated; after an opt-out that request stays until a maintainer dismisses it. It is not reposted while the newest visible review is the same notice; one marked in progress gets its body back. `fetch_pr_comments.py` never treats a notice as the latest verdict, so re-review interdiffs (pytorch#202667) also start from the last verdict's commit. - The command sits mid-line in a code span. pytorch-bot only runs commands that start a line (`cliParser.ts`), and the label text is validated, so the notice cannot trigger the bot. Test plan: `python3 -m unittest discover -s scripts/pr_review -t .` passes (654 tests). New tests cover the notice body and its bot-command safety, dedupe (including marked and defused notices), head move, opt-out, change-request handling, the interdiff base, and the workflow wiring. Known limit: if a smaller commit's review fails, the old notice is put back with the command defused until the next too-large run replaces it. Dr.CI shows that run's failure. Pull Request resolved: pytorch#203136 Approved by: https://github.com/huydhn
Go through the following checklist
ruffand the PYFMT adapter directly, not throughlintrunner)Linked issue or supporting maintainer
Follow-up to #202271 / #202273, which raised
requires-pythonto>=3.11and (via #202303 onrelease/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 fromrequires-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.typing_extensionsimports that are intyping/collections.abcon 3.11Unpack[...]timezone.utc->UTCsys.version_infochecksChanges:
ruff check --fix --unsafe-fixesfor those five rules. I read the UP036 rewrites (e.g.torch/_inductor/await_utils.py, thebisect_leftpaths intorch/fx/proxy.pyandsymbolic_shapes.py); each keeps the 3.11 branch.usort+ruff formaton the 94 files where moving imports changed their order. Oneimport tomllibintest/spincli/test_spin.pywas left out of order and is moved by hand.uv run --python 3.10, where the autofix'simport tomllibandtyping.Selfwould not exist. Rather than pin them to a 3.10 ruff target, the second commit moves those 15--python 3.10entries in.lintrunner.tomland theirrequires-pythonscript headers to 3.11, drops thetomli ; python_version < '3.11'dependency markers, and applies the same fixes totools/linter/adapters/**.mypy-strict.inimoves frompython_version = 3.10to 3.11 too.Not changed:
pyrefly.toml(python-version = "3.12"), and theB905entry 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/scriptsandtools, so it will conflict with in-flight PRs; the sooner it lands the fewer rebases.Testing
With
ruff==0.14.4and the repo config, on the tree at this PR's base:pyfmt_linter.py(usort + ruff format) on the changed.pyfiles introduces nothing new; it flags onlytorch/utils/checkpoint.py, which it also flags without this change.uv run --python 3.11 --script:pyfmt_linter,pyproject_linterandcmake_minimum_required_linter(clean onpyproject.toml), andlicense_files_linterstarts. The other moved adapters were not run individually..py/.pyifiles parse on CPython 3.11.Not run:
lintrunnerend to end,mypy --config-file mypy-strict.inion 3.11 (used bytest/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
cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @aditew01 @voznesenskym @penguinwu @EikanWang @Guobing-Chen @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo @azahed98