Skip to content

Commit b95ff2c

Browse files
authored
⬆️ Update prek checks (#317)
## Description This PR updates `.pre-commit-config.yml` to make use of `prek`'s priority feature. Furthermore, it removes the extensive Python tests as the used matrix now largely overlaps with the default one, adding no substantive value. ## Checklist: - [x] The pull request only contains commits that are focused and relevant to this change. - [x] ~I have added appropriate tests that cover the new/changed functionality.~ - [x] ~I have updated the documentation to reflect these changes.~ - [x] ~I have added entries to the changelog for any noteworthy additions, changes, fixes, or removals.~ - [x] ~I have added migration instructions to the upgrade guide (if needed).~ - [x] The changes follow the project's style guidelines and introduce no new warnings. - [x] The changes are fully tested and pass the CI checks. - [x] I have reviewed my own code changes.
1 parent 3a7bc14 commit b95ff2c

File tree

5 files changed

+89
-104
lines changed

5 files changed

+89
-104
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,6 @@ jobs:
3737
contents: read
3838
id-token: write
3939

40-
python-tests-extensive:
41-
name: 🐍 Test (Extensive)
42-
needs: change-detection
43-
if: fromJSON(needs.change-detection.outputs.run-python-tests) && github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'extensive-python-ci')
44-
strategy:
45-
fail-fast: false
46-
matrix:
47-
runs-on: [ubuntu-22.04, ubuntu-22.04-arm, macos-15, windows-2025]
48-
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-python-tests.yml@d6314c45667c131055a0389afc110e8dedc6da3f # v1.17.11
49-
with:
50-
runs-on: ${{ matrix.runs-on }}
51-
5240
python-linter:
5341
name: 🐍 Lint
5442
needs: change-detection
@@ -78,11 +66,10 @@ jobs:
7866
- change-detection
7967
- python-tests
8068
- python-coverage
81-
- python-tests-extensive
8269
- python-linter
8370
- build-sdist
8471
- build-wheel
85-
runs-on: ubuntu-latest
72+
runs-on: ubuntu-slim
8673
steps:
8774
- name: Decide whether the needed jobs succeeded or failed
8875
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
@@ -92,10 +79,6 @@ jobs:
9279
fromJSON(needs.change-detection.outputs.run-python-tests)
9380
&& '' || 'python-tests,python-coverage,python-linter,'
9481
}}
95-
${{
96-
fromJSON(needs.change-detection.outputs.run-python-tests) && github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'extensive-python-ci')
97-
&& '' || 'python-tests-extensive,'
98-
}}
9982
${{
10083
fromJSON(needs.change-detection.outputs.run-cd)
10184
&& '' || 'build-sdist,build-wheel,'

.github/workflows/release-drafter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
permissions:
1515
contents: write
1616
pull-requests: write
17-
runs-on: ubuntu-latest
17+
runs-on: ubuntu-slim
1818
steps:
1919
- uses: release-drafter/release-drafter@6db134d15f3909ccc9eefd369f02bd1e9cffdf97 # v6.2.0
2020
env:

.github/workflows/templating.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
jobs:
99
render-template:
1010
name: Render template
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-slim
1212
permissions:
1313
contents: write
1414
pull-requests: write

.pre-commit-config.yaml

Lines changed: 85 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# To run all pre-commit checks, use:
22
#
3-
# pre-commit run -a
3+
# uvx prek run -a
44
#
55
# To install pre-commit hooks that run every time you commit:
66
#
7-
# pre-commit install
7+
# uv tool install prek
8+
# prek install
89
#
910

1011
ci:
@@ -14,120 +15,75 @@ ci:
1415
skip: [ty-check]
1516

1617
repos:
17-
# Standard hooks
18+
# Priority 0: Fast validation and independent fixers
19+
20+
## Standard hooks
1821
- repo: https://github.com/pre-commit/pre-commit-hooks
1922
rev: v6.0.0
2023
hooks:
21-
- id: check-added-large-files
22-
args: ["--maxkb=2048"]
23-
- id: check-case-conflict
24-
- id: check-vcs-permalinks
2524
- id: check-merge-conflict
26-
- id: check-symlinks
27-
- id: check-json
28-
- id: check-toml
29-
- id: check-yaml
30-
- id: debug-statements
25+
priority: 0
3126
- id: end-of-file-fixer
32-
- id: mixed-line-ending
27+
priority: 1
3328
- id: trailing-whitespace
29+
priority: 1
3430

35-
# Handling unwanted unicode characters
36-
- repo: https://github.com/sirosen/texthooks
37-
rev: 0.7.1
38-
hooks:
39-
- id: fix-ligatures
40-
- id: fix-smartquotes
41-
42-
# Check for common mistakes
43-
- repo: https://github.com/pre-commit/pygrep-hooks
44-
rev: v1.10.0
45-
hooks:
46-
- id: rst-backticks
47-
- id: rst-directive-colons
48-
- id: rst-inline-touching-normal
49-
50-
# Ensure uv lock file is up-to-date
51-
- repo: https://github.com/astral-sh/uv-pre-commit
52-
rev: 0.9.28
53-
hooks:
54-
- id: uv-lock
55-
56-
# Python linting using ruff
57-
- repo: https://github.com/astral-sh/ruff-pre-commit
58-
rev: v0.14.14
59-
hooks:
60-
- id: ruff-check
61-
- id: ruff-format
62-
63-
# Static type checking using ty
64-
- repo: local
65-
hooks:
66-
- id: ty-check
67-
name: ty check
68-
entry: uv run ty check
69-
language: system
70-
require_serial: true
71-
types_or: [python, pyi, jupyter]
72-
exclude: ^(docs/)
73-
74-
# Also run Black on examples in the documentation
75-
- repo: https://github.com/adamchainz/blacken-docs
76-
rev: 1.20.0
31+
## Check the pyproject.toml file
32+
- repo: https://github.com/henryiii/validate-pyproject-schema-store
33+
rev: 2026.01.22
7734
hooks:
78-
- id: blacken-docs
79-
additional_dependencies: [black==25.*]
35+
- id: validate-pyproject
36+
priority: 0
8037

81-
# Check for license headers
82-
- repo: https://github.com/emzeat/mz-lictools
83-
rev: v2.9.0
38+
## Check JSON schemata
39+
- repo: https://github.com/python-jsonschema/check-jsonschema
40+
rev: 0.36.1
8441
hooks:
85-
- id: license-tools
42+
- id: check-github-workflows
43+
priority: 0
44+
- id: check-readthedocs
45+
priority: 0
8646

87-
# Catch common capitalization mistakes
47+
## Catch common capitalization mistakes
8848
- repo: local
8949
hooks:
9050
- id: disallow-caps
9151
name: Disallow improper capitalization
9252
language: pygrep
93-
entry: PyBind|Numpy|Cmake|CCache|Github|PyTest|Mqt|Tum
94-
exclude: .pre-commit-config.yaml
95-
96-
# Format configuration files with prettier
97-
- repo: https://github.com/rbubley/mirrors-prettier
98-
rev: v3.8.1
99-
hooks:
100-
- id: prettier
101-
types_or: [yaml, markdown, html, css, scss, javascript, json]
53+
entry: \b(Numpy|Github|PyTest|Mqt|Tum)\b
54+
exclude: ^(\.pre-commit-config\.yaml)$
55+
priority: 0
10256

103-
# Check for spelling
57+
## Check for spelling
10458
- repo: https://github.com/adhtruong/mirrors-typos
10559
rev: v1.42.3
10660
hooks:
10761
- id: typos
62+
priority: 0
10863

109-
# Check best practices for scientific Python code
64+
## Check best practices for scientific Python code
11065
- repo: https://github.com/scientific-python/cookie
11166
rev: 2025.11.21
11267
hooks:
11368
- id: sp-repo-review
11469
additional_dependencies: ["repo-review[cli]"]
70+
priority: 0
11571

116-
# Check JSON schemata
117-
- repo: https://github.com/python-jsonschema/check-jsonschema
118-
rev: 0.36.1
72+
## Check for license headers
73+
- repo: https://github.com/emzeat/mz-lictools
74+
rev: v2.9.0
11975
hooks:
120-
- id: check-dependabot
121-
- id: check-github-workflows
122-
- id: check-readthedocs
76+
- id: license-tools
77+
priority: 0
12378

124-
# Check the pyproject.toml file
125-
- repo: https://github.com/henryiii/validate-pyproject-schema-store
126-
rev: 2026.01.22
79+
## Ensure uv lock file is up-to-date
80+
- repo: https://github.com/astral-sh/uv-pre-commit
81+
rev: 0.9.28
12782
hooks:
128-
- id: validate-pyproject
83+
- id: uv-lock
84+
priority: 0
12985

130-
# Tidy up BibTeX files
86+
## Tidy up BibTeX files
13187
- repo: https://github.com/FlamingTempura/bibtex-tidy
13288
rev: v1.14.0
13389
hooks:
@@ -144,3 +100,48 @@ repos:
144100
"--trailing-commas",
145101
"--remove-empty-fields",
146102
]
103+
priority: 0
104+
105+
# Priority 1: Second-pass fixers
106+
107+
## Format configuration files with prettier
108+
- repo: https://github.com/rbubley/mirrors-prettier
109+
rev: v3.8.1
110+
hooks:
111+
- id: prettier
112+
types_or: [yaml, markdown, html, css, scss, javascript, json]
113+
priority: 1
114+
115+
## Python linting using ruff
116+
- repo: https://github.com/astral-sh/ruff-pre-commit
117+
rev: v0.14.14
118+
hooks:
119+
- id: ruff-format
120+
priority: 1
121+
- id: ruff-check
122+
require_serial: true
123+
priority: 2
124+
125+
# Priority 2+: Final checks and fixers
126+
127+
## Also run Black on examples in the documentation (needs to run after ruff format)
128+
- repo: https://github.com/adamchainz/blacken-docs
129+
rev: 1.20.0
130+
hooks:
131+
- id: blacken-docs
132+
language: python
133+
additional_dependencies: [black==26.*]
134+
priority: 2
135+
136+
## Static type checking using ty (needs to run after lockfile update/ruff format, and ruff lint)
137+
- repo: local
138+
hooks:
139+
- id: ty-check
140+
name: ty check
141+
entry: uv run ty check
142+
language: unsupported
143+
require_serial: true
144+
types_or: [python, pyi, jupyter]
145+
exclude: ^(docs/)
146+
pass_filenames: false
147+
priority: 3

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ ignore = [
130130
"MY100", # We use ty instead of mypy
131131
"PC140", # We use ty instead of mypy
132132
"PC160", # We use a mirror of crate-ci/typos
133+
"PC170", # We do not use rST files anymore
133134
]
134135

135136

0 commit comments

Comments
 (0)