[CI/Build] Add bc-linter to vLLM CI (#21234)

Signed-off-by: zhewenli <zhewenli@meta.com>
This commit is contained in:
Zhewen Li
2025-09-11 15:34:36 -07:00
committed by GitHub
parent 569bf1c9c0
commit 7d4651997a
5 changed files with 121 additions and 0 deletions
+6
View File
@@ -14,6 +14,8 @@ import typing
import vllm.env_override # noqa: F401
MODULE_ATTRS = {
"bc_linter_skip": "._bc_linter:bc_linter_skip",
"bc_linter_include": "._bc_linter:bc_linter_include",
"AsyncEngineArgs": ".engine.arg_utils:AsyncEngineArgs",
"EngineArgs": ".engine.arg_utils:EngineArgs",
"AsyncLLMEngine": ".engine.async_llm_engine:AsyncLLMEngine",
@@ -54,6 +56,8 @@ if typing.TYPE_CHECKING:
ScoringRequestOutput)
from vllm.pooling_params import PoolingParams
from vllm.sampling_params import SamplingParams
from ._bc_linter import bc_linter_include, bc_linter_skip
else:
def __getattr__(name: str) -> typing.Any:
@@ -70,6 +74,8 @@ else:
__all__ = [
"__version__",
"bc_linter_skip",
"bc_linter_include",
"__version_tuple__",
"LLM",
"ModelRegistry",
+59
View File
@@ -0,0 +1,59 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# vllm/_bc_linter.py
from __future__ import annotations
from typing import Any, Callable, TypeVar, overload
T = TypeVar("T")
@overload
def bc_linter_skip(obj: T) -> T:
...
@overload
def bc_linter_skip(*, reason: str | None = ...) -> Callable[[T], T]:
...
def bc_linter_skip(obj: Any = None, *, reason: str | None = None):
"""
No-op decorator to mark symbols/files for BC-linter suppression.
Usage:
@bc_linter_skip
def legacy_api(...): ...
"""
def _wrap(x: T) -> T:
return x
return _wrap if obj is None else obj
@overload
def bc_linter_include(obj: T) -> T:
...
@overload
def bc_linter_include(*, reason: str | None = ...) -> Callable[[T], T]:
...
def bc_linter_include(obj: Any = None, *, reason: str | None = None):
"""
Usage:
@bc_linter_include
def public_api(...): ...
"""
def _wrap(x: T) -> T:
return x
return _wrap if obj is None else obj
__all__ = ["bc_linter_skip", "bc_linter_include"]
+5
View File
@@ -6,6 +6,8 @@ from __future__ import annotations
from dataclasses import dataclass
from typing import TYPE_CHECKING, Optional
from vllm import bc_linter_include
if TYPE_CHECKING:
import numpy as np
import numpy.typing as npt
@@ -19,6 +21,7 @@ if TYPE_CHECKING:
from vllm.v1.request import Request
@bc_linter_include
@dataclass
class NewRequestData:
@@ -80,6 +83,7 @@ class NewRequestData:
")")
@bc_linter_include
@dataclass
class CachedRequestData:
@@ -109,6 +113,7 @@ class CachedRequestData:
)
@bc_linter_include
@dataclass
class SchedulerOutput: