Skip to content

[BE] Apply up007 and up045 to .ci through tools#176458

Closed
Lucaskabela wants to merge 1 commit intomainfrom
lucaskabela/up007_up045_ci_tools
Closed

[BE] Apply up007 and up045 to .ci through tools#176458
Lucaskabela wants to merge 1 commit intomainfrom
lucaskabela/up007_up045_ci_tools

Conversation

@Lucaskabela
Copy link
Contributor

@Lucaskabela Lucaskabela commented Mar 4, 2026

Convert Union[X, Y] to X | Y and Optional[X] to X | None using ruff rules UP007 and UP045 since torch is 3.10+

Note: we skip testing here - that is the last directory remaining

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @kadeng @chauhang @amjames @jataylo

@Lucaskabela Lucaskabela requested review from aorenste and fxdawnn March 4, 2026 18:17
@Lucaskabela Lucaskabela requested a review from a team as a code owner March 4, 2026 18:17
@pytorch-bot
Copy link

pytorch-bot bot commented Mar 4, 2026

🔗 Helpful Links

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

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

❌ 2 New Failures, 6 Unrelated Failures

As of commit d340655 with merge base 8bbabb0 (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:

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

@pytorch-bot
Copy link

pytorch-bot bot commented Mar 4, 2026

This PR needs a release notes: label

If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@Lucaskabela
Copy link
Contributor Author

@pytorchmergebot merge -i

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Mar 4, 2026
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged while ignoring the following 3 checks: operator_benchmark / aarch64-opbenchmark-test / test (cpu_operator_benchmark_short, 1, 1, linux.arm64.m8g.4xlarge), operator_benchmark / x86-opbenchmark-test / test (cpu_operator_benchmark_short, 1, 1, linux.12xlarge), inductor / inductor-cpu-test / test (cpu_inductor_torchbench, 1, 2, linux.2xlarge.amx, unstable)

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorch-auto-revert
Copy link

@pytorchbot revert -m "Reverted automatically by pytorch's autorevert, to avoid this behaviour add the tag autorevert: disable" -c autorevert

This PR is attributed to have caused regression in:

Please investigate and fix the issues.
@claude Can you please read this revert comment, follow the links and read the errors, to then give a brief diagnostics on the cause of the error? If you judge the error to be legitimate reason for a revert, please provide brief guidance on how the author could fix it.

@claude
Copy link

claude bot commented Mar 5, 2026

Claude finished @pytorch-auto-revert[bot]'s task in 1m 50s —— View job


Investigating Revert of PR #176458

  • Read the CI failure logs from the vllm-test build
  • Identify the root cause of the failure
  • Assess if the revert is legitimate
  • Provide guidance on fixing the issue

Diagnosis

The revert is legitimate. The root cause is a Python version incompatibility.

The PR converted Optional[X] to X | None (PEP 604 union syntax) across many files, including the .ci/lumen_cli/ directory. The problem is that the vllm CI build environment runs the lumen_cli tool using Python 3.9 (the system Python on the CI runner), not Python 3.12 (which is used for the actual PyTorch build).

The X | None union syntax in type annotations at module scope (not inside from __future__ import annotations or string annotations) requires Python 3.10+ at runtime. When Python 3.9 tries to evaluate docker.DockerClient | None at line 14 of docker_helper.py, it fails with:

TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

The full traceback from the CI log:

File ".ci/lumen_cli/cli/lib/common/docker_helper.py", line 14, in <module>
    _docker_client: docker.DockerClient | None = None
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

How to Fix

The .ci/lumen_cli/ files must retain the Optional[X] / Union[X, Y] syntax (or use from __future__ import annotations at the top of each file) because they are executed with Python 3.9 in the vllm CI environment. Specifically, the following files from this PR need to be reverted or have from __future__ import annotations added:

  • .ci/lumen_cli/cli/lib/common/docker_helper.py
  • .ci/lumen_cli/cli/lib/common/envs_helper.py
  • .ci/lumen_cli/cli/lib/common/path_helper.py
  • .ci/lumen_cli/cli/lib/common/pip_helper.py
  • .ci/lumen_cli/cli/lib/common/utils.py
  • .ci/lumen_cli/cli/lib/core/vllm/vllm_build.py

The simplest fix is to add from __future__ import annotations to each of these files, which makes all annotations strings (lazy evaluation) and avoids the runtime TypeError. Alternatively, exclude the .ci/lumen_cli/ directory from the ruff UP007/UP045 rules, or revert just those files back to Optional/Union syntax.

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a revert job. Check the current status here.
Questions? Feedback? Please reach out to the PyTorch DevX Team

pytorchmergebot added a commit that referenced this pull request Mar 5, 2026
This reverts commit f1da356.

Reverted #176458 on behalf of https://github.com/pytorch-auto-revert due to Reverted automatically by pytorch's autorevert, to avoid this behaviour add the tag autorevert: disable ([comment](#176458 (comment)))
@pytorchmergebot
Copy link
Collaborator

@Lucaskabela your PR has been successfully reverted.

@pytorchmergebot pytorchmergebot added Reverted ci-no-td Do not run TD on this PR labels Mar 5, 2026
Vighaneshs pushed a commit to Vighaneshs/pytorch that referenced this pull request Mar 5, 2026
Convert Union[X, Y] to X | Y and Optional[X] to X | None using ruff rules UP007 and UP045 since torch is 3.10+

Note: we skip testing here - that is the last directory remaining

Pull Request resolved: pytorch#176458
Approved by: https://github.com/aorenste
@Lucaskabela Lucaskabela force-pushed the lucaskabela/up007_up045_ci_tools branch from 2c6e2a0 to 8eabc97 Compare March 5, 2026 16:50
@Lucaskabela Lucaskabela added ciflow/vllm and removed ci-no-td Do not run TD on this PR labels Mar 5, 2026
@Lucaskabela Lucaskabela added the ci-no-td Do not run TD on this PR label Mar 5, 2026
@Lucaskabela
Copy link
Contributor Author

@pytorchmergebot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Collaborator

The merge job was canceled or timed out. This most often happen if two merge requests were issued for the same PR, or if merge job was waiting for more than 6 hours for tests to finish. In later case, please do not hesitate to reissue the merge command
For more information see pytorch-bot wiki.

@Lucaskabela
Copy link
Contributor Author

@pytorchmergebot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Successfully rebased lucaskabela/up007_up045_ci_tools onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout lucaskabela/up007_up045_ci_tools && git pull --rebase)

@pytorchmergebot pytorchmergebot force-pushed the lucaskabela/up007_up045_ci_tools branch from 8eabc97 to d340655 Compare March 6, 2026 00:13
@Lucaskabela
Copy link
Contributor Author

@pytorchmergebot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are: operator_benchmark / aarch64-opbenchmark-test / test (cpu_operator_benchmark_short, 1, 1, linux.arm64.m8g.4xlarge)

Details for Dev Infra team Raised by workflow job

@Lucaskabela
Copy link
Contributor Author

@pytorchmergebot merge -i

meta-codesync bot pushed a commit to pytorch/benchmark that referenced this pull request Mar 7, 2026
Summary:
Convert Union[X, Y] to X | Y and Optional[X] to X | None using ruff rules UP007 and UP045 since torch is 3.10+

Note: we skip testing here - that is the last directory remaining

X-link: pytorch/pytorch#176458
Approved by: https://github.com/aorenste

Reviewed By: wdvr

Differential Revision: D95607647

fbshipit-source-id: be3d2f5f900c6270a52ca493e2904d99353f51f9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants