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.

[!WARNING] prek is not production-ready yet. Some subcommands and languages are not implemented. See the current gaps for drop-in parity: TODO.

But it's already being adopted by some projects like Airflow, so please give it a try - we'd love your feedback!

Features

  • 🚀 A single binary with no dependencies, does not require Python or any other runtime.
  • Faster than pre-commit and uses only half the disk space.
  • 🔄 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.12/prek-installer.sh | sh

On Windows:

powershell -ExecutionPolicy ByPass -c "irm https://github.com/j178/prek/releases/download/v0.2.12/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.12.tar.gz (320.9 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.12-py3-none-win_arm64.whl (4.5 MB view details)

Uploaded Python 3Windows ARM64

prek-0.2.12-py3-none-win_amd64.whl (4.8 MB view details)

Uploaded Python 3Windows x86-64

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

Uploaded Python 3Windows x86

prek-0.2.12-py3-none-musllinux_1_1_x86_64.whl (4.8 MB view details)

Uploaded Python 3musllinux: musl 1.1+ x86-64

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

Uploaded Python 3musllinux: musl 1.1+ i686

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

Uploaded Python 3musllinux: musl 1.1+ ARMv7l

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

Uploaded Python 3manylinux: glibc 2.31+ riscv64

prek-0.2.12-py3-none-manylinux_2_28_aarch64.whl (4.4 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

prek-0.2.12-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.7 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

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

Uploaded Python 3manylinux: glibc 2.17+ s390x

prek-0.2.12-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (5.0 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ppc64le

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

Uploaded Python 3manylinux: glibc 2.17+ ppc64

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

Uploaded Python 3manylinux: glibc 2.17+ i686

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

Uploaded Python 3manylinux: glibc 2.17+ ARMv7l

prek-0.2.12-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl (4.4 MB view details)

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

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

Uploaded Python 3macOS 11.0+ ARM64

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

Uploaded Python 3macOS 10.12+ x86-64

prek-0.2.12-py3-none-linux_armv6l.whl (4.4 MB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for prek-0.2.12.tar.gz
Algorithm Hash digest
SHA256 751587889cf0d8e9f98f743f31da6ca9f38966df186a5efea3796be0fc9d7e97
MD5 a1261eaf8f9ba9cae72a56e846c3554f
BLAKE2b-256 f465648c9e3f3e20eaeb3b2f69d6f06d3227ebb54fc667598855f0bc138def53

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for prek-0.2.12-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 8f203c05afa4e7126d86d16ad1916b9676cbed127e95dcb230a06299bc5bcf6b
MD5 8f83ee5af5fbb0d09a6f73baf4e77a13
BLAKE2b-256 f0c36b40262600bf7daeaa65a9ded17244c2f4b0f6d032119495ec28326a6978

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for prek-0.2.12-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 aecb61e06636c90dcfd14dd02901474a6d77dbafd930a0ab136d256800d8f8e1
MD5 858e55cd6aa61dd673168a3dcfbe3f28
BLAKE2b-256 ddc40e4c03c96ee3530053aa77b37361cc9d0e23e15a90017b81838a45cf54a8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: prek-0.2.12-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.5

File hashes

Hashes for prek-0.2.12-py3-none-win32.whl
Algorithm Hash digest
SHA256 491b50f1686ade8472edc67fc6cd088fbb7cee416ee8d974649fc4f7f9357660
MD5 96cd7fffb46a3715b6c253b614f3f087
BLAKE2b-256 33395f9cbfe0190e4f0618b4d76c48744d1a75fb18ae8376d1f1f42f0e0bbd66

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prek-0.2.12-py3-none-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 82733a882efdd064da1baa38cb433fe86bd5e858be9248501a6e86e938dbf2e3
MD5 79f88b296fe9a82f006f18e1b3a709cd
BLAKE2b-256 7b5a71a037daa9d582ac3c5f0fab39c6e2dee6c244a10c56909a89871208204e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prek-0.2.12-py3-none-musllinux_1_1_i686.whl
Algorithm Hash digest
SHA256 38eb44fb02e4cde98dd75e1eaba48860bd251cc12014452b2c55c65e2ff3911a
MD5 703c11a4fd202d164d0947372190a9ce
BLAKE2b-256 3c07b6d54082e5b10f94ec8e4d2b0a5b1555b2d28a124ee90d6bdb485ce8533c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prek-0.2.12-py3-none-musllinux_1_1_armv7l.whl
Algorithm Hash digest
SHA256 eeb90e112f99665a7d1f33d337be79141cb42c6d18dc51260001345165d25ef5
MD5 0a24ef31d7ded11f4772c392443d7a74
BLAKE2b-256 f8e8c21f4576f9bf0d16462dee863b4abb1030f302b562c8f404aa02a65fc9af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prek-0.2.12-py3-none-manylinux_2_31_riscv64.whl
Algorithm Hash digest
SHA256 848df65ea8aeb75326b8f7d9a7bbf286d5e84e39fcb36bc195c512b701c32b5b
MD5 34d1b770f85a7879c46ecf21d0d20cf8
BLAKE2b-256 0c17dc5255ac64b841d4cfbf8e4fb8e8f2cd2a340b1419a280a6a1cce3b609a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prek-0.2.12-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 33e2761710c89d16f0a1777607f22d07b49355198af591c0f1b853b76865ad3c
MD5 00f5589ff2c6c0744117aa3d4417d276
BLAKE2b-256 94073c27229249cc0968a59448359fdde0a93ea44f12cee99155665a4d03dc60

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prek-0.2.12-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 63b539e97ecb02322804688e5dfbee149907b54c5aa85a5cf822e2584eddb660
MD5 47de52544f7953f2f197d7e7690ad5a5
BLAKE2b-256 33d7593d7d9e96a11920b426014fc5aa1dc6b25a12b1b98b68629fe727fcd1b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prek-0.2.12-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 c3d7923825607271f1a23c1378d9345c8e8ac487a55d3199efe1f7069c018ed2
MD5 5be013a15baf330363a44c61d11c8971
BLAKE2b-256 9218966c1293561e8cd789eebccdbb38d24d20da17a648967ca995491f742a08

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prek-0.2.12-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 6e0f654551cce0d2a7f14cf69e2498a89e125c3acb4b25cb1f6a10238a0b9834
MD5 6f6c5d97291fe35f97f9e0f8d6c88961
BLAKE2b-256 ccf525e250d41848dc5c882c8ed4265ca64afa8763d0d8b959cb1a70097450ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prek-0.2.12-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm Hash digest
SHA256 8c095432d47df7704fd4b73e4a0a7e28bd33528b80724635c383db052c4c23af
MD5 322690499786c139b4c008deb1ce308a
BLAKE2b-256 649c8d1785ffd8cfa401639b9f27a8d27e66480b5f8969e5236aa46ed2e45142

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prek-0.2.12-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 4760c423fbf182f166892db157bc8ab6a3af7aff8ecd62ec151e9dcb07bc37ed
MD5 a81df3ced406388e7fd9cc231a690039
BLAKE2b-256 9ae5fe684fd0fa5e466a5116d79aeaa36a8cb31bc8da323cb624dea40a7cda00

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prek-0.2.12-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 f9568f80a7ad2ec267e4ad650b8e734cbb5aac7db0984359a8f6da1230a65c36
MD5 6f1c1ada89049354dd46907abeb1e3ed
BLAKE2b-256 8942090acc2c265938f2c8b255a710f57b8b7159165d5af7c144defda7ef98af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prek-0.2.12-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 141cdeefc926dfebdb429b055c35f397071a40db66db73efedb26f19e2148e5b
MD5 a3c06a857dc662c4be4bb43292a10906
BLAKE2b-256 52475747c4ef0567192fa38123ef936dd263f9d470d012fa3d1af7259ea3631c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prek-0.2.12-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8a0b4590272eb599f3be350fabfa8fb7067569d24852f65239826dcca3b37b41
MD5 e060f2f510653b099edc391e1e85a6ef
BLAKE2b-256 758ca1e52eb8cc519151e7548e606a4fe52975e348d117d7594bbe89a6c9b77c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prek-0.2.12-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9cb3779e62d2b34f25dc22550d949e7fed7b671d91fa0471cb3bca42530b7172
MD5 6d733703db1c896eb5c6a6031b3e67cf
BLAKE2b-256 5ead8b22926aebd4da431c09f31355f300803290699d0df542d30524af8618a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prek-0.2.12-py3-none-linux_armv6l.whl
Algorithm Hash digest
SHA256 90f5e99cb7a82e55589cd64aa9c4893c84f975b6f26df463a89a31179effbf3d
MD5 94c5f87a93f9c7ff3577f5751318faf0
BLAKE2b-256 b2b7732c7fcd2189806c8a161dc68bcf63d0abe72f32b912760b525f0b680996

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