Skip to content

Commit b7fd964

Browse files
committed
pre-commit: switch to prek
The config should be backward-compatible to pre-commit, with warnings. Signed-off-by: Benjamin Gilbert <bgilbert@cs.cmu.edu>
1 parent 8590bc2 commit b7fd964

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

.github/workflows/python.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ jobs:
2828
with:
2929
python-version: '3.14'
3030
- name: Install dependencies
31-
run: python -m pip install pre-commit
31+
run: python -m pip install prek uv
3232
- name: Cache pre-commit environments
3333
uses: actions/cache@v5
3434
with:
35-
path: ~/.cache/pre-commit
36-
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
35+
path: ~/.cache/prek
36+
key: prek|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
3737
- name: Run pre-commit hooks
38-
run: pre-commit run -a --show-diff-on-failure --color=always
38+
run: prek run -a --show-diff-on-failure --color=always
3939
- name: Define artifact paths
4040
id: paths
4141
run: |

.pre-commit-config.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# priorities:
2+
# 0 - read-only
3+
# 1000 - mutually non-conflicting fixers
4+
# none - other fixers
5+
16
# exclude vendored files
27
exclude: '^(COPYING\.LESSER|examples/deepzoom/static/.*\.js)$'
38

@@ -6,10 +11,15 @@ repos:
611
rev: v6.0.0
712
hooks:
813
- id: check-added-large-files
14+
priority: 0
915
- id: check-merge-conflict
16+
priority: 0
1017
- id: check-toml
18+
priority: 0
1119
- id: check-vcs-permalinks
20+
priority: 0
1221
- id: check-yaml
22+
priority: 0
1323
- id: end-of-file-fixer
1424
- id: fix-byte-order-marker
1525
- id: mixed-line-ending
@@ -28,6 +38,7 @@ repos:
2838
hooks:
2939
- id: mypy
3040
name: Check Python types
41+
priority: 0
3142
# Pillow is ignored in dependabot.yml
3243
additional_dependencies: [flask, openslide-bin, pillow >= 12.1.0, types-PyYAML, types-setuptools]
3344

@@ -36,32 +47,38 @@ repos:
3647
hooks:
3748
- id: rstcheck
3849
name: Validate reStructuredText syntax
50+
priority: 0
3951
additional_dependencies: [sphinx, toml]
4052

4153
- repo: https://github.com/codespell-project/codespell
4254
rev: v2.4.2
4355
hooks:
4456
- id: codespell
4557
name: Check spelling with codespell
58+
priority: 0
4659
additional_dependencies:
4760
- tomli # Python < 3.11
4861

4962
- repo: meta
5063
hooks:
5164
- id: check-hooks-apply
65+
priority: 0
5266
- id: check-useless-excludes
67+
priority: 0
5368

5469
- repo: local
5570
hooks:
5671
- id: mkmaintainer
5772
name: Sync maintainer issue templates
73+
priority: 1000
5874
entry: .github/maintainer/mkmaintainer.py
5975
files: .github/maintainer/
6076
language: python
6177
additional_dependencies: [PyYAML]
6278

6379
- id: annotations
6480
name: Require "from __future__ import annotations"
81+
priority: 0
6582
language: pygrep
6683
types: [python]
6784
# exclude config-like files

0 commit comments

Comments
 (0)