[CI/Build] Move pre-commit only scripts to tools/pre_commit (#27657)

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
This commit is contained in:
Cyrus Leung
2025-10-29 16:04:33 +08:00
committed by GitHub
parent 413ef7a3b4
commit 4fb8771cc0
15 changed files with 16 additions and 17 deletions

View File

@ -38,7 +38,7 @@ steps:
- label: Pytorch Nightly Dependency Override Check # 2min - label: Pytorch Nightly Dependency Override Check # 2min
# if this test fails, it means the nightly torch version is not compatible with some # if this test fails, it means the nightly torch version is not compatible with some
# of the dependencies. Please check the error message and add the package to whitelist # of the dependencies. Please check the error message and add the package to whitelist
# in /vllm/tools/generate_nightly_torch_test.py # in /vllm/tools/pre_commit/generate_nightly_torch_test.py
mirror_hardwares: [amdexperimental] mirror_hardwares: [amdexperimental]
agent_pool: mi325_1 agent_pool: mi325_1
# grade: Blocking # grade: Blocking

View File

@ -38,7 +38,7 @@ steps:
- label: Pytorch Nightly Dependency Override Check # 2min - label: Pytorch Nightly Dependency Override Check # 2min
# if this test fails, it means the nightly torch version is not compatible with some # if this test fails, it means the nightly torch version is not compatible with some
# of the dependencies. Please check the error message and add the package to whitelist # of the dependencies. Please check the error message and add the package to whitelist
# in /vllm/tools/generate_nightly_torch_test.py # in /vllm/tools/pre_commit/generate_nightly_torch_test.py
soft_fail: true soft_fail: true
source_file_dependencies: source_file_dependencies:
- requirements/nightly_torch_test.txt - requirements/nightly_torch_test.txt

View File

@ -45,7 +45,7 @@ repos:
- id: format-torch-nightly-test - id: format-torch-nightly-test
name: reformat nightly_torch_test.txt to be in sync with test.in name: reformat nightly_torch_test.txt to be in sync with test.in
language: python language: python
entry: python tools/generate_nightly_torch_test.py entry: python tools/pre_commit/generate_nightly_torch_test.py
files: ^requirements/test\.(in|txt)$ files: ^requirements/test\.(in|txt)$
- id: mypy-local - id: mypy-local
name: Run mypy locally for lowest supported Python version name: Run mypy locally for lowest supported Python version
@ -78,12 +78,12 @@ repos:
stages: [manual] # Only run in CI stages: [manual] # Only run in CI
- id: shellcheck - id: shellcheck
name: Lint shell scripts name: Lint shell scripts
entry: tools/shellcheck.sh entry: tools/pre_commit/shellcheck.sh
language: script language: script
types: [shell] types: [shell]
- id: png-lint - id: png-lint
name: Lint PNG exports from excalidraw name: Lint PNG exports from excalidraw
entry: tools/png-lint.sh entry: tools/pre_commit/png-lint.sh
language: script language: script
types: [png] types: [png]
- id: signoff-commit - id: signoff-commit
@ -100,12 +100,12 @@ repos:
stages: [commit-msg] stages: [commit-msg]
- id: check-spdx-header - id: check-spdx-header
name: Check SPDX headers name: Check SPDX headers
entry: python tools/check_spdx_header.py entry: python tools/pre_commit/check_spdx_header.py
language: python language: python
types: [python] types: [python]
- id: check-root-lazy-imports - id: check-root-lazy-imports
name: Check root lazy imports name: Check root lazy imports
entry: python tools/check_init_lazy_imports.py entry: python tools/pre_commit/check_init_lazy_imports.py
language: python language: python
types: [python] types: [python]
- id: check-filenames - id: check-filenames
@ -119,11 +119,11 @@ repos:
pass_filenames: false pass_filenames: false
- id: update-dockerfile-graph - id: update-dockerfile-graph
name: Update Dockerfile dependency graph name: Update Dockerfile dependency graph
entry: tools/update-dockerfile-graph.sh entry: tools/pre_commit/update-dockerfile-graph.sh
language: script language: script
- id: enforce-import-regex-instead-of-re - id: enforce-import-regex-instead-of-re
name: Enforce import regex as re name: Enforce import regex as re
entry: python tools/enforce_regex_import.py entry: python tools/pre_commit/enforce_regex_import.py
language: python language: python
types: [python] types: [python]
pass_filenames: false pass_filenames: false
@ -131,7 +131,7 @@ repos:
# forbid directly import triton # forbid directly import triton
- id: forbid-direct-triton-import - id: forbid-direct-triton-import
name: "Forbid direct 'import triton'" name: "Forbid direct 'import triton'"
entry: python tools/check_triton_import.py entry: python tools/pre_commit/check_triton_import.py
language: python language: python
types: [python] types: [python]
pass_filenames: false pass_filenames: false
@ -144,7 +144,7 @@ repos:
additional_dependencies: [regex] additional_dependencies: [regex]
- id: validate-config - id: validate-config
name: Validate configuration has default values and that each field has a docstring name: Validate configuration has default values and that each field has a docstring
entry: python tools/validate_config.py entry: python tools/pre_commit/validate_config.py
language: python language: python
additional_dependencies: [regex] additional_dependencies: [regex]
# Keep `suggestion` last # Keep `suggestion` last

View File

@ -37,6 +37,6 @@ if diff before.txt after.txt; then
else else
echo "torch version overridden by nightly_torch_test.txt, \ echo "torch version overridden by nightly_torch_test.txt, \
if the dependency is not triggered by the pytroch nightly test,\ if the dependency is not triggered by the pytroch nightly test,\
please add the dependency to the list 'white_list' in tools/generate_nightly_torch_test.py" please add the dependency to the list 'white_list' in tools/pre_commit/generate_nightly_torch_test.py"
exit 1 exit 1
fi fi

View File

@ -5,7 +5,7 @@ import ast
import pytest import pytest
from tools.validate_config import validate_ast from tools.pre_commit.validate_config import validate_ast
_TestConfig1 = """ _TestConfig1 = """
@config @config

View File

@ -6,13 +6,12 @@ i.e: appears only within the `if typing.TYPE_CHECKING:` guard,
""" """
import ast import ast
import pathlib
import sys import sys
from collections.abc import Iterable from collections.abc import Iterable
from pathlib import Path
from typing import Final from typing import Final
REPO_ROOT: Final = pathlib.Path(__file__).resolve().parent.parent INIT_PATH: Final = Path("vllm/__init__.py")
INIT_PATH: Final = REPO_ROOT / "vllm" / "__init__.py"
# If you need to add items to whitelist, do it here. # If you need to add items to whitelist, do it here.
ALLOWED_IMPORTS: Final[frozenset[str]] = frozenset( ALLOWED_IMPORTS: Final[frozenset[str]] = frozenset(

View File

@ -33,7 +33,7 @@ def config(cls: ConfigT) -> ConfigT:
`pydantic.TypeAdapter(ConfigT).validate_json(cli_arg)` which treats the `pydantic.TypeAdapter(ConfigT).validate_json(cli_arg)` which treats the
`cli_arg` as a JSON string which gets validated by `pydantic`. `cli_arg` as a JSON string which gets validated by `pydantic`.
Config validation is performed by the tools/validate_config.py Config validation is performed by the tools/pre_commit/validate_config.py
script, which is invoked during the pre-commit checks. script, which is invoked during the pre-commit checks.
""" """
return cls return cls