Skip to content

[Lint]Style: Convert vllm-ascend/ to ruff format(new Batch #8)#6604

Merged
wangxiyuan merged 1 commit intovllm-project:mainfrom
MrZ20:lint-ascend
Feb 7, 2026
Merged

[Lint]Style: Convert vllm-ascend/ to ruff format(new Batch #8)#6604
wangxiyuan merged 1 commit intovllm-project:mainfrom
MrZ20:lint-ascend

Conversation

@MrZ20
Copy link
Contributor

@MrZ20 MrZ20 commented Feb 6, 2026

What this PR does / why we need it?

Scope of Changes:

File Path
vllm_ascend/ops/__init__.py
vllm_ascend/ops/activation.py
vllm_ascend/ops/flashcomm2_oshard_manager.py
vllm_ascend/ops/layernorm.py
vllm_ascend/ops/mla.py
vllm_ascend/ops/mm_encoder_attention.py
vllm_ascend/ops/register_custom_ops.py
vllm_ascend/ops/vocab_parallel_embedding.py
vllm_ascend/ops/weight_prefetch.py
vllm_ascend/spec_decode/__init__.py
vllm_ascend/spec_decode/eagle_proposer.py
vllm_ascend/spec_decode/interface.py
vllm_ascend/spec_decode/mtp_proposer.py
vllm_ascend/spec_decode/ngram_proposer.py
vllm_ascend/spec_decode/suffix_proposer.py

Does this PR introduce any user-facing change?

How was this patch tested?

Signed-off-by: MrZ20 <2609716663@qq.com>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:‌‌

  • A PR should do only one thing, smaller PRs enable faster reviews.
  • Every PR should include unit tests and end-to-end tests ‌to ensure it works and is not broken by other future PRs.
  • Write the commit message by fulfilling the PR description to help reviewer and future developers understand.

If CI fails, you can run linting and testing checks locally according Contributing and Testing.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @MrZ20, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request is a comprehensive code style and linting initiative for the vllm-ascend/ module. It primarily focuses on enforcing the ruff formatting standard across previously excluded files. The changes are purely cosmetic and structural, involving code re-formatting, modernization of type hints, and removal of dead code (unused imports), all aimed at improving code consistency, readability, and adherence to Python best practices without altering any functional logic.

Highlights

  • Ruff Linting Enforcement: The vllm-ascend/ directory, including its ops/ and spec_decode/ submodules, is now fully integrated into the ruff linting process by removing previous exclusions from pyproject.toml.
  • Code Style Modernization: Extensive re-formatting has been applied across numerous Python files to align with ruff's style guidelines, including converting multiline imports and list definitions to single-line, and adjusting spacing for improved readability.
  • Type Hinting Updates: Type annotations have been modernized throughout the codebase, adopting contemporary Python syntax such as T | None (PEP 604) and list[T] (PEP 585) for enhanced clarity and maintainability.
  • Code Cleanup: Several unused import statements, including typing.Optional, typing.Union, typing.Dict, typing.Tuple, vllm.config.MultiModalConfig, vllm_ascend.envs, and vllm.logger, have been removed from various files, contributing to a cleaner and more efficient codebase.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • pyproject.toml
    • Removed vllm_ascend/ paths from the ruff exclusion list, enabling linting for these modules.
  • vllm_ascend/ops/init.py
    • Re-formatted multiline imports and the __all__ list to single-line for brevity.
  • vllm_ascend/ops/activation.py
    • Adjusted spacing and blank lines around imports, class, and method definitions.
  • vllm_ascend/ops/flashcomm2_oshard_manager.py
    • Updated type hints to PEP 585/604 syntax (dict[int, Any], Any | None) and re-formatted imports/function calls.
  • vllm_ascend/ops/layernorm.py
    • Modernized type hints, re-ordered imports, and removed an unused import (typing.Optional, typing.Tuple, typing.Union).
  • vllm_ascend/ops/mla.py
    • Updated type hints, re-formatted docstrings, imports, and multiline function calls.
  • vllm_ascend/ops/mm_encoder_attention.py
    • Removed an unused import (vllm.config.MultiModalConfig) and re-formatted function signatures/calls.
  • vllm_ascend/ops/register_custom_ops.py
    • Removed unused imports (vllm_ascend.envs, typing.Optional, typing.Tuple), modernized type hints, and re-formatted function signatures/calls.
  • vllm_ascend/ops/vocab_parallel_embedding.py
    • Modernized type hints and re-formatted function signatures/calls.
  • vllm_ascend/ops/weight_prefetch.py
    • Re-ordered imports, removed an unused import (vllm.logger), and re-formatted function calls.
  • vllm_ascend/spec_decode/init.py
    • Re-formatted a string literal from single to double quotes and simplified an f-string.
  • vllm_ascend/spec_decode/eagle_proposer.py
    • Modernized type hints (e.g., Union to |, ContextManager to AbstractContextManager), re-ordered imports, and extensively re-formatted function signatures/calls.
  • vllm_ascend/spec_decode/interface.py
    • Modernized type hints and re-formatted function signatures.
  • vllm_ascend/spec_decode/medusa_proposer.py
    • Removed several unused imports and modernized type hints.
  • vllm_ascend/spec_decode/mtp_proposer.py
    • Modernized type hints and re-formatted function signatures/calls.
  • vllm_ascend/spec_decode/ngram_proposer.py
    • Re-formatted imports and function signatures/calls.
  • vllm_ascend/spec_decode/suffix_proposer.py
    • Re-formatted imports and function signatures/calls.
Activity
  • The pull request was initiated by MrZ20 to convert the vllm-ascend/ directory to ruff format as part of a new batch of style updates.
  • The changes are purely stylistic and linting-related, focusing on code formatting, type hint modernization, and removal of unused imports.
  • No functional changes, new features, or bug fixes are introduced in this pull request.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request applies ruff format to a batch of files in vllm_ascend/, leading to various stylistic improvements such as line wrapping, import formatting, and modernizing type hints. While most changes are purely stylistic, I've identified two critical issues in vllm_ascend/ops/register_custom_ops.py where refactoring has removed necessary null checks, potentially leading to runtime AttributeError crashes. These logical changes seem unintended for a formatting-focused PR and should be addressed.

(num_tokens_across_dp_cpu.sum(), *x.shape[1:]),
device=x.device,
dtype=x.dtype)
result = torch.empty((num_tokens_across_dp_cpu.sum(), *x.shape[1:]), device=x.device, dtype=x.dtype)
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The refactoring of this function has removed a null check for dp_metadata. The previous implementation handled cases where dp_metadata could be None when is_ep_comm is true. The new logic directly accesses dp_metadata.num_tokens_across_dp_cpu on line 58, which will raise an AttributeError if dp_metadata is None. This introduces a potential crash. Please restore the null check.

(dp_size, forward_context.padded_length, *x.shape[1:]),
device=x.device,
dtype=x.dtype)
num_tokens_across_dp_cpu = get_forward_context().dp_metadata.num_tokens_across_dp_cpu
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The refactoring of this function has removed a null check for dp_metadata. The previous implementation handled cases where dp_metadata could be None when is_ep_comm is true. The new logic directly accesses get_forward_context().dp_metadata.num_tokens_across_dp_cpu, which will raise an AttributeError if dp_metadata is None. This introduces a potential crash. Please restore the null check.

