Skip to content

chore: fix ruff lint failure#687

Merged
voltjia merged 1 commit into
masterfrom
chore/ruff-format-fix
Jun 16, 2026
Merged

chore: fix ruff lint failure#687
voltjia merged 1 commit into
masterfrom
chore/ruff-format-fix

Conversation

@voltjia

@voltjia voltjia commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Removed the unused empty_strided import from tests/test_kv_caching_infinilm.py.
  • Restored the Ruff workflow by making ruff check pass on master.

Motivation

The latest Ruff workflow on master failed before reaching the ruff format --check step because ruff check reported an unused import in tests/test_kv_caching_infinilm.py.

No related issue.

Type of Change

  • feat — new feature / new operator / new platform
  • fix — bug fix
  • perf — performance improvement (no behavioral change)
  • refactor — code restructuring without behavior change
  • test — adding or fixing tests only
  • docs — documentation only
  • build / ci — build system or CI configuration
  • chore — tooling, formatting, or other non-code changes
  • Breaking change (requires a ! in the Conventional Commits prefix or a BREAKING CHANGE: footer)

Platforms Affected

  • CPU (WITH_CPU)
  • NVIDIA (WITH_NVIDIA)
  • Iluvatar (WITH_ILUVATAR)
  • MetaX (WITH_METAX)
  • Cambricon (WITH_CAMBRICON)
  • Moore (WITH_MOORE)
  • Ascend (WITH_ASCEND)
  • PyTorch C++ bindings (WITH_TORCH)
  • Build system / CMake / CI
  • Python bindings / user-facing API

Smoke Test Result

N/A - lint-only change. No runtime behavior changed.

Test Results on Supported Platforms

Platform Affected Build / Smoke Result Full Result / Notes
NVIDIA No N/A - not affected N/A - not affected
Iluvatar No N/A - not affected N/A - not affected
MetaX No N/A - not affected N/A - not affected
Cambricon No N/A - not affected N/A - not affected
Moore No N/A - not affected N/A - not affected
Ascend No N/A - not affected N/A - not affected
Full `pytest` output (optional)
N/A - pytest was not run for this lint-only import cleanup.

Benchmark / Performance Impact

N/A - this removes an unused Python import only.

Notes for Reviewers

The failing GitHub Actions run was Ruff on master for commit 48e2f9841d93274ed8d7c75fade2725e6358d30c. The first chartboost/ruff-action@v1 step failed, and the format --check step was skipped.


Checklist

Title, Branch, and Commits

  • PR title follows Conventional Commits (e.g. feat(nvidia): …, fix(cuda/gemm): …).
  • Branch name follows <type>/xxx-yyyy-zzzz where <type> matches the PR title's Conventional Commits type and words are joined with hyphens (see CONTRIBUTING.md §Branches).
  • Each commit message follows Conventional Commits.
  • Small PR is a single squashable commit; or, for a large PR, every commit is meaningful, well-formed, and independently reviewable (see CONTRIBUTING.md §Pull Requests).
  • No stray merge commits from master — the branch is rebased cleanly on top of the current master.
  • No fixup! / squash! / wip commits remain.

Scope and Design

  • Changes are minimal — nothing unrelated to the stated motivation was added (CONTRIBUTING.md §Code/General).
  • No dead code, commented-out blocks, debug prints, printf/std::cout/print(...) left behind, or TODO without an owner and issue link.
  • No unrelated formatting churn that would obscure the diff.
  • Public API changes (if any) are intentional, documented, and reflected in affected callers/tests. N/A - no public API changed.

General Code Hygiene (applies to all languages)

  • The code is self-explanatory; comments were added only where the why is non-obvious (CONTRIBUTING.md §Code/General).
  • Every modified or added file ends with a single trailing newline (CONTRIBUTING.md §Code/General).
  • No trailing whitespace, tab/space mixing, or stray BOMs.
  • Identifiers in comments and error messages are wrapped in backticks (e.g. the `seqlens_k` tensor) (CONTRIBUTING.md §Code/General). N/A - no comments or error messages changed.
  • All comments and error messages are in English (CONTRIBUTING.md §Code/General). N/A - no comments or error messages changed.
  • Comments and error messages are complete sentences — capitalized first letter, terminal punctuation — unless the language/framework convention says otherwise (CONTRIBUTING.md §Code/General; §Python). N/A - no comments or error messages changed.

C++ Specific (if C++ files changed)

N/A - no C++ files changed.

Python Specific (if Python files changed)

  • Code is PEP 8 compliant; ruff check passes cleanly on CI (see .github/workflows/ruff.yml).
  • ruff format --check passes cleanly — if not, run ruff format and commit the result.
  • Comments are complete English sentences, starting with a capital letter and ending with punctuation; Markdown backticks are used for code references (CONTRIBUTING.md §Python). N/A - no comments changed.
  • Framework-specific conventions (e.g. lowercase pytest.skip messages without terminal period) are honored where applicable. N/A - no messages changed.
  • No blank line between the function signature and the body when there is no docstring or comment. N/A - no function bodies changed.
  • A blank line is present before and after if, for, and similar control-flow statements. N/A - no control flow changed.
  • A blank line appears before each return, except when it directly follows a control-flow statement. N/A - no returns changed.
  • Docstrings (if any) follow PEP 257. N/A - no docstrings changed.
  • Type hints are added / kept consistent with the surrounding code. N/A - no type hints changed.

Testing

  • Smoke tests were run on every affected platform, and the results are recorded in the "Smoke Test Result" and platform table above. N/A - lint-only change with no affected runtime platform.
  • Platforms that are not affected are marked N/A - not affected; any affected platform that could not be tested has an explicit reason and a reviewer or owner with access tagged.
  • Full-suite or full-platform testing was run, or explicitly deferred, for high-risk changes and shared build/dispatch/wrapper-generation changes. N/A - not high risk.
  • New functionality has matching tests under tests/ following tests/test_add.py / tests/test_gemm.py patterns. N/A - no new functionality.
  • Tests use pytest.mark.parametrize correctly. N/A - no test parameterization changed.
  • Where appropriate, pytest.mark.auto_act_and_assert is used and the test returns a Payload whose func and ref share the same calling convention. N/A - no test bodies changed.
  • Default dtype / device parameterization is relied on, or overridden with an explicit pytest.mark.parametrize when necessary. N/A - no parameterization changed.
  • Any new test that is flaky under parallelism is marked so, or documented to require pytest -n 1. N/A - no new tests.
  • For bug fixes: a regression test has been added that fails on master and passes with this PR. N/A - lint-only cleanup; local ruff check covers the regression.

Build, CI, and Tooling

  • The project builds cleanly from a fresh directory with pip install .[dev] on at least one affected platform. N/A - no build-affecting change.
  • compile_commands.json still regenerates (CMake option CMAKE_EXPORT_COMPILE_COMMANDS=ON in pyproject.toml — required by the code-lint skill and clang-tidy -p). N/A - CMake configuration unchanged.
  • New backends / devices have been added to auto-detection in CMakeLists.txt under if(AUTO_DETECT_DEVICES) and to if(AUTO_DETECT_BACKENDS) if applicable. N/A - no backend changes.
  • Only one CUDA-like GPU backend is selectable at a time — the existing mutual-exclusion check in CMakeLists.txt is not broken. N/A - no backend changes.
  • Both CI workflows (clang-format.yml, ruff.yml) are green locally (or expected to be green on CI). Local ruff check and ruff format --check passed; clang-format is N/A because no C++ files changed.
  • No new runtime dependency was added without updating pyproject.toml's [project.optional-dependencies] (or justified in the PR description).

Documentation

  • README.md, CONTRIBUTING.md, or inline docs updated when behavior, build flags, or developer workflow changed. N/A - no behavior or workflow changed.
  • New operators, new dispatch helpers, or new public utilities are documented. N/A - none added.
  • Any user-visible breaking change is called out explicitly under "Motivation" and in the commit/PR title with a ! or BREAKING CHANGE: footer. N/A - no breaking change.

Security and Safety

  • No secrets, access tokens, internal URLs, customer data, or personal hardware identifiers have been committed.
  • Third-party code is license-compatible and attributed. N/A - no third-party code added.
  • No unsafe pointer arithmetic, uninitialized reads, or missing bounds checks were introduced. N/A - no native code changed.

@voltjia voltjia requested a review from a team June 16, 2026 03:28
@voltjia voltjia merged commit e013cc3 into master Jun 16, 2026
11 of 18 checks passed
@voltjia voltjia deleted the chore/ruff-format-fix branch June 16, 2026 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant