Skip to content

Commit c7d5702

Browse files
authored
Switch from pre-commit to prek (#4082)
Better `pre-commit`, re-engineered in Rust. https://prek.j178.dev/
1 parent 66c405c commit c7d5702

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

.github/workflows/format-command.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
# Install formatting tools
3939
- name: Install formatting tools
4040
run: |
41-
python -m pip install ruff pre-commit
41+
python -m pip install ruff prek
4242
python -m pip list
4343
4444
# Run "make format" and commit the change to the PR branch

.github/workflows/style_checks.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ jobs:
3838

3939
- name: Install packages
4040
run: |
41-
python -m pip install ruff pre-commit
41+
python -m pip install ruff prek
4242
python -m pip list
4343
44-
- name: Formatting check (ruff + pre-commit)
44+
- name: Formatting check (ruff + prek)
4545
run: |
4646
make check
47-
pre-commit run --all-files
47+
prek run --all-files
4848
4949
- name: Ensure example scripts have at least one code block separator
5050
run: |

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ test_no_images: _runtest
6161
format:
6262
ruff check --fix --exit-zero $(FORMAT_FILES)
6363
ruff format $(FORMAT_FILES)
64-
pre-commit run --all-files
64+
prek run --all-files
6565

6666
check:
6767
ruff check $(FORMAT_FILES)

doc/contributing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,10 +481,10 @@ the code yourself. Before committing, run it to automatically format your code:
481481
make format
482482
```
483483

484-
For consistency, we also use `pre-commit` hooks to enforce UNIX-style line endings
485-
(`\n`) and file permission 644 (`-rw-r--r--`) throughout the whole project.
486-
Don't worry if you forget to do it. Our continuous integration systems will
487-
warn us and you can make a new commit with the formatted code.
484+
For consistency, we also use `pre-commit` hooks (via [`prek`](https://prek.j178.dev/))
485+
to enforce UNIX-style line endings (`\n`) and file permission 644 (`-rw-r--r--`)
486+
throughout the whole project. Don't worry if you forget to do it. Our continuous
487+
integration systems will warn us and you can make a new commit with the formatted code.
488488
Even better, you can just write `/format` in the first line of any comment in a
489489
pull request to lint the code automatically.
490490

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ dependencies:
2525
- python-build
2626
# Dev dependencies (style checks)
2727
- codespell
28-
- pre-commit
28+
- prek
2929
- ruff>=0.12.0
3030
# Dev dependencies (unit testing)
3131
- matplotlib-base

0 commit comments

Comments
 (0)