@wangxiyuan wangxiyuan merged commit 06aa603 into vllm-project:main Feb 7, 2026
22 checks passed
@MrZ20 MrZ20 deleted the lint-ascend branch February 9, 2026 01:26
845473182 pushed a commit to 845473182/vllm-ascend that referenced this pull request Feb 9, 2026
…to qwen3next_rebase

* 'main' of https://github.com/vllm-project/vllm-ascend:
  [Patch] Remove the patch of MiniCPM (vllm-project#5975)
  [P/D] layerwise connector support recompute scheduler (vllm-project#5900)
  [CI] Add workflow support for lint image build (vllm-project#6489)
  [Bugfix] Fix problematic dummy_run & improper input_batch_size in eagle (vllm-project#6517)
  [Refactor]310p_e2e test case update (vllm-project#6539)
  [Refactor]refactor p2p connector (vllm-project#6551)
  [Refactor]refactor 310p attention impl and add ut (vllm-project#6579)
  [Refactor]refactor 310p ops and add ut (vllm-project#6591)
  [Ops][Refactor] Remove custom rotary_embedding operator (vllm-project#6523)
  [Lint]Style: Convert `vllm-ascend/` to ruff format(new Batch vllm-project#8) (vllm-project#6604)
  [Test] Add initial multi modal cases of Qwen2.5-VL-7B-Instruct for disaggregated encoder  (vllm-project#5301)
  [CI] Fix broken CI (vllm-project#6599)
  [Lint]Style: Convert `vllm-ascend/` to ruff format(Batch vllm-project#10) (vllm-project#6173)
  [Lint]Style: Convert `vllm-ascend/` to ruff format(Batch vllm-project#11) (vllm-project#6176)
  [Lint]Style: Convert `vllm-ascend/` to ruff format(Batch vllm-project#8) (vllm-project#6129)
  [Lint]Style: Convert `vllm-ascend/` to ruff format(Batch vllm-project#7) (vllm-project#6023)
  [CI][Misc] Some improvement for github action (vllm-project#6587)
  [Image] Bump mooncake version to v0.3.8.post1 (vllm-project#6428)
chenchuw886 pushed a commit to chenchuw886/vllm-ascend that referenced this pull request Feb 12, 2026
…ject#8) (vllm-project#6604)

### What this PR does / why we need it?
**Scope of Changes**:
| File Path |
| :--- |
| vllm_ascend/ops/\_\_init\_\_.py |
| vllm_ascend/ops/activation.py |
| vllm_ascend/ops/flashcomm2_oshard_manager.py |
| vllm_ascend/ops/layernorm.py |
| vllm_ascend/ops/mla.py |
| vllm_ascend/ops/mm_encoder_attention.py |
| vllm_ascend/ops/register_custom_ops.py |
| vllm_ascend/ops/vocab_parallel_embedding.py |
| vllm_ascend/ops/weight_prefetch.py |
| vllm_ascend/spec_decode/\_\_init\_\_.py |
| vllm_ascend/spec_decode/eagle_proposer.py |
| vllm_ascend/spec_decode/interface.py |
| vllm_ascend/spec_decode/mtp_proposer.py |
| vllm_ascend/spec_decode/ngram_proposer.py |
| vllm_ascend/spec_decode/suffix_proposer.py |

### Does this PR introduce _any_ user-facing change?

### How was this patch tested?

- vLLM version: v0.15.0
- vLLM main:
vllm-project/vllm@d7e17aa

Signed-off-by: MrZ20 <2609716663@qq.com>
Signed-off-by: momochenchuw <chenchuw@huawei.com>
@wangxiyuan wangxiyuan mentioned this pull request Feb 24, 2026
ZRJ026 pushed a commit to ZRJ026/vllm-ascend that referenced this pull request Feb 28, 2026
…ject#8) (vllm-project#6604)

### What this PR does / why we need it?
**Scope of Changes**:
| File Path |
| :--- |
| vllm_ascend/ops/\_\_init\_\_.py |
| vllm_ascend/ops/activation.py |
| vllm_ascend/ops/flashcomm2_oshard_manager.py |
| vllm_ascend/ops/layernorm.py |
| vllm_ascend/ops/mla.py |
| vllm_ascend/ops/mm_encoder_attention.py |
| vllm_ascend/ops/register_custom_ops.py |
| vllm_ascend/ops/vocab_parallel_embedding.py |
| vllm_ascend/ops/weight_prefetch.py |
| vllm_ascend/spec_decode/\_\_init\_\_.py |
| vllm_ascend/spec_decode/eagle_proposer.py |
| vllm_ascend/spec_decode/interface.py |
| vllm_ascend/spec_decode/mtp_proposer.py |
| vllm_ascend/spec_decode/ngram_proposer.py |
| vllm_ascend/spec_decode/suffix_proposer.py |

### Does this PR introduce _any_ user-facing change?

### How was this patch tested?

- vLLM version: v0.15.0
- vLLM main:
vllm-project/vllm@d7e17aa

Signed-off-by: MrZ20 <2609716663@qq.com>
Signed-off-by: zrj026 <zhangrunjiang026@gmail.com>
maoxx241 pushed a commit to maoxx241/vllm-ascend that referenced this pull request Mar 2, 2026
…ject#8) (vllm-project#6604)

### What this PR does / why we need it?
**Scope of Changes**:
| File Path |
| :--- |
| vllm_ascend/ops/\_\_init\_\_.py |
| vllm_ascend/ops/activation.py |
| vllm_ascend/ops/flashcomm2_oshard_manager.py |
| vllm_ascend/ops/layernorm.py |
| vllm_ascend/ops/mla.py |
| vllm_ascend/ops/mm_encoder_attention.py |
| vllm_ascend/ops/register_custom_ops.py |
| vllm_ascend/ops/vocab_parallel_embedding.py |
| vllm_ascend/ops/weight_prefetch.py |
| vllm_ascend/spec_decode/\_\_init\_\_.py |
| vllm_ascend/spec_decode/eagle_proposer.py |
| vllm_ascend/spec_decode/interface.py |
| vllm_ascend/spec_decode/mtp_proposer.py |
| vllm_ascend/spec_decode/ngram_proposer.py |
| vllm_ascend/spec_decode/suffix_proposer.py |

### Does this PR introduce _any_ user-facing change?

### How was this patch tested?

- vLLM version: v0.15.0
- vLLM main:
vllm-project/vllm@d7e17aa

Signed-off-by: MrZ20 <2609716663@qq.com>
ZRJ026 pushed a commit to ZRJ026/vllm-ascend that referenced this pull request Mar 4, 2026
…ject#8) (vllm-project#6604)

### What this PR does / why we need it?
**Scope of Changes**:
| File Path |
| :--- |
| vllm_ascend/ops/\_\_init\_\_.py |
| vllm_ascend/ops/activation.py |
| vllm_ascend/ops/flashcomm2_oshard_manager.py |
| vllm_ascend/ops/layernorm.py |
| vllm_ascend/ops/mla.py |
| vllm_ascend/ops/mm_encoder_attention.py |
| vllm_ascend/ops/register_custom_ops.py |
| vllm_ascend/ops/vocab_parallel_embedding.py |
| vllm_ascend/ops/weight_prefetch.py |
| vllm_ascend/spec_decode/\_\_init\_\_.py |
| vllm_ascend/spec_decode/eagle_proposer.py |
| vllm_ascend/spec_decode/interface.py |
| vllm_ascend/spec_decode/mtp_proposer.py |
| vllm_ascend/spec_decode/ngram_proposer.py |
| vllm_ascend/spec_decode/suffix_proposer.py |

### Does this PR introduce _any_ user-facing change?

### How was this patch tested?

- vLLM version: v0.15.0
- vLLM main:
vllm-project/vllm@d7e17aa

Signed-off-by: MrZ20 <2609716663@qq.com>
Signed-off-by: zrj026 <zhangrunjiang026@gmail.com>
LCAIZJ pushed a commit to LCAIZJ/vllm-ascend that referenced this pull request Mar 7, 2026
…ject#8) (vllm-project#6604)

### What this PR does / why we need it?
**Scope of Changes**:
| File Path |
| :--- |
| vllm_ascend/ops/\_\_init\_\_.py |
| vllm_ascend/ops/activation.py |
| vllm_ascend/ops/flashcomm2_oshard_manager.py |
| vllm_ascend/ops/layernorm.py |
| vllm_ascend/ops/mla.py |
| vllm_ascend/ops/mm_encoder_attention.py |
| vllm_ascend/ops/register_custom_ops.py |
| vllm_ascend/ops/vocab_parallel_embedding.py |
| vllm_ascend/ops/weight_prefetch.py |
| vllm_ascend/spec_decode/\_\_init\_\_.py |
| vllm_ascend/spec_decode/eagle_proposer.py |
| vllm_ascend/spec_decode/interface.py |
| vllm_ascend/spec_decode/mtp_proposer.py |
| vllm_ascend/spec_decode/ngram_proposer.py |
| vllm_ascend/spec_decode/suffix_proposer.py |

### Does this PR introduce _any_ user-facing change?

### How was this patch tested?

- vLLM version: v0.15.0
- vLLM main:
vllm-project/vllm@d7e17aa

Signed-off-by: MrZ20 <2609716663@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants