Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
412 lines (412 loc) · 16.8 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
412 lines (412 loc) · 16.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
default_install_hook_types:
- pre-commit
- commit-msg
default_stages:
- pre-commit # Run locally
- manual # Run in CI
exclude: 'vllm/third_party/.*|vllm/models/kimi_k3/nvidia/ops/third_party/.*|vllm/models/kimi_k3/amd/ops/third_party/.*'
# Revs are frozen to commit SHAs, bump them with `pre-commit autoupdate --freeze [--repo <url>]`
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: f368fb366ff7f2f808dd324b83a6d32267799e19 # frozen: v0.17.2
hooks:
- id: ruff-check
args: [--output-format, github, --fix]
- id: ruff-format
types_or: [python, pyi, jupyter]
- repo: https://github.com/crate-ci/typos
rev: 9023c1f779400877cafdd98052113fc777e2cfdc # frozen: v1.51.1
hooks:
- id: typos
args: [--force-exclude]
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: 98ad4ddb9c057de2f5b9e93e44e6db959807d68c # frozen: v23.1.3
hooks:
- id: clang-format
exclude: 'csrc/moe/topk_softmax_kernels.cu|vllm/third_party/.*'
types_or: [c++, cuda]
args: [--style=file, --verbose]
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: 341e2a331ba578029e66c2e01183e7a6b5ca9ab4 # frozen: v0.24.0
hooks:
- id: markdownlint-cli2
language_version: 24.22.1 # Node 26 (current lts) needs libatomic, which the CI runners lack
args: [--config, tools/pre_commit/.markdownlint.yaml, --fix]
- repo: https://github.com/rhysd/actionlint
rev: 914e7df21a07ef503a81201c76d2b11c789d3fca # frozen: v1.7.12
hooks:
- id: actionlint
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: a6564f5d57444e123433a5c9af733e3975c77229 # frozen: v0.11.0.1-1
hooks:
- id: shellcheck
args: ["-s", "bash", "--format=gcc", "--rcfile=tools/pre_commit/.shellcheckrc"]
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 46787482b9fb2003c56e0f7592e312ef381829d9 # frozen: 0.13.6
hooks:
- id: pip-compile
args: [
--generate-hashes,
requirements/test/cuda.in,
-c, requirements/cuda.txt,
-o, requirements/test/cuda.txt,
--index-strategy, unsafe-best-match,
# Emit the cu132 index into the lock so installs resolve torch, torchvision,
# torchaudio and torchcodec to their +cu132 builds.
--extra-index-url, "https://download.pytorch.org/whl/cu132",
--emit-index-url,
--python-platform, x86_64-manylinux_2_28,
--python-version, "3.12",
]
files: ^(requirements/(common|cuda|test/cuda)\.(in|txt)|pyproject\.toml|\.pre-commit-config\.yaml)$
- id: pip-compile
alias: pip-compile-kv-connectors
name: pip-compile-kv-connectors
args: [
requirements/test/kv_connectors_cuda.in,
-c, requirements/cuda.txt,
-c, requirements/test/cuda.txt,
-o, requirements/test/kv_connectors_cuda.txt,
--override, requirements/test/kv_connectors_cuda.overrides,
--generate-hashes,
# nixl pulls both CUDA variants; the CUDA 13 image keeps only nixl-cu13.
--no-emit-package, nixl-cu12,
# The image pins NCCL itself (NCCL_VERSION + UV_OVERRIDE).
--no-emit-package, nvidia-nccl-cu13,
--index-strategy, unsafe-best-match,
--torch-backend, cu132,
--python-platform, x86_64-manylinux_2_28,
--python-version, "3.12",
]
files: ^requirements/(common|cuda|test/(cuda|kv_connectors_cuda))\.(in|txt|overrides)$
- id: pip-compile
alias: pip-compile-quantization-deps
name: pip-compile-quantization-deps
args: [
requirements/test/quantization_deps.in,
-o, requirements/test/quantization_deps_cuda.txt,
--generate-hashes,
# The image installs these into /opt/quantization-deps; their deps are in requirements/test/cuda.txt.
--no-deps,
--index-strategy, unsafe-best-match,
--torch-backend, cu132,
--python-platform, x86_64-manylinux_2_28,
--python-version, "3.12",
]
files: ^requirements/test/quantization_deps(\.in|_cuda\.txt)$
- id: pip-compile
alias: pip-compile-quantization-deps-rocm
name: pip-compile-quantization-deps-rocm
args: [
requirements/test/quantization_deps.in,
-o, requirements/test/quantization_deps_rocm.txt,
--generate-hashes,
# The ROCm image installs these into /opt/quantization-deps; their deps are in requirements/test/rocm.txt.
--no-deps,
# ROCm already ships conch in site-packages (requirements/rocm.txt).
--no-emit-package, conch-triton-kernels,
--python-platform, x86_64-manylinux_2_28,
--python-version, "3.12",
]
files: ^requirements/test/quantization_deps(\.in|_rocm\.txt)$
- id: pip-compile
alias: pip-compile-rocm
name: pip-compile-rocm
args: [
--generate-hashes,
requirements/test/rocm.in,
-c, requirements/rocm.txt,
-o, requirements/test/rocm.txt,
--index-strategy, unsafe-best-match,
--python-platform, x86_64-manylinux_2_28,
--python-version, "3.12",
# Exclude torch and CUDA/NVIDIA packages
--no-emit-package, torch,
--no-emit-package, torchvision,
--no-emit-package, torchaudio,
--no-emit-package, triton,
--no-emit-package, cuda-bindings,
--no-emit-package, cuda-pathfinder,
--no-emit-package, cuda-toolkit,
--no-emit-package, cupy-cuda12x,
# nvidia packages (unsuffixed / unified naming)
--no-emit-package, nvidia-cublas,
--no-emit-package, nvidia-cuda-cccl,
--no-emit-package, nvidia-cuda-cupti,
--no-emit-package, nvidia-cuda-nvrtc,
--no-emit-package, nvidia-cuda-runtime,
--no-emit-package, nvidia-cudnn,
--no-emit-package, nvidia-cufft,
--no-emit-package, nvidia-cufile,
--no-emit-package, nvidia-curand,
--no-emit-package, nvidia-cusolver,
--no-emit-package, nvidia-cusparse,
--no-emit-package, nvidia-cusparselt,
--no-emit-package, nvidia-nccl,
--no-emit-package, nvidia-nvjitlink,
--no-emit-package, nvidia-nvshmem,
--no-emit-package, nvidia-nvtx,
# nvidia cu12 packages
--no-emit-package, nvidia-cublas-cu12,
--no-emit-package, nvidia-cuda-cupti-cu12,
--no-emit-package, nvidia-cuda-nvrtc-cu12,
--no-emit-package, nvidia-cuda-runtime-cu12,
--no-emit-package, nvidia-cudnn-cu12,
--no-emit-package, nvidia-cufft-cu12,
--no-emit-package, nvidia-cufile-cu12,
--no-emit-package, nvidia-curand-cu12,
--no-emit-package, nvidia-cusolver-cu12,
--no-emit-package, nvidia-cusparse-cu12,
--no-emit-package, nvidia-cusparselt-cu12,
--no-emit-package, nvidia-nccl-cu12,
--no-emit-package, nvidia-nvjitlink-cu12,
--no-emit-package, nvidia-nvshmem-cu12,
--no-emit-package, nvidia-nvtx-cu12,
# nvidia cu13 packages
--no-emit-package, nvidia-cublas-cu13,
--no-emit-package, nvidia-cuda-cupti-cu13,
--no-emit-package, nvidia-cuda-nvrtc-cu13,
--no-emit-package, nvidia-cuda-runtime-cu13,
--no-emit-package, nvidia-cudnn-cu13,
--no-emit-package, nvidia-cufft-cu13,
--no-emit-package, nvidia-cufile-cu13,
--no-emit-package, nvidia-curand-cu13,
--no-emit-package, nvidia-cusolver-cu13,
--no-emit-package, nvidia-cusparse-cu13,
--no-emit-package, nvidia-cusparselt-cu13,
--no-emit-package, nvidia-nccl-cu13,
--no-emit-package, nvidia-nvjitlink-cu13,
--no-emit-package, nvidia-nvshmem-cu13,
--no-emit-package, nvidia-nvtx-cu13,
]
files: ^(requirements/(common|rocm|test/rocm)\.(in|txt)|pyproject\.toml|\.pre-commit-config\.yaml)$
- id: pip-compile
alias: pip-compile-xpu
name: pip-compile-xpu
args: [
--generate-hashes,
requirements/test/xpu.in,
-c, requirements/xpu.txt,
-o, requirements/test/xpu.txt,
--index-strategy, unsafe-best-match,
--python-platform, x86_64-manylinux_2_39,
--python-version, "3.12",
]
files: ^(requirements/(common|xpu|test/xpu)\.(in|txt)|pyproject\.toml|\.pre-commit-config\.yaml)$
- id: pip-compile
alias: pip-compile-cpu
name: pip-compile-cpu
args: [
--generate-hashes,
requirements/test/cuda.in,
-o, requirements/test/cpu.txt,
--index-strategy, unsafe-best-match,
--torch-backend, cpu,
--python-platform, x86_64-manylinux_2_28,
--python-version, "3.12",
]
files: ^(requirements/(common|cpu|test/(cuda|cpu))\.(in|txt)|pyproject\.toml|\.pre-commit-config\.yaml)$
exclude: ^requirements/test/cuda\.txt$
- id: pip-compile
alias: pip-compile-docs
name: pip-compile-docs
args: [
--generate-hashes,
requirements/docs.in,
-o, requirements/docs.txt,
--python-platform, x86_64-manylinux_2_28,
--python-version, "3.12",
]
files: ^(requirements/docs\.(in|txt)|pyproject\.toml|\.pre-commit-config\.yaml)$
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
hooks:
- id: check-json
files: ^\.buildkite/.*\.json$
- repo: local
hooks:
- id: check-github-actions-pins
name: Check GitHub Actions use immutable references
language: python
entry: python tools/pre_commit/check_github_actions_pins.py
files: ^(\.github/workflows/.*\.ya?ml|.*/action\.ya?ml)$
additional_dependencies: [PyYAML, regex]
- id: format-torch-nightly-test
name: reformat test/nightly-torch.txt to be in sync with test/cuda.in
language: python
entry: python tools/pre_commit/generate_nightly_torch_test.py
files: ^requirements/test/cuda\.(in|txt)$
- id: check-label-rules
name: Check auto-label rules still match real files
language: python
entry: python tools/pre_commit/check_label_rules.py
files: ^\.github/mergify\.yml$
pass_filenames: false
additional_dependencies: [PyYAML, regex]
- id: check-agent-files
name: Check agent instruction files and skills
language: python
entry: python tools/pre_commit/check_agent_files.py
files: ^(\.agents/|\.claude/|(.*/)?(AGENTS|CLAUDE)\.md$|tools/pre_commit/check_agent_files\.py$)
pass_filenames: false
additional_dependencies: [PyYAML, regex]
verbose: true # `note:` lines are advisory, so the hook passes
- id: check-buildkite-step-keys
name: Check every Buildkite step declares an explicit key
language: python
entry: python tools/pre_commit/check_buildkite_step_keys.py
files: ^\.buildkite/.*\.ya?ml$
pass_filenames: false
additional_dependencies: [PyYAML]
- id: check-test-tethering
name: Check new tests are wired into Buildkite CI
language: python
entry: python tools/pre_commit/check_test_tethering.py
files: ^(tests/.*\.py|\.buildkite/(test_areas|hardware_tests|intel_jobs)/.*\.yaml|\.buildkite/(test-amd|ci_config[^/]*)\.yaml|tools/pre_commit/test_tethering_allowlist\.txt)$
additional_dependencies: [PyYAML, regex]
verbose: true # full-scan `note:` lines are advisory, so the hook passes
require_serial: true # one full scan, not one per pre-commit file batch
- id: mypy # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
name: Run mypy for the oldest supported Python version
entry: python tools/pre_commit/mypy.py "3.11"
language: python
types_or: [python, pyi]
require_serial: true
additional_dependencies: ["mypy==1.20.2", regex, types-cachetools, types-setuptools, types-PyYAML, types-requests, types-torch, "pydantic==2.13.5"]
- id: png-lint
name: Lint PNG exports from excalidraw
entry: tools/pre_commit/png-lint.sh
language: script
types: [png]
- id: signoff-commit
name: Sign-off Commit
entry: bash
args:
- -c
- |
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)"
fi
language: system
verbose: true
stages: [commit-msg]
- id: check-spdx-header
name: Check SPDX headers
entry: python tools/pre_commit/check_spdx_header.py
language: python
types_or: [python, rust, proto]
- id: check-root-lazy-imports
name: Check root lazy imports
entry: python tools/pre_commit/check_init_lazy_imports.py
language: python
types: [python]
- id: check-filenames
name: Check for spaces in all filenames
entry: bash
args:
- -c
- 'git ls-files | grep " " && echo "Filenames should not contain spaces!" && exit 1 || exit 0'
language: system
always_run: true
pass_filenames: false
- id: update-dockerfile-graph
name: Update Dockerfile dependency graph
entry: tools/pre_commit/update-dockerfile-graph.sh
language: script
- id: test-nonroot-entrypoint
name: Test non-root entrypoint wrapper
entry: bash docker/entrypoints/test_vllm_nonroot_entrypoint.sh
language: system
pass_filenames: false
files: ^docker/entrypoints/(vllm-nonroot-entrypoint|test_vllm_nonroot_entrypoint)\.sh$
- id: check-forbidden-strings
name: Check for forbidden strings
entry: python tools/pre_commit/check_forbidden_strings.py
language: python
types: [python]
additional_dependencies: [regex]
# prevent use torch.cuda APIs
- id: check-torch-cuda-call
name: "Prevent new 'torch.cuda' APIs call"
entry: python tools/pre_commit/check_torch_cuda.py
language: python
types: [python]
additional_dependencies: [regex]
- id: validate-config
name: Validate configuration has default values and that each field has a docstring
entry: python tools/pre_commit/validate_config.py
language: python
additional_dependencies: [regex]
- id: validate-docker-versions
name: Validate docker/versions.json matches Dockerfile
entry: python tools/generate_versions_json.py --check
language: python
files: ^docker/(Dockerfile|versions\.json)$
pass_filenames: false
additional_dependencies: [dockerfile-parse]
- id: check-kv-connector-lock
name: Check the CI KV connector lock matches requirements/kv_connectors.txt
entry: python tools/kv_connector_lock.py align
language: python
files: ^(requirements/(kv_connectors\.txt|test/kv_connectors_cuda\.(in|txt))|tools/kv_connector_lock\.py)$
pass_filenames: false
additional_dependencies: [packaging]
- id: check-dockerignore-tracked
name: Check .dockerignore does not exclude tracked files
entry: python tools/pre_commit/check_dockerignore_tracked.py
language: python
always_run: true
pass_filenames: false
- id: check-boolean-context-manager
name: Check for boolean ops in with-statements
entry: python tools/pre_commit/check_boolean_context_manager.py
language: python
types: [python]
- id: check-docstring-style
name: Check docstring Markdown style
entry: python tools/pre_commit/check_docstring_style.py
language: python
types: [python]
# Its own docstrings show the forms it rewrites
exclude: ^tools/pre_commit/check_docstring_style\.py$
additional_dependencies: [regex]
- id: check-trust-remote-code
name: Check for hardcoded trust_remote_code=True
entry: python tools/pre_commit/check_trust_remote_code.py
language: python
types: [python]
files: ^vllm/
# Rust hooks. These shell out to `cargo`; tools/pre_commit/rust-check.sh
# skips with a warning when cargo is not installed.
- id: rust-cargo-autoinherit
name: Rust - Normalize Cargo manifests with autoinherit
entry: tools/pre_commit/rust-check.sh autoinherit --prefer-simple-dotted
language: script
pass_filenames: false
require_serial: true
stages: [pre-commit] # Only run locally as Buildkite will cover this
files: ^rust/(Cargo\.toml|proto/Cargo\.toml|src/.*/Cargo\.toml)$
- id: rust-cargo-sort
name: Rust - Sort Cargo manifest sections
entry: tools/pre_commit/rust-check.sh sort --workspace
language: script
pass_filenames: false
require_serial: true
stages: [pre-commit] # Only run locally as Buildkite will cover this
files: ^rust/(Cargo\.toml|proto/Cargo\.toml|src/.*/Cargo\.toml)$
- id: rust-cargo-fmt
name: Rust - Format code
entry: tools/pre_commit/rust-check.sh fmt
language: script
pass_filenames: false
require_serial: true
stages: [pre-commit] # Only run locally as Buildkite will cover this
files: ^rust/.*(\.rs|Cargo\.toml|rustfmt\.toml)$
# Keep `suggestion` last
- id: suggestion
name: Suggestion
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>."'
language: system
verbose: true
pass_filenames: false
# Insert new entries above the `suggestion` entry