Skip to content

Update pre-commit hooks #137591

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

Merged
merged 4 commits into from
Aug 10, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ jobs:
free-threading: ${{ matrix.free-threading }}

build-windows-msi:
name: >- # ${{ '' } is a hack to nest jobs under the same sidebar category
Windows MSI${{ '' }}
# ${{ '' } is a hack to nest jobs under the same sidebar category.
name: Windows MSI${{ '' }} # zizmor: ignore[obfuscation]
needs: build-context
if: fromJSON(needs.build-context.outputs.run-windows-msi)
strategy:
Expand Down Expand Up @@ -586,8 +586,8 @@ jobs:
run: xvfb-run make ci

build-san:
name: >- # ${{ '' } is a hack to nest jobs under the same sidebar category
Sanitizers${{ '' }}
# ${{ '' } is a hack to nest jobs under the same sidebar category.
name: Sanitizers${{ '' }} # zizmor: ignore[obfuscation]
needs: build-context
if: needs.build-context.outputs.run-tests == 'true'
strategy:
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.8
rev: v0.12.8
hooks:
- id: ruff
name: Run Ruff (lint) on Doc/
args: [--exit-non-zero-on-fix]
files: ^Doc/
- id: ruff
name: Run Ruff (lint) on Lib/test/
args: [--exit-non-zero-on-fix]
args: [--exit-non-zero-on-fix, --target-version=py313]
Copy link
Member

Choose a reason for hiding this comment

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

I guess a low version was initially chosen to make backports easier?

Anyway, let's move the config to a .ruff.toml file so it also applies if running Ruff directly.

Suggested change
args: [--exit-non-zero-on-fix, --target-version=py313]
args: [--exit-non-zero-on-fix]

We have a top-level that defines target-version = "py310".

Let's override that in Lib/test/.ruff.toml, either:

  • target-version = "py313" like in Doc/.ruff.toml
  • [per-file-target-version] like in Tools/build/.ruff.toml (might be too files many to be worth it)

And we can also remove the t-string files from extend-exclude and put those under [per-file-target-version] for py314.

(Could do the same for test_grammar.py but it has some F811 errors that would need deciding about.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

files: ^Lib/test/
- id: ruff
name: Run Ruff (lint) on Tools/build/
Expand Down Expand Up @@ -42,7 +42,7 @@ repos:
exclude: ^Tools/c-analyzer/cpython/_parser.py

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
Expand All @@ -60,7 +60,7 @@ repos:
files: '^\.github/CODEOWNERS|\.(gram)$'

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.33.0
rev: 0.33.2
hooks:
- id: check-dependabot
- id: check-github-workflows
Expand All @@ -72,7 +72,7 @@ repos:
- id: actionlint

- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.6.0
rev: v1.11.0
hooks:
- id: zizmor

Expand Down
Loading