Run git hooks as shell commands from pyproject.toml
Project description
prehook
Run git hooks configured in pyproject.toml using uv.
Usage
-
Install (one-time):
uvx prehook install
Use
--forceto overwrite existing git hooks. -
Update hooks in
pyproject.toml:[tool.prehook] hooks = [ "uvx ruff check", "uvx ruff format", ]
-
Commit:
git commit -m "unfinished commit"
To run hooks manually:
uvx prehook run
To uninstall:
uvx prehook uninstall
Configuration
Each hook can have a name, target git hook type, and other options:
[tool.prehook]
hooks = [
{ name = "lint", run = "uvx ruff check --fix" },
{ name = "format", run = "uvx ruff format" },
{ name = "typecheck", run = "uvx pyright" },
{ name = "test", run = "pytest", on = ["pre-push"] },
]
| Key | Default | Description |
|---|---|---|
run |
required | Command to execute. |
name |
derived from command | Label for output and SKIP. |
on |
["pre-commit"] |
Which git hook types to run on. |
verbose |
false |
Show output even on success. |
uvx prehook install installs hooks for all supported git hook types, so adding new on values works without reinstalling.
Skipping hooks
SKIP=typecheck git commit -m "wip" # skip by name
SKIP=lint,typecheck git commit -m "wip" # skip multiple
git commit --no-verify -m "wip" # skip all
Parallel and fail fast
[tool.prehook]
parallel = true
fail_fast = true
hooks = [
{ name = "lint+format", run = "uvx ruff check --fix && uvx ruff format" },
{ name = "typecheck", run = "uvx pyright" },
]
| Key | Default | Description |
|---|---|---|
fail_fast |
false |
Stop after first failure. |
parallel |
false |
Run all hooks concurrently. |
Both can be overridden from the CLI:
uvx prehook run --parallel --fail-fast
Why?
I used pre-commit for a long time, and it's a great tool.
But I prefer less configuration files, and for most projects I just want a quick:
uvx ruff check
uvx ruff format
Which are fast enough to always run on all files (rather than just staged ones).
Alternatives
If this tool doesn't do what you need, these are worth a look:
| Tool | Config | What it does well |
|---|---|---|
| pre-commit | .pre-commit-config.yaml |
Huge ecosystem of ready-made hooks, multi-language virtualenv management. |
| lefthook | lefthook.yml |
Fast, language-agnostic, great parallel execution. |
| prek | prek.toml |
Compatible with pre-commit configs, written in Rust, parallel execution. |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prehook-0.5.0.tar.gz.
File metadata
- Download URL: prehook-0.5.0.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4180a7e31a15bf62d90695f603145f8860f73871a1609d247752e489de9fef6d
|
|
| MD5 |
cdb2a8630fc5af874bfe6a2aeaf367a4
|
|
| BLAKE2b-256 |
dca961434645f5e6e8647431b843c05710e463d88e8a7ee60b0faf33ee096862
|
Provenance
The following attestation bundles were made for prehook-0.5.0.tar.gz:
Publisher:
release.yml on scriptogre/prehook
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prehook-0.5.0.tar.gz -
Subject digest:
4180a7e31a15bf62d90695f603145f8860f73871a1609d247752e489de9fef6d - Sigstore transparency entry: 1818646893
- Sigstore integration time:
-
Permalink:
scriptogre/prehook@831ba03d9ab0ce1b0ddc3704540380ea6fc6004e -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/scriptogre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@831ba03d9ab0ce1b0ddc3704540380ea6fc6004e -
Trigger Event:
push
-
Statement type:
File details
Details for the file prehook-0.5.0-py3-none-win_amd64.whl.
File metadata
- Download URL: prehook-0.5.0-py3-none-win_amd64.whl
- Upload date:
- Size: 515.4 kB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85100e56080cb5c9fd13fc8895111265df85c893d3dc73b29767fcb6d1ff7b15
|
|
| MD5 |
b73ea78d23e1c2a8fe536409ff4e6ac5
|
|
| BLAKE2b-256 |
9c40e3e16a550b163595f0f2673f6e355a51a6fde75fb5301de3e0c0ba68d650
|
Provenance
The following attestation bundles were made for prehook-0.5.0-py3-none-win_amd64.whl:
Publisher:
release.yml on scriptogre/prehook
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prehook-0.5.0-py3-none-win_amd64.whl -
Subject digest:
85100e56080cb5c9fd13fc8895111265df85c893d3dc73b29767fcb6d1ff7b15 - Sigstore transparency entry: 1818646951
- Sigstore integration time:
-
Permalink:
scriptogre/prehook@831ba03d9ab0ce1b0ddc3704540380ea6fc6004e -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/scriptogre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@831ba03d9ab0ce1b0ddc3704540380ea6fc6004e -
Trigger Event:
push
-
Statement type:
File details
Details for the file prehook-0.5.0-py3-none-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: prehook-0.5.0-py3-none-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 596.9 kB
- Tags: Python 3, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26d8d44315a43288837b286076cdc09cfccad01754a244dcc977242360eb03f0
|
|
| MD5 |
780eaae5abdd0146ecdb8f3449709607
|
|
| BLAKE2b-256 |
9723694666d3163e80b2917b36f6bdff3a5a8d599f623eb90c71078292173232
|
Provenance
The following attestation bundles were made for prehook-0.5.0-py3-none-manylinux_2_28_x86_64.whl:
Publisher:
release.yml on scriptogre/prehook
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prehook-0.5.0-py3-none-manylinux_2_28_x86_64.whl -
Subject digest:
26d8d44315a43288837b286076cdc09cfccad01754a244dcc977242360eb03f0 - Sigstore transparency entry: 1818646927
- Sigstore integration time:
-
Permalink:
scriptogre/prehook@831ba03d9ab0ce1b0ddc3704540380ea6fc6004e -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/scriptogre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@831ba03d9ab0ce1b0ddc3704540380ea6fc6004e -
Trigger Event:
push
-
Statement type:
File details
Details for the file prehook-0.5.0-py3-none-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: prehook-0.5.0-py3-none-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 564.7 kB
- Tags: Python 3, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
963779737290bdd47ce6375ee6a9e783770cdb3efb280ec90c4ee95effebb9b1
|
|
| MD5 |
ac663c13eece3beded07a902c02aa82d
|
|
| BLAKE2b-256 |
e914ae9b6df42dfffbcb10a3ea859f04ac255341623488a0cabb2fe9a961a34a
|
Provenance
The following attestation bundles were made for prehook-0.5.0-py3-none-manylinux_2_28_aarch64.whl:
Publisher:
release.yml on scriptogre/prehook
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prehook-0.5.0-py3-none-manylinux_2_28_aarch64.whl -
Subject digest:
963779737290bdd47ce6375ee6a9e783770cdb3efb280ec90c4ee95effebb9b1 - Sigstore transparency entry: 1818646912
- Sigstore integration time:
-
Permalink:
scriptogre/prehook@831ba03d9ab0ce1b0ddc3704540380ea6fc6004e -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/scriptogre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@831ba03d9ab0ce1b0ddc3704540380ea6fc6004e -
Trigger Event:
push
-
Statement type:
File details
Details for the file prehook-0.5.0-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: prehook-0.5.0-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 554.1 kB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4328730b3451635df32437c2feebd7249620f5897971b84f48b8607b2c13ed5a
|
|
| MD5 |
3c053d31706d949cf328165d8eddb8e5
|
|
| BLAKE2b-256 |
aef74e15577bc43df3a8a6d4a6f13b2c6fa6a1a65441483ccf8ff83347c7c4b8
|
Provenance
The following attestation bundles were made for prehook-0.5.0-py3-none-macosx_11_0_arm64.whl:
Publisher:
release.yml on scriptogre/prehook
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prehook-0.5.0-py3-none-macosx_11_0_arm64.whl -
Subject digest:
4328730b3451635df32437c2feebd7249620f5897971b84f48b8607b2c13ed5a - Sigstore transparency entry: 1818646906
- Sigstore integration time:
-
Permalink:
scriptogre/prehook@831ba03d9ab0ce1b0ddc3704540380ea6fc6004e -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/scriptogre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@831ba03d9ab0ce1b0ddc3704540380ea6fc6004e -
Trigger Event:
push
-
Statement type:
File details
Details for the file prehook-0.5.0-py3-none-macosx_10_12_x86_64.whl.
File metadata
- Download URL: prehook-0.5.0-py3-none-macosx_10_12_x86_64.whl
- Upload date:
- Size: 574.4 kB
- Tags: Python 3, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f22b27aa116b7dee5acb65933fb445cf7ac2e64665134478650f47c64c2e76f
|
|
| MD5 |
83043c096cfa5374f193ec1fb0ccaf2b
|
|
| BLAKE2b-256 |
ea0c3b58b71915067bc6007aa532a3791dfe7b7f93b295cd026cc40ec43d54a7
|
Provenance
The following attestation bundles were made for prehook-0.5.0-py3-none-macosx_10_12_x86_64.whl:
Publisher:
release.yml on scriptogre/prehook
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prehook-0.5.0-py3-none-macosx_10_12_x86_64.whl -
Subject digest:
5f22b27aa116b7dee5acb65933fb445cf7ac2e64665134478650f47c64c2e76f - Sigstore transparency entry: 1818646937
- Sigstore integration time:
-
Permalink:
scriptogre/prehook@831ba03d9ab0ce1b0ddc3704540380ea6fc6004e -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/scriptogre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@831ba03d9ab0ce1b0ddc3704540380ea6fc6004e -
Trigger Event:
push
-
Statement type: