{"id":1191,"library":"prek","title":"Prek: Faster Git Hooks, Re-engineered in Rust","description":"Prek is a Rust-based reimplementation of the `pre-commit` framework, designed to manage Git hooks with dramatically improved performance and efficiency. It offers a faster, dependency-free alternative that is largely compatible with existing `.pre-commit-config.yaml` files, while also introducing new features like `prek.toml` configuration and built-in monorepo support. The project maintains an active development pace with frequent releases.","status":"active","version":"0.3.8","language":"en","source_language":"en","source_url":"https://github.com/j178/prek","tags":["git-hooks","pre-commit","linting","formatting","cli","rust","performance","code-quality","monorepo"],"install":[{"cmd":"pip install prek","lang":"bash","label":"Via pip (Python package wrapper)"},{"cmd":"curl --proto '=https' --tlsv1.2 -LsSf https://github.com/j178/prek/releases/download/v0.3.8/prek-installer.sh | sh","lang":"bash","label":"Standalone Installer (macOS/Linux)"}],"dependencies":[{"reason":"The `prek` PyPI package is a Python wrapper that installs the standalone Rust binary. The core `prek` tool itself does not strictly require Python, but leverages `uv` for managing Python virtual environments for hooks.","package":"python","optional":false}],"imports":[],"quickstart":{"code":"# 1. Install prek (if not already done via pip)\n# curl --proto '=https' --tlsv1.2 -LsSf https://github.com/j178/prek/releases/download/v0.3.8/prek-installer.sh | sh\n\n# 2. Generate a sample configuration file\nprek sample-config > .pre-commit-config.yaml\n\n# 3. Install the Git hooks into your repository\nprek install\n\n# 4. Make a change to a file and commit\n# (e.g., echo 'new content' > some_file.py)\ngit add .\ngit commit -m \"My first prek-checked commit\"","lang":"bash","description":"This quickstart demonstrates how to install prek, generate a default configuration, set up the Git hooks, and trigger them with a commit. Prek will automatically use `.pre-commit-config.yaml` (or `prek.toml`) and manage hook environments."},"warnings":[{"fix":"Consider using `prek.toml` for new projects or converting existing `.pre-commit-config.yaml` files with `prek util yaml-to-toml`.","message":"Prek introduced `prek.toml` as an alternative configuration file format to `.pre-commit-config.yaml`. While existing YAML configurations are still supported, new projects or users might find `prek.toml` less error-prone. Converting existing configs can be done with `prek util yaml-to-toml`.","severity":"gotcha","affected_versions":">=0.3.2"},{"fix":"Review `files` and `exclude` patterns. Leverage the `glob` mapping for simpler glob-based filtering where appropriate, or ensure existing regex patterns are still valid and correctly escaped.","message":"The `files` and `exclude` fields in configurations now support glob lists in addition to regular expressions. While this offers more readable and maintainable filters, ensure your patterns are correctly interpreted, especially if mixing glob and regex syntaxes or migrating older, heavily escaped regex patterns.","severity":"gotcha","affected_versions":">=0.2.29"},{"fix":"Check the `prek` documentation's 'Language Support' section for specific language compatibility before migrating projects with diverse hook languages. Report any missing support to the project.","message":"Although `prek` aims for high compatibility with `pre-commit` configurations, the documentation notes that \"some languages are not yet supported for full drop-in parity.\" Users migrating from `pre-commit` with hooks in less common languages should verify support.","severity":"gotcha","affected_versions":"<0.3.8 (and ongoing)"},{"fix":"Regularly run `prek cache gc` to manage disk space and remove stale cached resources.","message":"The `prek` cache can grow over time. The `prek cache gc` command was introduced to clean up unused repositories, hook environments, and tool versions from the cache. Prior to this, manual intervention might have been necessary to manage disk space.","severity":"gotcha","affected_versions":"<0.3.0"}],"env_vars":null,"last_verified":"2026-04-05T00:00:00.000Z","next_check":"2026-07-04T00:00:00.000Z"}