Skip to content

Conversation

@Pyfagorass
Copy link

Summary

This PR fixes the pre-commit failure on Python 3.13+ by upgrading yapf to v0.40.2, which no longer depends on lib2to3.

Problem

  • yapf v0.32.0 (currently in .pre-commit-config.yaml) depends on lib2to3
  • lib2to3 was removed from Python 3.13 standard library (deprecated in Python 3.11)
  • This causes ModuleNotFoundError: No module named 'lib2to3' when running pre-commit hooks with Python 3.13+

Solution

  • Switch from github.com/pre-commit/mirrors-yapf (archived Jan 2023) to github.com/google/yapf (actively maintained)
  • Upgrade yapf from v0.32.0 to v0.40.2

Testing

Verified pre-commit hooks work successfully with:

  • ✅ Python 3.12.6: All hooks pass
  • ✅ Python 3.13.9: All hooks pass (no lib2to3 error)

References

…beflow#12393

Updates pre-commit configuration to use yapf v0.40.2 from the official
google/yapf repository instead of the archived mirrors-yapf repository.

This resolves the ModuleNotFoundError for lib2to3, which was removed
in Python 3.13 along with the 2to3 tool (deprecated in Python 3.11).
yapf v0.40.2 no longer depends on lib2to3 and is compatible with both
Python 3.12 and 3.13+.

Changes:
- Switch from github.com/pre-commit/mirrors-yapf (archived Jan 2023)
  to github.com/google/yapf (actively maintained)
- Upgrade yapf from v0.32.0 to v0.40.2

Tested with:
- Python 3.12.6: pre-commit hooks pass successfully
- Python 3.13.9: pre-commit hooks pass successfully (no lib2to3 error)

Reference: https://docs.python.org/3/whatsnew/3.13.html
Signed-off-by: pyfagorass <[email protected]>
@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign humairak for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow
Copy link

Hi @Pyfagorass. Thanks for your PR.

I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant