2025-04-01 16:41:30 +01:00
default_install_hook_types :
- pre-commit
- commit-msg
2025-01-20 17:36:24 +08:00
default_stages :
- pre-commit # Run locally
- manual # Run in CI
2025-02-27 16:27:47 +00:00
exclude : 'vllm/third_party/.*'
2025-01-20 06:58:01 +00:00
repos :
- repo : https://github.com/google/yapf
2025-01-28 00:23:08 +00:00
rev : v0.43.0
2025-01-20 06:58:01 +00:00
hooks :
- id : yapf
args : [ --in-place, --verbose]
2025-06-04 22:40:04 -07:00
# Keep the same list from yapfignore here to avoid yapf failing without any inputs
exclude : '(.buildkite|benchmarks|build|examples)/.*'
2025-01-20 06:58:01 +00:00
- repo : https://github.com/astral-sh/ruff-pre-commit
2025-04-29 14:46:55 +01:00
rev : v0.11.7
2025-01-20 06:58:01 +00:00
hooks :
- id : ruff
2025-02-13 02:45:38 -05:00
args : [ --output-format, github, --fix]
2025-05-13 10:28:31 +01:00
- id : ruff-format
2025-05-26 17:57:54 +01:00
files : ^(.buildkite|benchmarks|examples)/.*
2025-06-12 10:57:10 +08:00
- repo : https://github.com/crate-ci/typos
2025-07-16 12:12:40 +08:00
rev : v1.34.0
2025-01-20 06:58:01 +00:00
hooks :
2025-06-12 10:57:10 +08:00
- id : typos
2025-01-20 06:58:01 +00:00
- repo : https://github.com/PyCQA/isort
2025-04-29 14:46:55 +01:00
rev : 6.0 .1
2025-01-20 06:58:01 +00:00
hooks :
- id : isort
- repo : https://github.com/pre-commit/mirrors-clang-format
2025-04-29 14:46:55 +01:00
rev : v20.1.3
2025-01-20 06:58:01 +00:00
hooks :
- id : clang-format
2025-02-09 15:00:00 +08:00
exclude : 'csrc/(moe/topk_softmax_kernels.cu|quantization/gguf/(ggml-common.h|dequantize.cuh|vecdotq.cuh|mmq.cuh|mmvq.cuh))|vllm/third_party/.*'
2025-01-20 06:58:01 +00:00
types_or : [ c++, cuda]
args : [ --style=file, --verbose]
2025-07-30 03:45:08 +01:00
- repo : https://github.com/igorshubovych/markdownlint-cli
rev : v0.45.0
2025-01-20 06:58:01 +00:00
hooks :
2025-07-30 22:17:14 +08:00
- id : markdownlint
2025-05-23 11:09:53 +02:00
exclude : '.*\.inc\.md'
2025-07-30 22:17:14 +08:00
stages : [ manual] # Only run in CI
2025-01-20 18:06:24 +08:00
- repo : https://github.com/rhysd/actionlint
2025-01-28 00:23:08 +00:00
rev : v1.7.7
2025-01-20 18:06:24 +08:00
hooks :
- id : actionlint
2025-02-21 06:03:27 +00:00
- repo : https://github.com/astral-sh/uv-pre-commit
2025-04-29 14:46:55 +01:00
rev : 0.6 .17
2025-02-21 06:03:27 +00:00
hooks :
- id : pip-compile
2025-05-02 21:40:15 -07:00
args : [ requirements/test.in, -o, requirements/test.txt, --index-strategy, unsafe-best-match, --torch-backend, cu128]
2025-03-08 17:44:35 +01:00
files : ^requirements/test\.(in|txt)$
2025-01-20 06:58:01 +00:00
- repo : local
hooks :
2025-06-26 20:55:25 -07:00
- id : format-torch-nightly-test
name : reformat nightly_torch_test.txt to be in sync with test.in
language : python
entry : python tools/generate_nightly_torch_test.py
files : ^requirements/test\.(in|txt)$
2025-01-20 17:36:24 +08:00
- id : mypy-local
name : Run mypy for local Python installation
2025-01-20 23:49:18 +08:00
entry : tools/mypy.sh 0 "local"
2025-01-20 17:36:24 +08:00
language : python
types : [ python]
2025-05-28 13:46:04 +01:00
additional_dependencies : &mypy_deps [ mypy==1.11.1, types-cachetools, types-setuptools, types-PyYAML, types-requests, pydantic]
2025-01-20 17:36:24 +08:00
stages : [ pre-commit] # Don't run in CI
2025-01-20 06:58:01 +00:00
- id: mypy-3.9 # TODO : Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
name : Run mypy for Python 3.9
entry : tools/mypy.sh 1 "3.9"
language : python
types : [ python]
2025-01-20 17:36:24 +08:00
additional_dependencies : *mypy_deps
stages : [ manual] # Only run in CI
2025-01-20 06:58:01 +00:00
- id: mypy-3.10 # TODO : Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
name : Run mypy for Python 3.10
entry : tools/mypy.sh 1 "3.10"
language : python
types : [ python]
additional_dependencies : *mypy_deps
2025-01-20 17:36:24 +08:00
stages : [ manual] # Only run in CI
2025-01-20 06:58:01 +00:00
- id: mypy-3.11 # TODO : Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
name : Run mypy for Python 3.11
entry : tools/mypy.sh 1 "3.11"
language : python
types : [ python]
additional_dependencies : *mypy_deps
2025-01-20 17:36:24 +08:00
stages : [ manual] # Only run in CI
2025-01-20 06:58:01 +00:00
- id: mypy-3.12 # TODO : Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
name : Run mypy for Python 3.12
entry : tools/mypy.sh 1 "3.12"
language : python
types : [ python]
additional_dependencies : *mypy_deps
2025-01-20 17:36:24 +08:00
stages : [ manual] # Only run in CI
2025-01-20 06:58:01 +00:00
- id : shellcheck
name : Lint shell scripts
entry : tools/shellcheck.sh
language : script
types : [ shell]
- id : png-lint
name : Lint PNG exports from excalidraw
entry : tools/png-lint.sh
language : script
types : [ png]
2025-01-31 12:30:33 -08:00
- id : signoff-commit
name : Sign-off Commit
entry : bash
args :
- -c
- |
2025-05-05 13:55:32 -04:00
if ! grep -q "^Signed-off-by: $(git config user.name) <$(git config user.email)>" "$(git rev-parse --git-path COMMIT_EDITMSG)"; then
printf "\nSigned-off-by: $(git config user.name) <$(git config user.email)>\n" >> "$(git rev-parse --git-path COMMIT_EDITMSG)"
2025-01-31 12:30:33 -08:00
fi
language : system
verbose : true
stages : [ commit-msg]
2025-02-02 14:58:18 -05:00
- id : check-spdx-header
name : Check SPDX headers
entry : python tools/check_spdx_header.py
language : python
types : [ python]
2025-06-22 19:11:22 -04:00
- id : check-root-lazy-imports
name : Check root lazy imports
entry : python tools/check_init_lazy_imports.py
language : python
types : [ python]
2025-02-06 15:36:21 -08:00
- id : check-filenames
name : Check for spaces in all filenames
2025-02-07 05:04:39 -08:00
entry : bash
args :
- -c
- 'git ls-files | grep " " && echo "Filenames should not contain spaces!" && exit 1 || exit 0'
2025-02-06 15:36:21 -08:00
language : system
always_run : true
pass_filenames : false
2025-04-10 21:43:05 +08:00
- id : update-dockerfile-graph
name : Update Dockerfile dependency graph
entry : tools/update-dockerfile-graph.sh
language : script
2025-05-24 11:04:14 -04:00
- id : enforce-import-regex-instead-of-re
name : Enforce import regex as re
entry : python tools/enforce_regex_import.py
language : python
types : [ python]
pass_filenames : false
additional_dependencies : [ regex]
2025-05-24 20:09:15 +08:00
# forbid directly import triton
- id : forbid-direct-triton-import
name : "Forbid direct 'import triton'"
entry : python tools/check_triton_import.py
language : python
types : [ python]
pass_filenames : false
2025-05-27 17:19:18 +08:00
additional_dependencies : [ regex]
2025-06-12 06:30:17 -04:00
- id : check-pickle-imports
name : Prevent new pickle/cloudpickle imports
entry : python tools/check_pickle_imports.py
language : python
types : [ python]
pass_filenames : false
additional_dependencies : [ pathspec, regex]
2025-07-01 05:10:28 -04:00
- id : validate-config
name : Validate configuration has default values and that each field has a docstring
entry : python tools/validate_config.py
language : python
types : [ python]
pass_filenames : true
2025-07-15 02:23:42 -07:00
files : vllm/config.py|tests/test_config.py|vllm/entrypoints/openai/cli_args.py
2025-02-11 17:34:16 -05:00
# Keep `suggestion` last
- id : suggestion
name : Suggestion
2025-07-07 10:42:06 +08:00
entry : bash -c 'echo "To bypass all the pre-commit hooks, add --no-verify to git commit. To skip a specific hook, prefix the commit command with SKIP=<hook-id>."'
2025-02-11 17:34:16 -05:00
language : system
verbose : true
pass_filenames : false
# Insert new entries above the `suggestion` entry