Skip to content

[BE] Always use python 3.9 for pre-push hook's lintrunner #158693

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

ZainRizvi
Copy link
Contributor

@ZainRizvi ZainRizvi commented Jul 18, 2025

A follow up to #158389

Sets up the pre-push lintrunner to always use python 3.9, which is what's used in CI

Copy link

pytorch-bot bot commented Jul 18, 2025

🔗 Helpful Links

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

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

⏳ 15 Pending, 1 Unrelated Failure

As of commit ffdcc40 with merge base 1b5fdb2 (image):

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 pytorch-bot bot added the topic: not user facing topic category label Jul 18, 2025
@ZainRizvi ZainRizvi marked this pull request as ready for review July 18, 2025 23:09
@ZainRizvi ZainRizvi requested review from malfet, albanD and a team July 18, 2025 23:09
@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jul 21, 2025
@ZainRizvi
Copy link
Contributor Author

@pytorchbot merge -f "No trunk needed"

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

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

Copy link
Collaborator

@albanD albanD left a comment

Choose a reason for hiding this comment

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

Sounds good!
Mostly questions

@@ -94,7 +101,7 @@ def ensure_tool_installed(tool: str, force_update: bool = False) -> None:
ensure_uv()

# Ensure pre-commit is installed globally via uv
ensure_tool_installed("pre-commit", force_update=True)
ensure_tool_installed("pre-commit", force_update=True, python_ver=(3, 9))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I expect this is because it's the version we use for lintrunner in CI?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup

command = ["uv", "tool", "install", "--force", tool]
if python_ver:
# Add the Python version to the command if specified
command.extend(["--python", f"{python_ver[0]}.{python_ver[1]}"])
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: do you expect some people will not want you to install this? Should we ask the user to say yes before force installing stuff into their env here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right now the process is opt-in, and I'm inclined to default to keep the setup as homogeneous as possible in order to minimize differences in what people end up with.

If folks end up having complaints about their pre-commit check installation using a specific version python, then we can figure out a workaround that that point. But I'm expecting/hoping this will not be a big deal.

Copy link
Member

Choose a reason for hiding this comment

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

Ideally it should be isolated to the point where this shouldn't matter too much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk Trigger trunk jobs on your pull request Merged topic: not user facing topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants