Merged
Conversation
Turns out this is important for the black formatting tool to work correctly. The formatting won't generally change between python versions (it only depends on `black`'s version), but the formatted code needs to be parseable by the system python version. One script uses ```python def foo[T](x: T) -> T: ``` syntax, which is only supported in Python 3.12 and later. Running `pre-commit` will now require a python 3.12 installation (which is already what we mandate for internal developer environment setup). The error in case of absence of such a version is pretty clear though.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR ensures the project’s formatting and tooling use Python 3.12 so that newer syntax (like generic brackets in function definitions) is parseable by both Black and the system Python.
- Update
run_in_parallelsignature to inline generic bracket syntax - Configure Pre-commit to default to Python 3.12
- Add
setup-pythonstep in CI to install Python 3.12
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| misc/scripts/models-as-data/bulk_generate_mad.py | Simplified run_in_parallel signature to [T, U] syntax |
| .pre-commit-config.yaml | Set default_language_version to Python 3.12 |
| .github/workflows/python-tooling.yml | Add actions/setup-python@v5 step for Python 3.12 in CI |
mbg
approved these changes
Jun 13, 2025
Member
mbg
left a comment
There was a problem hiding this comment.
Changes look sensible. Did you cancel the MaD workflow or was that a failure?
Contributor
Author
that's a recurring flake that should be fixed by #19744 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Turns out this is important for the black formatting tool to work correctly. The formatting won't generally change between python versions (it only depends on
black's version), but the formatted code needs to be parseable by the system python version. One script usessyntax, which is only supported in Python 3.12 and later.
Running
pre-commitwill now require a python 3.12 installation (which is already what we mandate for internal developer environment setup). The error in case of absence of such a version is pretty clear though.