@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / f1acbd68c5
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 9, 11:15 UTC

[CI] Enable mypy import following for `vllm/compilation` (#33199)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>

Harry Mellor committed Jan 28, 2026 at 08:59 UTC f1acbd68c5a4388c302e2c270955147a77054cd8
5 files changed +4 -53
pyproject.toml
-7
@@ -103,13 +103,6 @@ ignore_missing_imports = true
103 check_untyped_defs = true
104 follow_imports = "silent"
105
106 -[[tool.mypy.overrides]]
107 -module = "vllm.compilation.*"
108 -disallow_untyped_defs = true
109 -disallow_incomplete_defs = true
110 -warn_return_any = true
111 -follow_imports = "silent"
112 -
106 [tool.pytest.ini_options]
107 markers = [
108 "slow_test",
tools/pre_commit/mypy.py
+4 -38
@@ -26,6 +26,7 @@ import regex as re
26 FILES = [
27 "vllm/*.py",
28 "vllm/assets",
29 + "vllm/compilation",
30 "vllm/distributed",
31 "vllm/engine",
32 "vllm/entrypoints",
@@ -58,7 +59,6 @@ FILES = [
59 SEPARATE_GROUPS = [
60 "tests",
61 # v0 related
61 - "vllm/compilation",
62 "vllm/lora",
63 "vllm/model_executor",
64 # v1 related
@@ -76,11 +76,6 @@ EXCLUDE = [
76 "vllm/v1/attention/ops",
77 ]
78
79 -# Directories that should be checked with --strict
80 -STRICT_DIRS = [
81 - "vllm/compilation",
82 -]
83 -
79
80 def group_files(changed_files: list[str]) -> dict[str, list[str]]:
81 """
@@ -112,17 +107,11 @@ def group_files(changed_files: list[str]) -> dict[str, list[str]]:
107 return file_groups
108
109
115 -def is_strict_file(filepath: str) -> bool:
116 - """Check if a file should be checked with strict mode."""
117 - return any(filepath.startswith(strict_dir) for strict_dir in STRICT_DIRS)
118 -
119 -
110 def mypy(
111 targets: list[str],
112 python_version: str | None,
113 follow_imports: str | None,
114 file_group: str,
125 - strict: bool = False,
115 ) -> int:
116 """
117 Run mypy on the given targets.
@@ -134,7 +123,6 @@ def mypy(
123 follow_imports: Value for the --follow-imports option or None to use
124 the default mypy behavior.
125 file_group: The file group name for logging purposes.
137 - strict: If True, run mypy with --strict flag.
126
127 Returns:
128 The return code from mypy.
@@ -144,8 +132,6 @@ def mypy(
132 args += ["--python-version", python_version]
133 if follow_imports is not None:
134 args += ["--follow-imports", follow_imports]
147 - if strict:
148 - args += ["--strict"]
135 print(f"$ {' '.join(args)} {file_group}")
136 return subprocess.run(args + targets, check=False).returncode
137
@@ -162,29 +148,9 @@ def main():
148 for file_group, changed_files in file_groups.items():
149 follow_imports = None if ci and file_group == "" else "skip"
150 if changed_files:
165 - # Separate files into strict and non-strict groups
166 - strict_files = [f for f in changed_files if is_strict_file(f)]
167 - non_strict_files = [f for f in changed_files if not is_strict_file(f)]
168 -
169 - # Run mypy on non-strict files
170 - if non_strict_files:
171 - returncode |= mypy(
172 - non_strict_files,
173 - python_version,
174 - follow_imports,
175 - file_group,
176 - strict=False,
177 - )
178 -
179 - # Run mypy on strict files with --strict flag
180 - if strict_files:
181 - returncode |= mypy(
182 - strict_files,
183 - python_version,
184 - follow_imports,
185 - f"{file_group} (strict)",
186 - strict=True,
187 - )
151 + returncode |= mypy(
152 + changed_files, python_version, follow_imports, file_group
153 + )
154 return returncode
155
156
vllm/compilation/inductor_pass.py
-3
@@ -29,9 +29,6 @@ else:
29 Torch25CustomGraphPass as CustomGraphPass,
30 )
31
32 -# Re-export CustomGraphPass for external usage
33 -__all__ = ["CustomGraphPass"]
34 -
32 _pass_context = None
33 P = ParamSpec("P")
34 R = TypeVar("R")
vllm/config/compilation.py
-3
@@ -32,9 +32,6 @@ else:
32
33 logger = init_logger(__name__)
34
35 -# Explicitly exports Range
36 -__all__ = ["Range"]
37 -
35
36 class CompilationMode(enum.IntEnum):
37 """The compilation approach used for torch.compile-based compilation of the
vllm/model_executor/layers/rotary_embedding/__init__.py
-2
@@ -22,8 +22,6 @@ from .yarn_scaling_rope import YaRNScalingRotaryEmbedding
22
23 _ROPE_DICT: dict[tuple[Any, ...], RotaryEmbedding] = {}
24
25 -__all__ = ["RotaryEmbedding"]
26 -
25
26 def get_rope(
27 head_size: int,