Skip to content

Commit 7aed223

Browse files
committed
Replace pre-commit with prek
Replace the pre-commit hook manager with prek, a faster Rust-based alternative that's fully compatible with existing pre-commit configurations. Changes: - Updated pyproject.toml to use prek instead of pre-commit - Renamed pixi tasks from pre-commit/pre-commit-update to prek/prek-update - Updated GitHub Actions workflow to use j178/prek-action@v1 - Renamed workflow file from pre-commit.yaml to prek.yaml - Updated documentation in README.md and .claude/README.md - Updated SessionStart hook to install prek hooks - Updated dependabot.yml to track prek instead of pre-commit The .pre-commit-config.yaml file remains unchanged as prek uses the same configuration format.
1 parent aae1e74 commit 7aed223

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

.claude/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The `hooks/SessionStart` script automatically runs when a new Claude Code sessio
88

99
1. **Installs pixi** (if not already installed) - The package and environment manager
1010
2. **Installs project dependencies** - All Python packages and tools defined in `pyproject.toml`
11-
3. **Sets up pre-commit hooks** - For automatic code quality checks
11+
3. **Sets up prek hooks** - For automatic code quality checks
1212
4. **Configures git** - Sets up merge drivers for lockfiles
1313

1414
## Usage with Claude Code Online
@@ -29,9 +29,9 @@ Once setup is complete, Claude can use these pixi tasks:
2929
- `pixi run ci` - Run full CI pipeline (format, lint, test, coverage)
3030
- `pixi run fix` - Auto-fix common issues (update lock, format, lint)
3131

32-
#### Pre-commit
33-
- `pixi run pre-commit` - Run all pre-commit hooks
34-
- `pixi run pre-commit-update` - Update pre-commit hook versions
32+
#### Prek Hooks
33+
- `pixi run prek` - Run all prek hooks
34+
- `pixi run prek-update` - Update prek hook versions
3535

3636
### How It Works
3737

@@ -45,7 +45,7 @@ If you encounter issues:
4545

4646
1. **Dependencies not found**: Run `pixi install` manually
4747
2. **Lockfile conflicts**: Run `pixi run update-lock`
48-
3. **Pre-commit issues**: Run `pixi run pre-commit-update`
48+
3. **Prek issues**: Run `pixi run prek-update`
4949
4. **Full reset**: Delete `.pixi` directory and restart session
5050

5151
### Customization

.claude/hooks/SessionStart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ export PATH="$HOME/.pixi/bin:$PATH"
2929
echo "📦 Installing project dependencies..."
3030
pixi install
3131

32-
# Run pre-commit installation
33-
echo "🔧 Setting up pre-commit hooks..."
34-
pixi run pre-commit install || echo "⚠️ Pre-commit installation skipped (optional)"
32+
# Run prek installation
33+
echo "🔧 Setting up prek hooks..."
34+
pixi run prek install || echo "⚠️ Prek installation skipped (optional)"
3535

3636
# Set up git merge driver for lockfiles
3737
echo "🔧 Configuring git merge driver..."

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ updates:
1414
#try to group all development dependencies updates into a single pr
1515
patterns:
1616
- "check-manifest"
17-
- "pre-commit"
17+
- "prek"
1818
- "pylint"
1919
- "pytest"
2020
- "pytest-cov"
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: pre-commit
1+
name: prek
22

33
on: [pull_request]
44

55
jobs:
6-
pre-commit:
6+
prek:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v6
10-
- uses: pre-commit/action@v3.0.1
10+
- uses: j178/prek-action@v1

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ This template includes built-in support for [Claude Code](https://docs.claude.co
4242

4343
- Installs pixi package manager
4444
- Sets up all project dependencies
45-
- Configures pre-commit hooks
45+
- Configures prek hooks
4646
- Prepares the development environment
4747

4848
**Quick Start with Claude Code:**

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ test = [
4141
"hypothesis>=6.104.2,<=6.150.2",
4242
"ruff>=0.5.0,<=0.14.11",
4343
"coverage>=7.5.4,<=7.13.1",
44-
"pre-commit<=4.5.1",
44+
"prek>=0.13.0",
4545
"ty>=0.0.8,<=0.0.8",
4646
]
4747

@@ -66,8 +66,8 @@ dev = { cmd = "devpod up . --ide none && ssh pythontemplate.devpod", depends-on
6666
dev-vs = { cmd = "devpod up . --ide vscode", depends-on = ["dev-add-docker"] }
6767
dev-restart = { cmd = "devpod up . --recreate --ide none && ssh pythontemplate.devpod", depends-on = ["dev-add-docker"] }
6868
dev-restart-vs = { cmd = "devpod up . --recreate --ide vscode", depends-on = ["dev-add-docker"] }
69-
pre-commit = "pre-commit run -a"
70-
pre-commit-update = "pre-commit autoupdate"
69+
prek = "prek run -a"
70+
prek-update = "prek autoupdate"
7171
format = "ruff format ."
7272
check-clean-workspace = "git diff --exit-code"
7373
ruff-lint = "ruff check . --fix"
@@ -82,7 +82,7 @@ coverage-report = "coverage report -m"
8282
update-lock = "pixi update && git commit -a -m'update pixi.lock' || true"
8383
push = "git push"
8484
update-lock-push = { depends-on = ["update-lock", "push"] }
85-
fix = { depends-on = ["update-lock", "format", "ruff-lint", "pre-commit"] }
85+
fix = { depends-on = ["update-lock", "format", "ruff-lint", "prek"] }
8686
fix-commit-push = { depends-on = ["fix", "commit-format", "update-lock-push"] }
8787
ci-no-cover = { depends-on = ["style", "test"] }
8888
ci = { depends-on = [

0 commit comments

Comments
 (0)