Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/.bc-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# doc: https://github.com/pytorch/test-infra/blob/main/tools/stronghold/docs/bc_linter_config.md
version: 1
paths:
# We temporarily disable globally, and will only enable with `annotations.include`
# include:
# - "vllm/v1/attetion/*.py"
# - "vllm/v1/core/*.py"
exclude:
- "**/*.py"

scan:
functions: true # check free functions and methods
classes: true # check classes/dataclasses
public_only: true # ignore names starting with "_" at any level

annotations:
include: # decorators that force‑include a symbol
- name: "bc_linter_include" # matched by simple name or dotted suffix
propagate_to_members: false # for classes, include methods/inner classes
exclude: # decorators that force‑exclude a symbol
- name: "bc_linter_skip" # matched by simple name or dotted suffix
propagate_to_members: true # for classes, exclude methods/inner classes

excluded_violations: [] # e.g. ["ParameterRenamed", "FieldTypeChanged"]
26 changes: 26 additions & 0 deletions .github/workflows/bc-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: BC Lint

on:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possible to only turn on for specific folders only?

i think remind folks of BC breaking changes in core/ and attention/ are generally helpful. while it might feel a bit spammy in other folders.

pull_request:
types:
- opened
- synchronize
- reopened

jobs:
bc_lint:
Copy link
Contributor

@huydhn huydhn Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You want this line https://github.com/pytorch/pytorch/blob/main/.github/workflows/lint-bc.yml#L19C5-L19C45 to run this job only on PR submitted to vllm

Suggested change
bc_lint:
bc_lint:
if: github.repository_owner == 'vllm-project'

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in fact we need this in all of our actions 😆

if: github.repository_owner == 'vllm-project'
runs-on: ubuntu-latest
steps:
- name: Run BC Lint Action
uses: pytorch/test-infra/.github/actions/bc-lint@main
with:
repo: ${{ github.event.pull_request.head.repo.full_name }}
base_sha: ${{ github.event.pull_request.base.sha }}
head_sha: ${{ github.event.pull_request.head.sha }}
suppression: ${{ contains(github.event.pull_request.labels.*.name, 'suppress-bc-linter') }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note that using labels like suppress-bc-linter is a common self-serve mechanism in PyTorch PR, but we would need a maintainer to do it here, like adding the ready label, which is ok

docs_link: 'https://github.com/pytorch/test-infra/wiki/BC-Linter'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the concurrency rule is important https://github.com/pytorch/pytorch/blob/main/.github/workflows/lint-bc.yml#L31-L33 to avoid multiple bc linter jobs running at the same time on the same PR

Suggested change
docs_link: 'https://github.com/pytorch/test-infra/wiki/BC-Linter'
docs_link: 'https://github.com/pytorch/test-infra/wiki/BC-Linter'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true


concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
6 changes: 6 additions & 0 deletions vllm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
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",
Expand Down Expand Up @@ -54,6 +56,8 @@
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:
Expand All @@ -70,6 +74,8 @@ def __getattr__(name: str) -> typing.Any:

__all__ = [
"__version__",
"bc_linter_skip",
"bc_linter_include",
"__version_tuple__",
"LLM",
"ModelRegistry",
Expand Down
59 changes: 59 additions & 0 deletions vllm/_bc_linter.py
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 0 deletions vllm/v1/core/sched/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
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
Expand All @@ -19,6 +21,7 @@
from vllm.v1.request import Request


@bc_linter_include
@dataclass
class NewRequestData:

Expand Down Expand Up @@ -80,6 +83,7 @@ def anon_repr(self):
")")


@bc_linter_include
@dataclass
class CachedRequestData:

Expand Down Expand Up @@ -109,6 +113,7 @@ def make_empty(cls) -> CachedRequestData:
)


@bc_linter_include
@dataclass
class SchedulerOutput:

Expand Down