-
Notifications
You must be signed in to change notification settings - Fork 62
Bump minimal supported Python version from 3.8 to 3.10 #2221
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the minimal supported Python version from 3.8 to 3.10 across the codebase, aligning with PyTorch 2.9's upstream requirement. The changes modernize Python type hints and syntax throughout linter tools, test files, and configuration files.
Key changes:
- Replaced legacy
typingmodule imports with built-in generic types (e.g.,list[T]instead ofList[T]) - Added
strict=Falseparameter tozip()calls for explicit iteration behavior - Updated configuration files to reflect Python 3.10+ target versions
Reviewed Changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tools/linter/adapters/*.py | Modernized type hints by replacing typing module generics with built-in types and moving abstract types to collections.abc |
| test/xpu/*.py | Added strict=False to zip() calls and updated type annotations to use built-in generics |
| test/xpu/distributed/*.py | Added strict=False parameter to zip() calls for explicit behavior |
| test/regressions/*.py | Added strict=False to zip() calls in bilinear interpolation functions |
| test/microbench/*.py | Added strict=False to zip() calls in benchmark loops |
| pyproject.toml | Updated Black and Ruff target versions from py38 to py310 |
| mypy-strict.ini | Changed mypy python_version from 3.8 to 3.10 |
| .lintrunner.toml | Removed python_version constraints that referenced 3.9 |
| .github/scripts/*.py | Modernized type hints to use built-in generics and union syntax |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Since 2.9 release upstream set min Python version to 3.10 pytorch/pytorch#162310. We should align linters and scripts. Bumping linters also enables new lints, such as B905, which will not be fixed in this PR. This lint is xfailed in upstream too