Skip to main content

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

Project description

prek
prek

CI codecov GitHub Downloads PyPI Downloads Discord

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

prek 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.

[!NOTE] Although prek is pretty new, it’s already powering real‑world projects like Airflow, and more projects are picking it up—see Who is using prek?. If you’re looking for an alternative to pre-commit, please give it a try—we’d love your feedback!

Please note that some subcommands and languages are still missing for full drop‑in parity with pre-commit. Track the remaining gaps here: TODO.

Features

  • 🚀 A single binary with no dependencies, does not require Python or any other runtime.
  • Faster than pre-commit and more efficient in disk space usage.
  • 🔄 Fully compatible with the original pre-commit configurations and hooks.
  • 🏗️ Built-in support for monorepos (i.e. workspace mode).
  • 🐍 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 Rust-native implementation of some common hooks.

Table of contents

Installation

Standalone installer

prek 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/prek/releases/download/v0.2.13/prek-installer.sh | sh

On Windows:

powershell -ExecutionPolicy ByPass -c "irm https://github.com/j178/prek/releases/download/v0.2.13/prek-installer.ps1 | iex"
PyPI

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

# Using uv (recommended)
uv tool install prek

# Using uvx (install and run in one command)
uvx prek

# Using pip
pip install prek

# Using pipx
pipx install prek
Homebrew
brew install prek
mise

To use prek with mise (v2025.8.11 or later):

mise use prek
Cargo binstall

Install pre-compiled binaries from GitHub using cargo-binstall:

cargo binstall prek --git https://github.com/j178/prek
Cargo

Build from source using Cargo (Rust 1.89+ is required):

cargo install --locked --git https://github.com/j178/prek
npmjs

prek is published as a Node.js package, you can install it using npm, pnpm, or npx:

# Using npm
npm add -D @j178/prek

# Using pnpm
pnpm add -D @j178/prek

# Using npx
npx @j178/prek --version

# or install globally
npm install -g @j178/prek

# then use `prek` command
prek --version
Nix

prek is available in Nix as prek.

# Choose what's appropriate for your use case.
# One-off in a shell:
nix-shell -p prek
# NixOS or non-NixOS without flakes:
nix-env -iA nixos.prek
# Non-NixOS with flakes:
nix profile install nixpkgs#prek
Conda

prek is available as prek via conda-forge.

conda install conda-forge::prek
GitHub Releases

Pre-built binaries are available for download from the GitHub releases page.

GitHub Actions

prek can be used in GitHub Actions via the j178/prek-action repository.

Example workflow:

name: Prek checks
on: [push, pull_request]

jobs:
  prek:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: j178/prek-action@v1

This action installs prek and runs prek run --all-files on your repository.

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

prek self update

Quick start

  • I already use pre-commit: follow the short migration checklist in the quickstart guide to swap in prek safely.
  • I'm new to pre-commit-style tools: learn the basics—creating a config, running hooks, and installing git hooks—in the beginner quickstart walkthrough.

Why prek?

prek is faster

  • It is multiple times faster than pre-commit and takes up half the 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 prek, which are faster than their Python counterparts.

prek 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, prek automatically installs the required Python version and creates a virtual environment for you.
  • Built-in support for workspaces (or monorepos), each subproject can have its own .pre-commit-config.yaml file.
  • prek run has some nifty improvements over pre-commit run, such as:
    • prek 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.
    • prek run --last-commit runs hooks for files changed in the last commit.
    • prek run [HOOK] [HOOK] selects and runs multiple hooks.
  • prek list command lists all available hooks, their ids, and descriptions, providing a better overview of the configured hooks.
  • prek provides shell completions for prek run <hook_id> command, making it easier to run specific hooks without remembering their ids.

For more detailed improvements prek offers, take a look at Difference from pre-commit.

Who is using prek?

prek is pretty new, but it is already being used or recommend by some projects and organizations:

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

prek-0.2.13.tar.gz (341.7 kB view details)

Uploaded Source

Built Distributions

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

prek-0.2.13-py3-none-win_arm64.whl (4.6 MB view details)

Uploaded Python 3Windows ARM64

prek-0.2.13-py3-none-win_amd64.whl (4.9 MB view details)

Uploaded Python 3Windows x86-64

prek-0.2.13-py3-none-win32.whl (4.3 MB view details)

Uploaded Python 3Windows x86

prek-0.2.13-py3-none-musllinux_1_1_x86_64.whl (4.9 MB view details)

Uploaded Python 3musllinux: musl 1.1+ x86-64

prek-0.2.13-py3-none-musllinux_1_1_i686.whl (4.6 MB view details)

Uploaded Python 3musllinux: musl 1.1+ i686

prek-0.2.13-py3-none-musllinux_1_1_armv7l.whl (4.4 MB view details)

Uploaded Python 3musllinux: musl 1.1+ ARMv7l

prek-0.2.13-py3-none-manylinux_2_31_riscv64.whl (4.6 MB view details)

Uploaded Python 3manylinux: glibc 2.31+ riscv64

prek-0.2.13-py3-none-manylinux_2_28_aarch64.whl (4.5 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

prek-0.2.13-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

prek-0.2.13-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl (5.2 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ s390x

prek-0.2.13-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (5.1 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ppc64le

prek-0.2.13-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl (5.1 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ppc64

prek-0.2.13-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl (4.7 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ i686

prek-0.2.13-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (4.4 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARMv7l

prek-0.2.13-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl (4.5 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64musllinux: musl 1.1+ ARM64

prek-0.2.13-py3-none-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

prek-0.2.13-py3-none-macosx_10_12_x86_64.whl (4.6 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

prek-0.2.13-py3-none-linux_armv6l.whl (4.5 MB view details)

Uploaded Python 3

File details

Details for the file prek-0.2.13.tar.gz.

File metadata

  • Download URL: prek-0.2.13.tar.gz
  • Upload date:
  • Size: 341.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.7

File hashes

Hashes for prek-0.2.13.tar.gz
Algorithm Hash digest
SHA256 eca64c201938cd71ca09eec9b3e31ad031a251f4aa22a5132eb1c1640d86114f
MD5 f8124850e6385839f4a3bba61ad15787
BLAKE2b-256 f857a0d9d2d39c8477ae44096f9c8b962395428309019875d65e130f60478015

See more details on using hashes here.

File details

Details for the file prek-0.2.13-py3-none-win_arm64.whl.

File metadata

  • Download URL: prek-0.2.13-py3-none-win_arm64.whl
  • Upload date:
  • Size: 4.6 MB
  • Tags: Python 3, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.7

File hashes

Hashes for prek-0.2.13-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 6b3b0e07a2da4e67e7110399b5dbd8d9205df8ff39fbe80bd37ffa194c639990
MD5 949c72ae21a14f3eba24e7e400abbfab
BLAKE2b-256 05de8832527ecce043cdfe28cd6a5cb580c79e64f2abe1099f87e03a71614060

See more details on using hashes here.

File details

Details for the file prek-0.2.13-py3-none-win_amd64.whl.

File metadata

  • Download URL: prek-0.2.13-py3-none-win_amd64.whl
  • Upload date:
  • Size: 4.9 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.7

File hashes

Hashes for prek-0.2.13-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 75fe11e6689431b5a3f818276dfbcbb3502cd2a4b07a3efaf3460204adaa9a89
MD5 b89ce7320de6e339d0cc83ac721daad3
BLAKE2b-256 ab5a0ac93e96da38a61ae1c116a819b66520cfcb252e3c790a2726a21cefbb90

See more details on using hashes here.

File details

Details for the file prek-0.2.13-py3-none-win32.whl.

File metadata

  • Download URL: prek-0.2.13-py3-none-win32.whl
  • Upload date:
  • Size: 4.3 MB
  • Tags: Python 3, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.7

File hashes

Hashes for prek-0.2.13-py3-none-win32.whl
Algorithm Hash digest
SHA256 beb5cffb1575b645022305a601bdd395b5b005c42368fedb34bfc6aebed24b36
MD5 a83133ca4f9a788623aa21842cf8c808
BLAKE2b-256 bcc456fa24632dac132e08ce1f2a68fb27ac4c4463a19c79e902acfbf12ecc4d

See more details on using hashes here.

File details

Details for the file prek-0.2.13-py3-none-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for prek-0.2.13-py3-none-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 a72f909dd737aeda07d3768aab39d8ed2574ddf05842b8a324434810d2e7160f
MD5 fba1350c67339ac7e188a70355595f37
BLAKE2b-256 94dbdce44c94ee50514053996f8f9b36f11b07bdf8beb67c2420b7a36b3cafb5

See more details on using hashes here.

File details

Details for the file prek-0.2.13-py3-none-musllinux_1_1_i686.whl.

File metadata

File hashes

Hashes for prek-0.2.13-py3-none-musllinux_1_1_i686.whl
Algorithm Hash digest
SHA256 82555ede81a7ca058ffe450e0cf7aab85db2063aeeb00d4b1704b32ccb3a4e23
MD5 1cc21104f4023507ec6c60a692c95e5b
BLAKE2b-256 d6fe47edb36d854fafcad8548fa847986cf5acb7c82c8d00ced41bd3c36a4d97

See more details on using hashes here.

File details

Details for the file prek-0.2.13-py3-none-musllinux_1_1_armv7l.whl.

File metadata

File hashes

Hashes for prek-0.2.13-py3-none-musllinux_1_1_armv7l.whl
Algorithm Hash digest
SHA256 fa3667c641b77c9cb100d428e615f69cf45018615af32b8c63bb4fa2cbbb8769
MD5 a011a2a9514f59dcc17eb19c599b5a82
BLAKE2b-256 b9de451fdfdb07e40274998127166683ab828d4940f16ba2f3ceaa074b2bf1ae

See more details on using hashes here.

File details

Details for the file prek-0.2.13-py3-none-manylinux_2_31_riscv64.whl.

File metadata

File hashes

Hashes for prek-0.2.13-py3-none-manylinux_2_31_riscv64.whl
Algorithm Hash digest
SHA256 e206979c3d1834fc1683c79e8c72b7e18be3923ca5695de0642d0c9d23e2010a
MD5 6ffa24e8d7dd2acd59918544a9a98067
BLAKE2b-256 5d547c5dac73f2f825ef54f61b9c96f7a6c8369b17746b208b007b7e50a86a54

See more details on using hashes here.

File details

Details for the file prek-0.2.13-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for prek-0.2.13-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 06dc43f2d7219f2bad2c01085ad444de517b5d28e5ef361274ff39a46b68f2cc
MD5 82df0615d52ef428d78311a7562c4327
BLAKE2b-256 1da00d366c35eeca0f40080f9afa4f7a0bdf4b4103a3d0ece7965a41e3e56986

See more details on using hashes here.

File details

Details for the file prek-0.2.13-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for prek-0.2.13-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b7d0c1b1d6e315dd51cdb4e68957d5ef38a67e2c5f0dab53168cb6e842539bbf
MD5 6880b4b1b411baf1816f1615d741e1f5
BLAKE2b-256 61e5b44f3ee2d75f1c0a2a844e3a0980ba712bca5adefb4c65942f85e22156eb

See more details on using hashes here.

File details

Details for the file prek-0.2.13-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for prek-0.2.13-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 e7cb2a54d55c35b57548fc1cb74fb66126ed1437a06a33416c6484e0eb4dd80e
MD5 25ef2f51e00d0b8bbec3e60901a84382
BLAKE2b-256 8d4f2d3d707d93bf4f48b8b95d4bcafe90df7d4f99b147442b7bbaac5e7f9838

See more details on using hashes here.

File details

Details for the file prek-0.2.13-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for prek-0.2.13-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 8ae60b5d753272c1051667a257cbb13cfb197ef32900aee4cefa98352d5e7576
MD5 750ad99975010c614eeb49671e92d36b
BLAKE2b-256 b391e4e6eddaae3bb794ca1f98948e10c8137da7523a0d728253522a1e4a83f6

See more details on using hashes here.

File details

Details for the file prek-0.2.13-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl.

File metadata

File hashes

Hashes for prek-0.2.13-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 dde77f9ee904df60fa9cecfbfde04257d26c3f5d0c5ee55211738b3990ff740f
MD5 5cbbd1ebfb63de3ac647c8039ad56b57
BLAKE2b-256 224aff74278b426cda5dee5d6280dc87fd47f428693d3fadb98a5fbfb0f2b329

See more details on using hashes here.

File details

Details for the file prek-0.2.13-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for prek-0.2.13-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 8cea9a0a46fc5e62ebf4cde1e700993737b6828228cf60f1ccfa1c91092e7e7f
MD5 e229a6c8f240443ff9dc24325a3289b6
BLAKE2b-256 e9ee1017ae7207e3542a7ecfbabf2dab910c7691996956fcc124f94c1219ae1c

See more details on using hashes here.

File details

Details for the file prek-0.2.13-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for prek-0.2.13-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 0f5eac126203c89e38062e665f1427207dece178f9e19bacbc37056ab8504148
MD5 e6befcfd98838b94e425c864f368a5e4
BLAKE2b-256 0c7c41ada766ca3a5cd5f286222ae30b909edac5cb95f076f6af2ff40f3cc3b6

See more details on using hashes here.

File details

Details for the file prek-0.2.13-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl.

File metadata

File hashes

Hashes for prek-0.2.13-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 8a869f9c98da675efc947e0aa4c7a8d8434d57fa5bad20e27e54855160771053
MD5 aff8eca4b27b2ac543d055bf7c65d2b8
BLAKE2b-256 6b0591c44cb60758d3c781ea057b70b59e1870c667cfb64d12e636f54d364538

See more details on using hashes here.

File details

Details for the file prek-0.2.13-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for prek-0.2.13-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dd5e0ddc4e4c72633ee7d400c3be7df53b7bb0e61ba7c9ea4cb490d476824f79
MD5 5de2c9ad6e23f2c6a969ce87547200c5
BLAKE2b-256 c79a75770f16044b6cf1f07bdaa9a7966adbf09919531e86d890964799194397

See more details on using hashes here.

File details

Details for the file prek-0.2.13-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for prek-0.2.13-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a8724e40242a4ad3cb3f14d17764c287d9b0a5ea61ac91a861e5a676bfe21c99
MD5 c7f7475481829923c9eaf8457a11497c
BLAKE2b-256 80f36375bd1b4e4786d26329613a115284ec9d363ccf366236764c168a81a2cf

See more details on using hashes here.

File details

Details for the file prek-0.2.13-py3-none-linux_armv6l.whl.

File metadata

File hashes

Hashes for prek-0.2.13-py3-none-linux_armv6l.whl
Algorithm Hash digest
SHA256 9f55198e4b0f08c544e790184898459973755d5b83eb21e3527d789f3fc6855e
MD5 329cf50c0e3b06b68bc125287b3ede21
BLAKE2b-256 296451372417ffdbef0cc41ed2fa22be064fe247246fff364dbc86ac43364fe2

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