Pre-Commit-Excludes
Remove Unnecessary Excludes
remove-unnecessary-excludes finds lines in your exclude list that are no longer required and removes them from the supplied .pre-commit-config.yaml.
The tool checks each exclude by running the affected hook without excludes and restores changes made by a failing hook when the exclude is still required.
# Cleanup the entire config for all hooks
uvx --from pre-commit-excludes remove-unnecessary-excludes .pre-commit-config.yaml --pre-commit-binary prek --git-binary git --all
# Cleanup only specific hooks such as typos and ruff-check
uvx --from pre-commit-excludes remove-unnecessary-excludes .pre-commit-config.yaml --pre-commit-binary prek --git-binary git --hook typos --hook ruff-check
# Skip excludes that you want to keep
uvx --from pre-commit-excludes remove-unnecessary-excludes .pre-commit-config.yaml --pre-commit-binary prek --git-binary git --all --skip-exclude "check-json:tests/invalid.json"
Restrict Folder Excludes
restrict-folder-excludes restricts excluded folders in the .pre-commit-config.yaml exclude list from a very broad folder exclude to more fine granular excludes.
# Restrict all excluded folders for all hooks
uvx --from pre-commit-excludes restrict-folder-excludes .pre-commit-config.yaml --all
# Restrict all excluded folders for specific hooks such as typos and ruff-check and skip the tests folder for check-json
uvx --from pre-commit-excludes restrict-folder-excludes .pre-commit-config.yaml --hook typos --hook ruff-check --skip-exclude "check-json:tests"
Example for the command above
# Before
exclude: |
(?x)^(
foo|
bar
)
# After
exclude: |
(?x)^(
foo/a|
foo/b|
foo/c|
foo/foo.txt|
foo/README.md|
bar/a|
bar/bar.txt
)
Metadata
Release files for pre-commit-excludes 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pre_commit_excludes-0.6.0.tar.gz | 7.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pre_commit_excludes-0.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.3 kB
Release files / pre_commit_excludes-0.6.0.tar.gz
| Download URL | pre_commit_excludes-0.6.0.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a147de13a75fe6a0c9552fb818a6e632e2b31a53090023f45ef32d192d166d58
|
|
BLAKE2b-256 checksum How to use checksums |
96c18dc9681c98407c3ed0ae3879647de1b50624785def74d52f6ec63c78af5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.
Transparency logRelease files / pre_commit_excludes-0.6.0-py3-none-any.whl
| Download URL | pre_commit_excludes-0.6.0-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e9d14d038d2ba512589aa68e9a06fe69abf639f9fbbaea9283466492555ae6fa
|
|
BLAKE2b-256 checksum How to use checksums |
3b6f6e5e6f3471dec74052ed566bcd4dc9c007dca6083368daeb43803c328b62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.
Transparency log