File tree Expand file tree Collapse file tree 5 files changed +121
-0
lines changed Expand file tree Collapse file tree 5 files changed +121
-0
lines changed Original file line number Diff line number Diff line change 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"]
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 1414import vllm .env_override # noqa: F401
1515
1616MODULE_ATTRS = {
17+ "bc_linter_skip" : "._bc_linter:bc_linter_skip" ,
18+ "bc_linter_include" : "._bc_linter:bc_linter_include" ,
1719 "AsyncEngineArgs" : ".engine.arg_utils:AsyncEngineArgs" ,
1820 "EngineArgs" : ".engine.arg_utils:EngineArgs" ,
1921 "AsyncLLMEngine" : ".engine.async_llm_engine:AsyncLLMEngine" ,
5456 ScoringRequestOutput )
5557 from vllm .pooling_params import PoolingParams
5658 from vllm .sampling_params import SamplingParams
59+
60+ from ._bc_linter import bc_linter_include , bc_linter_skip
5761else :
5862
5963 def __getattr__ (name : str ) -> typing .Any :
@@ -70,6 +74,8 @@ def __getattr__(name: str) -> typing.Any:
7074
7175__all__ = [
7276 "__version__" ,
77+ "bc_linter_skip" ,
78+ "bc_linter_include" ,
7379 "__version_tuple__" ,
7480 "LLM" ,
7581 "ModelRegistry" ,
Original file line number Diff line number Diff line change 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" ]
Original file line number Diff line number Diff line change 66from dataclasses import dataclass
77from typing import TYPE_CHECKING , Optional
88
9+ from vllm import bc_linter_include
10+
911if TYPE_CHECKING :
1012 import numpy as np
1113 import numpy .typing as npt
1921 from vllm .v1 .request import Request
2022
2123
24+ @bc_linter_include
2225@dataclass
2326class NewRequestData :
2427
@@ -80,6 +83,7 @@ def anon_repr(self):
8083 ")" )
8184
8285
86+ @bc_linter_include
8387@dataclass
8488class CachedRequestData :
8589
@@ -109,6 +113,7 @@ def make_empty(cls) -> CachedRequestData:
109113 )
110114
111115
116+ @bc_linter_include
112117@dataclass
113118class SchedulerOutput :
114119
You can’t perform that action at this time.
0 commit comments