lefthook
Git hooks manager. Fast, powerful, simple.
What it is and what it does
Lefthook is a Git hooks manager written in Go that runs as a single binary, installed via pip as a platform-specific wheel. It lets you define custom commands to run before or after Git operations (commit, push, etc.) in a YAML configuration file, then installs those hooks into your repository's `.git/hooks` directory. The manager supports parallel execution of commands and works across polyglot projects—Node.js, Ruby, and others—without requiring language-specific hook frameworks.
You configure hooks once in `lefthook.yml`, run `lefthook install`, and the hooks execute automatically on each Git operation. The package has no Python runtime dependencies; it's a thin wrapper around the Go binary, which handles all the hook management and execution logic. This makes it lightweight and portable across teams and CI environments.
Use it for:
- Run linters and formatters automatically before commit to enforce code style across a team.
- Execute tests before push to prevent broken code from reaching the repository.
- Validate commit messages against a standard format before allowing commits.
- Run security checks or dependency audits as part of the pre-commit workflow.
- Coordinate multiple checks (lint, test, type-check) in parallel to speed up the commit process.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Lefthook is a Git hooks manager that installs and runs custom commands automatically before or after Git operations, supporting parallel execution across Node.js, Ruby, and other project types.
Yes, if you need a lightweight, language-agnostic Git hooks manager. Active maintenance, no runtime dependencies, permissive MIT license, and no known vulnerabilities make it low-risk. Medium install friction from platform-specific wheels is a minor trade-off for a single self-contained binary. Best suited for teams wanting to standardize pre-commit checks across polyglot codebases without heavyweight frameworks.
Install
lefthook on PyPI
pip
pip install lefthookuv
uv add lefthookpoetry
poetry add lefthookInstalling lefthook
Before you install
Medium install friction due to platform-specific binary wheels (macOS x86_64/arm64, Linux x86_64/aarch64, Windows amd64/arm64), but the package itself has no runtime dependencies and maintenance is active with a recent release.
License in practice
MIT license is permissive, allowing use in commercial and private projects with minimal restrictions—you need only retain the license notice.
Quickstart
pip install lefthook
# Create lefthook.yml in your repo with hook configuration
lefthook install
# Hooks now run automatically on git operations
Requires Python 3.6 or later; the binary is platform-specific so installation must match your OS and architecture.
Verify before relying
- Whether the package can run hooks for languages other than Node.js and Ruby without additional setup.
- Performance characteristics and actual parallelization behavior compared to other Git hook managers.
- Whether configuration can be shared across team members without environment-specific tweaks.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 37 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 399,753/month — #6,944 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: lefthook-2.1.10-py3-none-macosx_10_15_x86_64.whl; lefthook-2.1.10-py3-none-macosx_11_0_arm64.whl; lefthook-2.1.10-py3-none-manylinux_2_17_aarch64.whl; lefthook-2.1.10-py3-none-manylinux_2_17_x86_64.whl; lefthook-2.1.10-py3-none-win_amd64.whl; lefthook-2.1.10-py3-none-win_arm64.whl
Tags
More Git packages
A Poetry plugin that automatically derives and…
permissive · top 5,000 on PyPI
versioningitAutomatically determines your Python package's…
permissive · top 5,000 on PyPI
word2numberConverts written-out number words (like "twenty…
permissive · top 5,000 on PyPI
mergify-cliMergify CLI is a command-line tool for managing…
permissive · top 15,000 on PyPI
requests-ntlm3Provides HTTP NTLM authentication for the…
permissive · top 15,000 on PyPI
requests-ntlm2Adds NTLM authentication support to the…
permissive · top 15,000 on PyPI
prekprek is a Git hook manager written in Rust that…
permissive · top 1,000 on PyPI
actionlint-pyactionlint-py provides a pip-installable…
permissive · top 15,000 on PyPI
ickIck is a polyglot tool for bundling best…
permissive · top 15,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
pre-commit-hooksProvides a collection of reusable pre-commit…
permissive · top 5,000 on PyPI
lintroLintro unifies code formatting, linting, and…
permissive · top 15,000 on PyPI
nodeenvnodeenv creates isolated Node.js environments…
permissive · top 1,000 on PyPI
polyglotPolyglot is a multilingual natural language…
copyleft · top 15,000 on PyPI
uv-sortAlphabetically sorts dependencies in uv's…
permissive · top 15,000 on PyPI
mkdocs-simple-hooksA MkDocs plugin that lets you define custom…
permissive · top 15,000 on PyPI