Skip to main content

Better `pre-commit`, re-engineered in Rust

Project description

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, only a few of the original pre-commit features are implemented. It is not production-ready yet, but feel free to try it out and provide feedback.

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

[!NOTE] This project was previously named pre-commit-rs, but it was renamed to prefligit to prevent confusion with the existing pre-commit tool. See #73 for more information.

Features

  • 🚀 A single binary with no dependencies, does not require Python or any other runtime.
  • ⚡ About 10x faster and uses roughly 2/3 less disk space than pre-commit.
  • 🔄 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.

Usage

$ prefligit run
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
typos....................................................................Passed
cargo fmt................................................................Passed
cargo clippy.............................................................Passed

prefligit is designed to be a drop-in alternative for the original pre-commit tool, so you can use it with your existing configurations and hooks.

Please refer to the official documentation for more information on how to configure and use pre-commit.

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.18/prefligit-installer.sh | sh

# On Windows
powershell -ExecutionPolicy ByPass -c "irm https://github.com/j178/prefligit/releases/download/v0.0.18/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.

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

prefligit-0.0.18.tar.gz (134.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

prefligit-0.0.18-py3-none-win_amd64.whl (4.2 MB view details)

Uploaded Python 3Windows x86-64

prefligit-0.0.18-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.2 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

prefligit-0.0.18-py3-none-macosx_11_0_arm64.whl (4.6 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

prefligit-0.0.18-py3-none-macosx_10_12_x86_64.whl (4.8 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file prefligit-0.0.18.tar.gz.

File metadata

  • Download URL: prefligit-0.0.18.tar.gz
  • Upload date:
  • Size: 134.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.4

File hashes

Hashes for prefligit-0.0.18.tar.gz
Algorithm Hash digest
SHA256 fb3aa66d07e8870a5ec9c066239012b6cfe2d02465416d140e09ffd4c387337b
MD5 b6335224ff4061a84c0d9c7426338a79
BLAKE2b-256 236968baefe94745084206f28cefdf211bbb5d6bbe9fe521465776e35965acab

See more details on using hashes here.

File details

Details for the file prefligit-0.0.18-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for prefligit-0.0.18-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 a4cc010deba79af40baf236bc16c0223142cf34b688411ff5dede7fe88d1b849
MD5 5d292b5c7c70fc7e7c0d982d2c33ce6f
BLAKE2b-256 9281fb27fe83e17f270541452fda8302dceb647d3c0f6734939d77ea541688e2

See more details on using hashes here.

File details

Details for the file prefligit-0.0.18-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for prefligit-0.0.18-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 50ded38ae83c34ed5a8ea873cff1141fe1eb8df10a3da8a8100623ddc9a41baf
MD5 097e7922dbd5bb49036a6c880173b818
BLAKE2b-256 57cb2ce05082955d1f1caad74dd86aac976512b7dcc0503d304ff805760e40d3

See more details on using hashes here.

File details

Details for the file prefligit-0.0.18-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for prefligit-0.0.18-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ab918c75caaa0fe4f600f993c47d877381aedc44cf86fca8db73a4f744cf5f24
MD5 18e7509aef0a3513a1248939c82ebc32
BLAKE2b-256 226b311834947b1106e08389b702ef4b26daede7932a08cbe5142ad2f3ba7347

See more details on using hashes here.

File details

Details for the file prefligit-0.0.18-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for prefligit-0.0.18-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 542d148ce704482bb843551bc9fbc2750d929e8b31513f6622c6b33986b945e1
MD5 b9ce31c13afb1deb1854fe9df5cbf35e
BLAKE2b-256 8361787ebd37800befa83d07c876c1153f44188221dcffa1e5db33609036de1f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page