prehook
Run git hooks configured in pyproject.toml using uv.
Usage
-
Install (one-time):
uvx prehook install
Use
--forceto overwrite existing git hooks.Installed hooks are self-contained
sh(they readpyproject.tomldirectly), so committing never needsprehookitself, and editing the hook list needs no reinstall. -
Update hooks in
pyproject.toml:[tool.prehook] hooks = [ "uvx ruff check", "uvx ruff format", ]
-
Commit:
git commit -m "unfinished commit"
To uninstall:
uvx prehook uninstall
Run the hooks on demand (e.g. in CI) without committing:
uvx prehook run # pre-commit hooks
uvx prehook run --on pre-push # a specific stage
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. |
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. |
Metadata
Release files for prehook 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| prehook-0.6.0.tar.gz | 18.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| prehook-0.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.9 kB
Release files / prehook-0.6.0.tar.gz
| Download URL | prehook-0.6.0.tar.gz |
|---|---|
| Size | 18.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5f54b5750de71e248fbc4f2466b721f17a670dae4f64c97593fca92a0df159c0
|
|
BLAKE2b-256 checksum How to use checksums |
3fb1232a010a4e9d9f0bd39e20e89ae3f6f9f8b966499679605f2347d32c2a69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 19, 2026.
Transparency logRelease files / prehook-0.6.0-py3-none-any.whl
| Download URL | prehook-0.6.0-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cacc99f427f2828b2a589c2ebc78d25da9855eb9ab5d88aa893f4776fd5b5ef1
|
|
BLAKE2b-256 checksum How to use checksums |
00ed433c8669ef79450dea8b39764edfe8da8cf7e111a5c85e85d4f326033dd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 19, 2026.
Transparency log