Skip to content

Commit 431ed26

Browse files
Copilotnstarman
andauthored
Replace pre-commit with prek for improved linting performance (#110)
* chore: switch from pre-commit to prek * style: prettier format CONTRIBUTING.md * refactor: rename precommit nox session to prek_session and fix prek install docs * Apply suggestions from code review Signed-off-by: Nathaniel Starkman <nstarman@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Nathaniel Starkman <nstarman@users.noreply.github.com>
1 parent 7c17ab1 commit 431ed26

5 files changed

Lines changed: 37 additions & 56 deletions

File tree

‎.github/CONTRIBUTING.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ py -m install -v -e .[dev]
4747

4848
# Pre-commit
4949

50-
You should prepare pre-commit, which will help you by checking that commits pass
50+
You should prepare prek, which will help you by checking that commits pass
5151
required checks:
5252

5353
```bash
54-
pip install pre-commit # or brew install pre-commit on macOS
55-
pre-commit install # Will install a pre-commit hook into the git repo
54+
pipx install prek
55+
prek install # Will install a prek hook into the git repo
5656
```
5757

58-
You can also/alternatively run `pre-commit run` (changes only) or
59-
`pre-commit run --all-files` to check even without installing the hook.
58+
You can also/alternatively run `prek run` (changes only) or
59+
`prek run --all-files` to check even without installing the hook.
6060

6161
# Testing
6262

‎CONTRIBUTING.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ management and [`nox`](https://nox.thea.codes/) to run common tasks.
6060
on each commit:
6161

6262
```bash
63-
uv run pre-commit install
63+
uv run prek install
6464
```
6565

6666
## Making changes
@@ -100,7 +100,7 @@ you:
100100
# Run the test suite
101101
uv run nox -s pytest
102102

103-
# Run linters and type checks (pre-commit + pylint)
103+
# Run linters and type checks (prek + pylint)
104104
uv run nox -s lint
105105

106106
# Build the documentation
@@ -117,7 +117,7 @@ If you prefer to run the tools directly within the synced environment:
117117

118118
```bash
119119
uv run pytest
120-
uv run pre-commit run --all-files
120+
uv run prek run --all-files
121121
```
122122

123123
### A note on test data

‎noxfile.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
@session(uv_groups=["lint"], reuse_venv=True)
2020
def lint(s: nox.Session, /) -> None:
2121
"""Run the linter."""
22-
precommit(s) # reuse pre-commit session
22+
precommit(s) # reuse prek session
2323
pylint(s) # reuse pylint session
2424

2525

2626
@session(uv_groups=["lint"], reuse_venv=True)
2727
def precommit(s: nox.Session, /) -> None:
28-
"""Run pre-commit."""
29-
s.run("pre-commit", "run", "--all-files", *s.posargs)
28+
"""Run prek."""
29+
s.run("prek", "run", "--all-files", *s.posargs)
3030

3131

3232
@session(uv_groups=["lint"], reuse_venv=True)

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ docs = [
6666
"sphinx_design>=0.5.0",
6767
]
6868
lint = [
69-
"pre-commit>=4.5.0",
69+
"prek>=0.4.0",
7070
"pylint==4.0.4",
7171
]
7272
nox = [

‎uv.lock‎

Lines changed: 25 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)