Skip to main content

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

Reason this release was yanked:

incomplete release

Project description

prek
prek

prek 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 Apache Airflow, FastAPI, 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.26/prek-installer.sh | sh

On Windows:

powershell -ExecutionPolicy ByPass -c "irm https://github.com/j178/prek/releases/download/v0.2.26/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

# Adding prek to the project dev-dependencies
uv add --dev 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
Cargo

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

cargo install --locked 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 via Nixpkgs.

# 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
Scoop (Windows)

prek is available via Scoop.

scoop install main/prek
MacPorts

prek is available via MacPorts.

sudo port install 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.

prek is also available via taiki-e/install-action for installing various tools.

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.
  • Hooks can run in parallel by priority (hooks with the same priority may run concurrently), reducing end-to-end runtime.
  • 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.
  • It supports repo: builtin for offline, zero-setup hooks, which is not available in pre-commit.

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 auto-update supports --cooldown-days to mitigate open source supply chain attacks.
  • 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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

prek-0.2.26-py3-none-win_arm64.whl (5.0 MB view details)

Uploaded Python 3Windows ARM64

prek-0.2.26-py3-none-win32.whl (4.6 MB view details)

Uploaded Python 3Windows x86

prek-0.2.26-py3-none-musllinux_1_1_i686.whl (4.9 MB view details)

Uploaded Python 3musllinux: musl 1.1+ i686

prek-0.2.26-py3-none-manylinux_2_31_riscv64.whl (4.8 MB view details)

Uploaded Python 3manylinux: glibc 2.31+ riscv64

