Skip to main content

prefligit

Development Status CI GitHub downloads

prefligit

pre-commit is a framework to run hooks written in many languages, and it manages the language toolchain and dependencies for running the hooks.

prefligit is a reimagined version of pre-commit, built in Rust. It is designed to be a faster, dependency-free and drop-in alternative for it, while also providing some additional long-requested features.

[!WARNING] This project is still in early stage of development, some features are still not implemented. It is not production-ready yet, but feel free to try it out and provide feedback.

Current supported languages are python, node, go, docker, docker-image, system, script and fail.

Features

  • 🚀 A single binary with no dependencies, does not require Python or any other runtime.
  • ⚡ About 10x faster than pre-commit and uses only a third of disk space.
  • 🔄 Fully compatible with the original pre-commit configurations and hooks.
  • 🐍 Integration with uv for managing Python virtual environments and dependencies.
  • 🛠️ Improved toolchain installations for Python, Node.js, Go, Rust and Ruby, shared between hooks.
  • 📦 Built-in implementation of some common hooks.
  • 🏗️ (TODO) Built-in support for monorepos.

How to migrate

prefligit is designed as a drop-in replacement:

  • Install prefligit.
  • Replace pre-commit with prefligit in your commands
  • Your existing .pre-commit-config.yaml works unchanged
$ prefligit run
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
typos....................................................................Passed
cargo fmt................................................................Passed
cargo clippy.............................................................Passed

For configuring .pre-commit-config.yaml and writing hooks, you can refer to the pre-commit documentation as prefligit is fully compatible with it.

Why prefligit?

prefligit is way faster

  • It is about 10x faster than pre-commit and uses only a third of disk space.
  • It redesigned how hook environments and toolchains are managed, they are all shared between hooks, which reduces the disk space usage and speeds up the installation process.
  • Repositories are cloned in parallel, and hooks are installed in parallel if their dependencies are disjoint.
  • It uses uv for creating Python virtualenvs and installing dependencies, which is known for its speed and efficiency.
  • It implements some common hooks in Rust, built in prefligit, which are faster than their Python counterparts.

prefligit provides a better user experience

  • No need to install Python or any other runtime, just download a single binary.
  • No hassle with your Python version or virtual environments, prefligit automatically installs the required Python version and creates a virtual environment for you.
  • (TODO): Built-in support for workspaces (or monorepos), each sub-project can have its own .pre-commit-config.yaml file.
  • prefligit run has some improvements over pre-commit run, such as:
    • prefligit run --directory <dir> runs hooks for files in the specified directory, no need to use git ls-files -- <dir> | xargs pre-commit run --files anymore.
    • prefligit run --last-commit runs hooks for files changed in the last commit.
  • (TODO): prefligit provides shell completions for prefligit run <hook_id> command, so you can easily find the available hooks.

Installation

Standalone installer

prefligit provides a standalone installer script to download and install the tool:

# On Linux and macOS
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/j178/prefligit/releases/download/v0.0.22/prefligit-installer.sh | sh

# On Windows
powershell -ExecutionPolicy ByPass -c "irm https://github.com/j178/prefligit/releases/download/v0.0.22/prefligit-installer.ps1 | iex"
PyPI

prefligit is published as Python binary wheel to PyPI, you can install it using pip, uv (recommended), or pipx:

pip install prefligit

# or

uv tool install prefligit

# or

pipx install prefligit
Homebrew
brew install prefligit
Cargo

Build from source using Cargo:

cargo install --locked --git https://github.com/j178/prefligit
GitHub Releases

prefligit release artifacts can be downloaded directly from the GitHub releases.

If installed via the standalone installer, prefligit can update itself to the latest version:

$ prefligit self update

Acknowledgements

This project is heavily inspired by the original pre-commit tool, and it wouldn't be possible without the hard work of the maintainers and contributors of that project.

And a special thanks to the Astral team for their remarkable projects, particularly uv, from which I've learned a lot on how to write efficient and idiomatic Rust code.

Metadata

Release files for prefligit 0.0.22

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prefligit 0.0.22
File Size Uploaded
prefligit-0.0.22.tar.gz 146.5 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for prefligit 0.0.22
File
prefligit-0.0.22-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
prefligit-0.0.22-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
prefligit-0.0.22-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
prefligit-0.0.22-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details

Total release size: 19.2 MB

Release files / prefligit-0.0.22.tar.gz

Download URL prefligit-0.0.22.tar.gz
Size 146.5 kB
Tags Source
SHA-256 checksum
How to use checksums
74a54ec6371a33bb6d5b2a4436836a96d84f32e2e0b4441dd47579328d475761
BLAKE2b-256 checksum
How to use checksums
f689f1c66a5e2da3fd181f4196f1d3245d4854a6f391ffba9ff4de27383ec7f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.6

Release files / prefligit-0.0.22-py3-none-win_amd64.whl

Download URL prefligit-0.0.22-py3-none-win_amd64.whl
Size 4.3 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
5b942e63a907ac51f0ba28167d35cc3eca26baba95f932c4ea75dc6eb004e7cf
BLAKE2b-256 checksum
How to use checksums
e737093a7a1d5731edb76c9bc1e7a9767358e6be2b12b7077081ff5f36d5bf7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.6

Release files / prefligit-0.0.22-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL prefligit-0.0.22-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.2 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
dc70f3c30d9112858bd1af61ec9f02c6b4bac8740480b962d1880f2174795de4
BLAKE2b-256 checksum
How to use checksums
2a8d4866693b66ec3bbb7e1ef07209a419c690994ca0c48fc42814ce14e16b72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.6

Release files / prefligit-0.0.22-py3-none-macosx_11_0_arm64.whl

Download URL prefligit-0.0.22-py3-none-macosx_11_0_arm64.whl
Size 4.7 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2f0d21f5e42cbd2fa7603b0f6436ccab893c48ee8269b85724c0ace716807cc7
BLAKE2b-256 checksum
How to use checksums
48e52edcafb47a5d33bba6505a8f8e590ba022052b5d95740ceda1d0a1df8abd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.6

Release files / prefligit-0.0.22-py3-none-macosx_10_12_x86_64.whl

Download URL prefligit-0.0.22-py3-none-macosx_10_12_x86_64.whl
Size 4.9 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
1cc91ebf9b00792aed2910e7a64df02756dc83d299eaf913be5a89ad41de5f0b
BLAKE2b-256 checksum
How to use checksums
fb19c28061c8519ebb5a9b2f494163c7c1cec180a8a916be6c9bf7648fdc4954
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.6

Release history Release notifications | RSS feed

This release

0.0.22 This release

5 release files

0.0.13

5 release files

0.0.12

5 release files

0.0.11

5 release files

0.0.10

5 release files

0.0.9

5 release files

0.0.8

5 release files

0.0.7

5 release files

0.0.6

5 release files

0.0.5

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page