Skip to content

Commit 50e72b8

Browse files
committed
Switch from pre-commit to prek
- Replace pre-commit with prek in pyproject.toml dev dependencies - Update .pre-commit-config.yaml to use prek builtin hooks - Remove pre-commit CI configuration (ci: section) - Update GitHub Actions workflow to use prek commands - Update contributing documentation for prek
1 parent 48729a8 commit 50e72b8

File tree

4 files changed

+41
-75
lines changed

4 files changed

+41
-75
lines changed

.github/workflows/lint.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,16 @@ jobs:
3535

3636
- name: Lint
3737
run: |
38-
uv run --extra=dev pre-commit run --all-files --hook-stage pre-commit --verbose
39-
uv run --extra=dev pre-commit run --all-files --hook-stage pre-push --verbose
40-
uv run --extra=dev pre-commit run --all-files --hook-stage manual --verbose
38+
uv run --extra=dev prek run --all-files --hook-stage pre-commit --verbose
39+
uv run --extra=dev prek run --all-files --hook-stage pre-push --verbose
40+
uv run --extra=dev prek run --all-files --hook-stage manual --verbose
4141
env:
4242
UV_PYTHON: ${{ matrix.python-version }}
4343

44-
- uses: pre-commit-ci/lite-action@v1.1.0
45-
if: always()
46-
4744
completion-lint:
4845
needs: build
4946
runs-on: ubuntu-latest
50-
if: always() # Run even if one matrix job fails
47+
if: always() # Run even if one matrix job fails
5148
steps:
5249
- name: Check matrix job status
5350
run: |-

.pre-commit-config.yaml

Lines changed: 31 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,12 @@
11
---
22
fail_fast: true
33

4-
# See https://pre-commit.com for more information
5-
# See https://pre-commit.com/hooks.html for more hooks
6-
7-
ci:
8-
# We use system Python, with required dependencies specified in pyproject.toml.
9-
# We therefore cannot use those dependencies in pre-commit CI.
10-
skip:
11-
- actionlint
12-
- sphinx-lint
13-
- check-manifest
14-
- deptry
15-
- doc8
16-
- docformatter
17-
- docs
18-
- interrogate
19-
- interrogate-docs
20-
- linkcheck
21-
- mypy
22-
- mypy-docs
23-
- pylint
24-
- pyproject-fmt-fix
25-
- pyright
26-
- pyright-docs
27-
- pyright-verifytypes
28-
- ty
29-
- ty-docs
30-
- pyroma
31-
- ruff-check-fix
32-
- ruff-check-fix-docs
33-
- ruff-format-fix
34-
- ruff-format-fix-docs
35-
- shellcheck
36-
- shellcheck-docs
37-
- shfmt
38-
- shfmt-docs
39-
- spelling
40-
- vulture
41-
- vulture-docs
42-
- yamlfix
43-
- zizmor
44-
- pyrefly
45-
- pyrefly-docs
4+
# See https://prek.j178.dev for more information
465

476
default_install_hook_types: [pre-commit, pre-push, commit-msg]
487

498
repos:
50-
- repo: meta
51-
hooks:
52-
- id: check-useless-excludes
53-
stages: [pre-commit]
54-
- repo: https://github.com/pre-commit/pre-commit-hooks
55-
rev: v6.0.0
9+
- repo: builtin
5610
hooks:
5711
- id: check-added-large-files
5812
stages: [pre-commit]
@@ -76,11 +30,14 @@ repos:
7630
stages: [pre-commit]
7731
- id: end-of-file-fixer
7832
stages: [pre-commit]
33+
- id: trailing-whitespace
34+
stages: [pre-commit]
35+
- repo: https://github.com/pre-commit/pre-commit-hooks
36+
rev: v6.0.0
37+
hooks:
7938
- id: file-contents-sorter
8039
files: spelling_private_dict\.txt$
8140
stages: [pre-commit]
82-
- id: trailing-whitespace
83-
stages: [pre-commit]
8441
- repo: https://github.com/pre-commit/pygrep-hooks
8542
rev: v1.10.0
8643
hooks:
@@ -122,7 +79,8 @@ repos:
12279

12380
- id: shellcheck-docs
12481
name: shellcheck-docs
125-
entry: uv run --extra=dev doccmd --no-write-to-file --example-workers 0 --language=shell
82+
entry:
83+
uv run --extra=dev doccmd --no-write-to-file --example-workers 0 --language=shell
12684
--language=console --command="shellcheck --shell=bash"
12785
language: python
12886
types_or: [markdown, rst]
@@ -139,7 +97,8 @@ repos:
13997

14098
- id: shfmt-docs
14199
name: shfmt-docs
142-
entry: uv run --extra=dev doccmd --language=shell --language=console --skip-marker=shfmt
100+
entry:
101+
uv run --extra=dev doccmd --language=shell --language=console --skip-marker=shfmt
143102
--no-pad-file --command="shfmt --write --space-redirects --indent=4"
144103
language: python
145104
types_or: [markdown, rst]
@@ -158,7 +117,8 @@ repos:
158117
- id: mypy-docs
159118
name: mypy-docs
160119
stages: [pre-push]
161-
entry: uv run --extra=dev doccmd --no-write-to-file --example-workers 0 --language=python
120+
entry:
121+
uv run --extra=dev doccmd --no-write-to-file --example-workers 0 --language=python
162122
--command="mypy"
163123
language: python
164124
types_or: [markdown, rst]
@@ -184,7 +144,8 @@ repos:
184144
- id: pyright-docs
185145
name: pyright-docs
186146
stages: [pre-push]
187-
entry: uv run --extra=dev doccmd --no-write-to-file --example-workers 0 --language=python
147+
entry:
148+
uv run --extra=dev doccmd --no-write-to-file --example-workers 0 --language=python
188149
--command="pyright"
189150
language: python
190151
types_or: [markdown, rst]
@@ -201,7 +162,8 @@ repos:
201162

202163
- id: vulture-docs
203164
name: vulture docs
204-
entry: uv run --extra=dev doccmd --no-write-to-file --example-workers 0 --language=python
165+
entry:
166+
uv run --extra=dev doccmd --no-write-to-file --example-workers 0 --language=python
205167
--command="vulture"
206168
language: python
207169
types_or: [markdown, rst]
@@ -235,7 +197,8 @@ repos:
235197

236198
- id: pylint-docs
237199
name: pylint-docs
238-
entry: uv run --extra=dev doccmd --no-write-to-file --example-workers 0 --language=python
200+
entry:
201+
uv run --extra=dev doccmd --no-write-to-file --example-workers 0 --language=python
239202
--command="pylint"
240203
language: python
241204
stages: [manual]
@@ -268,7 +231,8 @@ repos:
268231

269232
- id: ruff-format-fix-docs
270233
name: Ruff format docs
271-
entry: uv run --extra=dev doccmd --language=python --no-pad-file --command="ruff
234+
entry:
235+
uv run --extra=dev doccmd --language=python --no-pad-file --command="ruff
272236
format"
273237
language: python
274238
types_or: [markdown, rst]
@@ -293,7 +257,8 @@ repos:
293257

294258
- id: interrogate-docs
295259
name: interrogate docs
296-
entry: uv run --extra=dev doccmd --no-write-to-file --example-workers 0 --language=python
260+
entry:
261+
uv run --extra=dev doccmd --no-write-to-file --example-workers 0 --language=python
297262
--command="interrogate"
298263
language: python
299264
types_or: [markdown, rst]
@@ -311,7 +276,8 @@ repos:
311276

312277
- id: linkcheck
313278
name: linkcheck
314-
entry: uv run --extra=dev sphinx-build -M linkcheck docs/source docs/build
279+
entry:
280+
uv run --extra=dev sphinx-build -M linkcheck docs/source docs/build
315281
-W
316282
language: python
317283
types_or: [rst]
@@ -321,7 +287,8 @@ repos:
321287

322288
- id: spelling
323289
name: spelling
324-
entry: uv run --extra=dev sphinx-build -M spelling docs/source docs/build
290+
entry:
291+
uv run --extra=dev sphinx-build -M spelling docs/source docs/build
325292
-W
326293
language: python
327294
types_or: [rst]
@@ -358,7 +325,8 @@ repos:
358325
- id: ty-docs
359326
name: ty-docs
360327
stages: [pre-push]
361-
entry: uv run --extra=dev doccmd --no-write-to-file --example-workers 0 --language=python
328+
entry:
329+
uv run --extra=dev doccmd --no-write-to-file --example-workers 0 --language=python
362330
--command="ty check"
363331
language: python
364332
types_or: [markdown, rst]
@@ -401,7 +369,8 @@ repos:
401369
- id: pyrefly-docs
402370
name: pyrefly-docs
403371
stages: [pre-push]
404-
entry: uv run --extra=dev doccmd --no-write-to-file --example-workers 0 --language=python
372+
entry:
373+
uv run --extra=dev doccmd --no-write-to-file --example-workers 0 --language=python
405374
--command="pyrefly check"
406375
language: python
407376
types_or: [markdown, rst]

docs/source/contributing.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ and on Ubuntu with ``apt``:
2727
2828
$ apt-get install -y enchant
2929
30-
Install ``pre-commit`` hooks:
30+
Install ``prek`` hooks:
3131

3232
.. code-block:: console
3333
34-
$ pre-commit install
34+
$ prek install
3535
3636
Linting
3737
-------
@@ -40,9 +40,9 @@ Run lint tools either by committing, or with:
4040

4141
.. code-block:: console
4242
43-
$ pre-commit run --all-files --hook-stage pre-commit --verbose
44-
$ pre-commit run --all-files --hook-stage pre-push --verbose
45-
$ pre-commit run --all-files --hook-stage manual --verbose
43+
$ prek run --all-files --hook-stage pre-commit --verbose
44+
$ prek run --all-files --hook-stage pre-push --verbose
45+
$ prek run --all-files --hook-stage manual --verbose
4646
4747
.. _Homebrew: https://brew.sh
4848

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ optional-dependencies.dev = [
4848
"interrogate==1.7.0",
4949
"mypy[faster-cache]==1.19.1",
5050
"mypy-strict-kwargs==2025.4.3",
51-
"pre-commit==4.5.1",
51+
"prek==0.2.25",
5252
"pydocstyle==6.3",
5353
"pygments==2.19.2",
5454
"pylint[spelling]==4.0.4",

0 commit comments

Comments
 (0)