prek-0.2.26-py3-none-manylinux_2_28_aarch64.whl (4.8 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

prek-0.2.26-py3-none-manylinux_2_24_x86_64.whl (5.1 MB view details)

Uploaded Python 3manylinux: glibc 2.24+ x86-64

prek-0.2.26-py3-none-manylinux_2_24_ppc64le.whl (5.4 MB view details)

Uploaded Python 3manylinux: glibc 2.24+ ppc64le

prek-0.2.26-py3-none-manylinux_2_24_i686.whl (5.0 MB view details)

Uploaded Python 3manylinux: glibc 2.24+ i686

prek-0.2.26-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl (4.8 MB view details)

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

prek-0.2.26-py3-none-macosx_10_12_x86_64.whl (4.9 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: prek-0.2.26-py3-none-win_arm64.whl
  • Upload date:
  • Size: 5.0 MB
  • Tags: Python 3, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for prek-0.2.26-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 a881be161abff10368bd36d7c28d981c3aa05c2639e9748d81895dcf02d87a6a
MD5 af487223ba129eb7589a23424844fabe
BLAKE2b-256 4d37acfae3e2b2e68e82b235a1e223651cc97202467c38ac8103d0bc53df15f3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: prek-0.2.26-py3-none-win32.whl
  • Upload date:
  • Size: 4.6 MB
  • Tags: Python 3, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for prek-0.2.26-py3-none-win32.whl
Algorithm Hash digest
SHA256 dd7737cebbc711b56e05d8084f82cf619cbc3d9a5eb703dfd3b703ecf0bca819
MD5 1248e7a14cb655eab41f623387b75fff
BLAKE2b-256 2fa8ceb2b1f28bebf08e35389a8c127d4fe4257941f9a35fac348f7941b5d568

See more details on using hashes here.

File details

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

File metadata

  • Download URL: prek-0.2.26-py3-none-musllinux_1_1_i686.whl
  • Upload date:
  • Size: 4.9 MB
  • Tags: Python 3, musllinux: musl 1.1+ i686
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for prek-0.2.26-py3-none-musllinux_1_1_i686.whl
Algorithm Hash digest
SHA256 972d42c213b3b187c4411cb7064abb7256a7f3d05611f4e7bdda5af494731752
MD5 58d0d2e233d96b20b9f54248b18de47f
BLAKE2b-256 c0f00d8c7fba2cd8989da5e72e58a3669d09abca6e693526d32acaa73530c74c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: prek-0.2.26-py3-none-manylinux_2_31_riscv64.whl
  • Upload date:
  • Size: 4.8 MB
  • Tags: Python 3, manylinux: glibc 2.31+ riscv64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for prek-0.2.26-py3-none-manylinux_2_31_riscv64.whl
Algorithm Hash digest
SHA256 931021e198c08d7ac474d0ed4eb663cd6ffa2f7e484477b967230131dd1058f4
MD5 419ff82d65e8afa7df238ae2a04cc6ad
BLAKE2b-256 580117fc64bb0dccf44099c9d2ad768aa46dfd42e9662ac78ce6810d1be31003

See more details on using hashes here.

File details

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

File metadata

  • Download URL: prek-0.2.26-py3-none-manylinux_2_28_aarch64.whl
  • Upload date:
  • Size: 4.8 MB
  • Tags: Python 3, manylinux: glibc 2.28+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for prek-0.2.26-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 bd545ec9412791e4b333724f2a23eba4026a7d758977fda8c9bdcbe4b4b06c3e
MD5 3e9537361cba5736a2d1daca1caec422
BLAKE2b-256 8932bd01019265145adad7b9c492bfeeacb1594f736a0bca6a64cc75b08872ba

See more details on using hashes here.

File details

Details for the file prek-0.2.26-py3-none-manylinux_2_24_x86_64.whl.

File metadata

  • Download URL: prek-0.2.26-py3-none-manylinux_2_24_x86_64.whl
  • Upload date:
  • Size: 5.1 MB
  • Tags: Python 3, manylinux: glibc 2.24+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for prek-0.2.26-py3-none-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 bb989d24352584ecfd4cce3a531dba71084c70debba36c2fc03a662dad0ba41b
MD5 f0692b9acd20e03df6035feb74b48a30
BLAKE2b-256 5e25011cd3aed7a00c9bd67dcf5d9ddc68060cea2a1a8968195003a3b7d8b172

See more details on using hashes here.

File details

Details for the file prek-0.2.26-py3-none-manylinux_2_24_ppc64le.whl.

File metadata

  • Download URL: prek-0.2.26-py3-none-manylinux_2_24_ppc64le.whl
  • Upload date:
  • Size: 5.4 MB
  • Tags: Python 3, manylinux: glibc 2.24+ ppc64le
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for prek-0.2.26-py3-none-manylinux_2_24_ppc64le.whl
Algorithm Hash digest
SHA256 59358e9150ee41037a2c7daa184038a1b45ebb274e42bcd91d92fbd7d71bc64d
MD5 63bb9c13308863c4a75f00e64dea6a2f
BLAKE2b-256 a37130972b61e5bb8c86b1a9d71a45e84ce6460e1e9425ec127a6285e9a88266

See more details on using hashes here.

File details

Details for the file prek-0.2.26-py3-none-manylinux_2_24_i686.whl.

File metadata

  • Download URL: prek-0.2.26-py3-none-manylinux_2_24_i686.whl
  • Upload date:
  • Size: 5.0 MB
  • Tags: Python 3, manylinux: glibc 2.24+ i686
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for prek-0.2.26-py3-none-manylinux_2_24_i686.whl
Algorithm Hash digest
SHA256 005ca8834c8b55e1a37c2bdefbf8b700d7e9518d5e4e5b3abfc24595fcac8278
MD5 f4370f0dec77702fd929b0bc42a429c7
BLAKE2b-256 3fd60072f48725bdb81c07b1720f893cb9d9ad7d6408ef465511e8d79b12b2e9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: prek-0.2.26-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl
  • Upload date:
  • Size: 4.8 MB
  • Tags: Python 3, manylinux: glibc 2.17+ ARM64, musllinux: musl 1.1+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for prek-0.2.26-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 a7b8f1ef883dc8c212b2d39dce44a4eed4b1dceaaf01f25db3290e640e3ab200
MD5 c03dd85f21d775f084ffc70e6dd8ceab
BLAKE2b-256 45f7405773299117c7029b9c1877744fbecffb7953e7acbe1cb32395b67b1f5f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: prek-0.2.26-py3-none-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 4.9 MB
  • Tags: Python 3, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for prek-0.2.26-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 315e66f4d3a45c304ff65d4ac3b5411c56963be5af96c97d695241ec59d58e8e
MD5 8ff5cb88260d8bfcb621ab1d3023991f
BLAKE2b-256 2e2011cafa2719259254025c6cc6c4c5394c75cc5bd9c926fcdd28dc46ac0d7c

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