@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 7d4651997a
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 14, 05:30 UTC

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

Signed-off-by: zhewenli <zhewenli@meta.com>

Zhewen Li committed Sep 11, 2025 at 15:34 UTC 7d4651997a57bc3ed5ad49e0e96baf41020979c8
5 files changed +121
.github/.bc-linter.yml new
+24
@@ -0,0 +1,24 @@
1 +# doc: https://github.com/pytorch/test-infra/blob/main/tools/stronghold/docs/bc_linter_config.md
2 +version: 1
3 +paths:
4 +# We temporarily disable globally, and will only enable with `annotations.include`
5 +# include:
6 +# - "vllm/v1/attetion/*.py"
7 +# - "vllm/v1/core/*.py"
8 +exclude:
9 + - "**/*.py"
10 +
11 +scan:
12 + functions: true # check free functions and methods
13 + classes: true # check classes/dataclasses
14 + public_only: true # ignore names starting with "_" at any level
15 +
16 +annotations:
17 + include: # decorators that force‑include a symbol
18 + - name: "bc_linter_include" # matched by simple name or dotted suffix
19 + propagate_to_members: false # for classes, include methods/inner classes
20 + exclude: # decorators that force‑exclude a symbol
21 + - name: "bc_linter_skip" # matched by simple name or dotted suffix
22 + propagate_to_members: true # for classes, exclude methods/inner classes
23 +
24 +excluded_violations: [] # e.g. ["ParameterRenamed", "FieldTypeChanged"]
.github/workflows/bc-lint.yml new
+27
@@ -0,0 +1,27 @@
1 +name: BC Lint
2 +
3 +on:
4 + pull_request:
5 + types:
6 + - opened
7 + - synchronize
8 + - reopened
9 +
10 +jobs:
11 + bc_lint:
12 + if: github.repository_owner == 'vllm-project'
13 + runs-on: ubuntu-latest
14 + steps:
15 + - name: Run BC Lint Action
16 + uses: pytorch/test-infra/.github/actions/bc-lint@main
17 + with:
18 + repo: ${{ github.event.pull_request.head.repo.full_name }}
19 + base_sha: ${{ github.event.pull_request.base.sha }}
20 + head_sha: ${{ github.event.pull_request.head.sha }}
21 + suppression: ${{ contains(github.event.pull_request.labels.*.name, 'suppress-bc-linter') }}
22 + docs_link: 'https://github.com/pytorch/test-infra/wiki/BC-Linter'
23 + config_dir: .github
24 +
25 +concurrency:
26 + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
27 + cancel-in-progress: true
vllm/__init__.py
+6
@@ -14,6 +14,8 @@ import typing
14 import vllm.env_override # noqa: F401
15
16 MODULE_ATTRS = {
17 + "bc_linter_skip": "._bc_linter:bc_linter_skip",
18 + "bc_linter_include": "._bc_linter:bc_linter_include",
19 "AsyncEngineArgs": ".engine.arg_utils:AsyncEngineArgs",
20 "EngineArgs": ".engine.arg_utils:EngineArgs",
21 "AsyncLLMEngine": ".engine.async_llm_engine:AsyncLLMEngine",
@@ -54,6 +56,8 @@ if typing.TYPE_CHECKING:
56 ScoringRequestOutput)
57 from vllm.pooling_params import PoolingParams
58 from vllm.sampling_params import SamplingParams
59 +
60 + from ._bc_linter import bc_linter_include, bc_linter_skip
61 else:
62
63 def __getattr__(name: str) -> typing.Any:
@@ -70,6 +74,8 @@ else:
74
75 __all__ = [
76 "__version__",
77 + "bc_linter_skip",
78 + "bc_linter_include",
79 "__version_tuple__",
80 "LLM",
81 "ModelRegistry",
vllm/_bc_linter.py new
+59
@@ -0,0 +1,59 @@
1 +# SPDX-License-Identifier: Apache-2.0
2 +# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3 +# vllm/_bc_linter.py
4 +from __future__ import annotations
5 +
6 +from typing import Any, Callable, TypeVar, overload
7 +
8 +T = TypeVar("T")
9 +
10 +
11 +@overload
12 +def bc_linter_skip(obj: T) -> T:
13 + ...
14 +
15 +
16 +@overload
17 +def bc_linter_skip(*, reason: str | None = ...) -> Callable[[T], T]:
18 + ...
19 +
20 +
21 +def bc_linter_skip(obj: Any = None, *, reason: str | None = None):
22 + """
23 + No-op decorator to mark symbols/files for BC-linter suppression.
24 +
25 + Usage:
26 + @bc_linter_skip
27 + def legacy_api(...): ...
28 + """
29 +
30 + def _wrap(x: T) -> T:
31 + return x
32 +
33 + return _wrap if obj is None else obj
34 +
35 +
36 +@overload
37 +def bc_linter_include(obj: T) -> T:
38 + ...
39 +
40 +
41 +@overload
42 +def bc_linter_include(*, reason: str | None = ...) -> Callable[[T], T]:
43 + ...
44 +
45 +
46 +def bc_linter_include(obj: Any = None, *, reason: str | None = None):
47 + """
48 + Usage:
49 + @bc_linter_include
50 + def public_api(...): ...
51 + """
52 +
53 + def _wrap(x: T) -> T:
54 + return x
55 +
56 + return _wrap if obj is None else obj
57 +
58 +
59 +__all__ = ["bc_linter_skip", "bc_linter_include"]
vllm/v1/core/sched/output.py
+5
@@ -6,6 +6,8 @@ from __future__ import annotations
6 from dataclasses import dataclass
7 from typing import TYPE_CHECKING, Optional
8
9 +from vllm import bc_linter_include
10 +
11 if TYPE_CHECKING:
12 import numpy as np
13 import numpy.typing as npt
@@ -19,6 +21,7 @@ if TYPE_CHECKING:
21 from vllm.v1.request import Request
22
23
24 +@bc_linter_include
25 @dataclass
26 class NewRequestData:
27
@@ -80,6 +83,7 @@ class NewRequestData:
83 ")")
84
85
86 +@bc_linter_include
87 @dataclass
88 class CachedRequestData:
89
@@ -109,6 +113,7 @@ class CachedRequestData:
113 )
114
115
116 +@bc_linter_include
117 @dataclass
118 class SchedulerOutput:
119