Skip to content

Commit ed0c648

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 ed0c648

File tree

4 files changed

+19
-60
lines changed

4 files changed

+19
-60
lines changed

.github/workflows/lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ 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

@@ -47,7 +47,7 @@ jobs:
4747
completion-lint:
4848
needs: build
4949
runs-on: ubuntu-latest
50-
if: always() # Run even if one matrix job fails
50+
if: always() # Run even if one matrix job fails
5151
steps:
5252
- name: Check matrix job status
5353
run: |-

.pre-commit-config.yaml

Lines changed: 9 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,14 @@
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
5+
6+
467

478
default_install_hook_types: [pre-commit, pre-push, commit-msg]
489

4910
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
11+
- repo: builtin
5612
hooks:
5713
- id: check-added-large-files
5814
stages: [pre-commit]
@@ -76,11 +32,14 @@ repos:
7632
stages: [pre-commit]
7733
- id: end-of-file-fixer
7834
stages: [pre-commit]
35+
- id: trailing-whitespace
36+
stages: [pre-commit]
37+
- repo: https://github.com/pre-commit/pre-commit-hooks
38+
rev: v6.0.0
39+
hooks:
7940
- id: file-contents-sorter
8041
files: spelling_private_dict\.txt$
8142
stages: [pre-commit]
82-
- id: trailing-whitespace
83-
stages: [pre-commit]
8443
- repo: https://github.com/pre-commit/pygrep-hooks
8544
rev: v1.10.0
8645
hooks:

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)