Skip to content

Commit fe1e562

Browse files
committed
CI: fix python version
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.
1 parent 70647ce commit fe1e562

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

.github/workflows/python-tooling.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ jobs:
2222
runs-on: ubuntu-latest
2323
steps:
2424
- uses: actions/checkout@v4
25+
- uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.12'
2528
- uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507
2629
name: Check that python code is properly formatted
2730
with:

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
3+
default_language_version:
4+
python: python3.12
35
repos:
46
- repo: https://github.com/pre-commit/pre-commit-hooks
57
rev: v3.2.0

misc/scripts/models-as-data/bulk_generate_mad.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,7 @@ def clone_project(project: Project) -> str:
116116
return target_dir
117117

118118

119-
def run_in_parallel[
120-
T, U
121-
](
119+
def run_in_parallel[T, U](
122120
func: Callable[[T], U],
123121
items: List[T],
124122
*,
@@ -516,7 +514,7 @@ def main(config, args) -> None:
516514
"--dca",
517515
type=str,
518516
help="Name of a DCA run that built all the projects. Can be repeated, with sources taken from all provided runs, "
519-
"the last provided ones having priority",
517+
"the last provided ones having priority",
520518
action="append",
521519
)
522520
parser.add_argument(

0 commit comments

Comments
 (0)