Registry / testing / pre-commit-hooks

pre-commit-hooks

JSON →
library6.0.0pypypi✓ verified 25d ago

pre-commit-hooks provides a collection of frequently used Git hooks for the `pre-commit` framework, facilitating code quality checks such as trailing whitespace, end-of-file fixers, JSON/YAML validation, and detection of large files. Currently at version 6.0.0, the library releases updates periodically, often alongside the `pre-commit` framework itself, to introduce new hooks, fix issues, or update Python version requirements.

pip install pre-commit
INSTALL
IMPORT
SIG · PRE-COMMIT-HOOKS
P
pre-commit-hooks
testingpythonv6.0.0
Install
2.6s avg
Import
Disk
123MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v? · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 86.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.6s · import 0.000s · 159MB
123MB installed
● package 123MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pre-commit-hooks
This library is not imported directly into Python code. Its hooks are configured in a .pre-commit-config.yaml file for use with the `pre-commit` framework.
The 'pre-commit-hooks' package provides executables for the `pre-commit` framework, not Python modules intended for direct import.

To use `pre-commit-hooks`, you first need the `pre-commit` framework installed. Then, configure your desired hooks in a `.pre-commit-config.yaml` file in your repository root and install the git hooks. This example demonstrates a basic configuration using common hooks from the v6.0.0 release.

# 1. Create a .pre-commit-config.yaml in your repository root # Example content: # .pre-commit-config.yaml --- repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 # Use the latest version or a specific tag hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - id: check-json - id: check-added-large-files - id: debug-statements # 2. Install pre-commit (if not already installed) # pip install pre-commit # 3. Install the git hooks in your repository # pre-commit install # 4. (Optional) Manually run all hooks against all files # pre-commit run --all-files # Hooks will now run automatically on `git commit`
Debug
Known issues
breakingVersion 6.0.0 of pre-commit-hooks requires Python 3.9 or newer. Ensure your environment meets this requirement when upgrading.
fix
Upgrade your Python environment to 3.9 or later. If you need to use an older Python version, pin `pre-commit-hooks` to a version prior to 6.0.0 (e.g., `rev: v5.0.0`).
affects: >=6.0.0
breakingThe hooks `check-byte-order-marker` and `fix-encoding-pragma` were removed in v6.0.0. `fix-encoding-pragma` was deprecated in v4.6.0.
fix
For `check-byte-order-marker`, migrate to `fix-byte-order-marker`. For `fix-encoding-pragma`, consider using `pyupgrade` or a similar tool.
affects: >=6.0.0
breakingThe `file-contents-sorter` hook in v6.0.0 disallows the simultaneous use of `--unique` and `--ignore-case` arguments.
fix
Review your `file-contents-sorter` hook configuration. If both arguments are present, remove one or adjust your workflow to achieve the desired sorting behavior in two separate steps if necessary.
affects: >=6.0.0
deprecatedThe `check-docstring-first` hook is fundamentally flawed and has been deprecated without a direct replacement.
fix
Remove `check-docstring-first` from your `.pre-commit-config.yaml`. Consider using other tools for docstring validation if needed.
affects: All versions
gotchaThis library is a collection of hooks for the `pre-commit` framework. It must be configured via a `.pre-commit-config.yaml` file and requires `pre-commit` to be installed and initialized in your repository (via `pre-commit install`).
fix
Ensure `pre-commit` is installed (`pip install pre-commit`) and then run `pre-commit install` in your repository to activate the hooks. Refer to the quickstart example for configuration.
affects: All versions
Upgrade
Version history
6.0.0latest on PyPI · released Aug 9, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Resources