Repository navigation
Conversation
Formatting-only cleanup produced with ruff 0.6.9, the version pinned in pyproject.toml, .pre-commit-config.yaml and CI. 69 of 265 non-vendored Python files were not Ruff-formatted. Because the CI gate and the `ruff-format` pre-commit hook both work on whole files, any change touching one of them stalled: CI failed on hundreds of pre-existing hunks, and `pre-commit run --files <file>` rewrote unrelated lines. Clearing the debt once lets the existing strict check stay in place, with local hooks and CI agreeing again. No logic changes. The only content-level edits are Ruff's docstring normalizations (trailing whitespace stripped inside docstrings, docstring indentation normalized); string constants, comments and `ruff check` findings are otherwise unchanged.
Add `.git-blame-ignore-revs` with the mechanical reformat commit and document how to enable it, so blame keeps pointing at the real authors instead of the whole-file formatting change.
`ruff check` reported 40 findings across 18 files on main, 31 of them in Python files touched by the preceding reformat commit. The lint step also runs on whole changed files, so those files would have kept stalling unrelated PRs even after the tree was formatted. Fix them so `ruff check` and `ruff format --check` both pass for the whole tree. 23 findings are `ruff check --fix` autofixes (placeholder-less f-strings, unused imports, multiple imports on one line). The rest: - `import mooncake.pg` in legacy_buffer_perf.py is kept with `# noqa: F401`: the import registers the process-group backend, so removing it would change behavior. - The availability probes in test_spdk_tgt_create.py and test_engram_store.py (import after sys.path setup) keep their imports with `# noqa`. - Removed the shadowed duplicate `TestClass.serialize_into`; the surviving no-argument definition is the one Python already bound. - Moved module-level imports in rl_samples.py and test_put_get_tensor.py into the import block, put the test_drain_http_api.py docstring above `from __future__ import annotations`, narrowed a bare `except` to `(TypeError, ValueError)`, and renamed an ambiguous `l` loop variable.
Aionw
requested review from
ShangmingCai,
UNIDY2002,
XucSh,
YiXR,
alogfans,
ascend-direct-dev,
chestnut-Q,
doujiang24,
luketong777,
staryxchen,
stmatengss,
ykwd,
ympcMark,
yuechen-sys and
zxpdemonio
as code owners
September 10, 2026 11:31
UNIDY2002
approved these changes
Sep 10, 2026
ykwd
approved these changes
Sep 10, 2026
ascend-direct-dev
approved these changes
Sep 11, 2026
7 of 31 tasks
alogfans
approved these changes
Sep 15, 2026
Collaborator
This was referenced Sep 28, 2026
9 of 14 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Clears the repository-wide Python formatting and lint debt so the existing strict, whole-file gates can stay in place.
On
main(430c6e74):ruff format-formatted.ruff checkreported 40 pre-existing findings across 18 files, 31 of them in the files above.Both the
python-lintCI step and theruff-formatpre-commit hook operate on whole files, so any PR touching one of those files failed on hunks it never wrote (mooncake-wheel/mooncake/structured_object_store.pyalone carries 96 pre-existing format hunks), whilepre-commit run --files <file>rewrote hundreds of unrelated lines. That is the situation #3567 is working around with a bespoke changed-lines checker; once this lands, the workaround is unnecessary and #3567 can go back toruff format --check.This PR deliberately does not change CI policy and does not relax any check — local pre-commit and CI keep enforcing whole files, and they now agree.
Commits
46749bef—[Misc] Apply ruff-format to Python sources(69 files, +3431/−2139)Pure
ruff format0.6.9 output, i.e. the version pinned inpyproject.toml,.pre-commit-config.yamland CI. The only content-level changes are Ruff's docstring normalizations (trailing whitespace inside docstrings, docstring indentation); string constants, comments andruff checkresults are otherwise identical. This commit is listed in.git-blame-ignore-revs.4d88638c—[Misc] Ignore the ruff-format commit in git blameAdds
.git-blame-ignore-revsplus a short note inCONTRIBUTING.mdexplaining how to enable it locally.1826d3ed—[Misc] Clear pre-existing ruff check findings(18 files, +41/−45)Required, because 31 of the 40 findings were in files touched by commit 1, so the lint step would otherwise still fail for this PR itself. 23 are
ruff check --fixautofixes; the rest were reviewed by hand (details in the commit message and below):import mooncake.pginmooncake-ep/benchmarks/legacy_buffer_perf.pyis kept with# noqa: F401: the import registers the process-group backend, so removing it would change behavior. A pre-existing precedent exists inmooncake-ep/benchmarks/ep_benchmark/run_ep_benchmark.py.mooncake-wheel/tests/test_spdk_tgt_create.pyandscripts/test_engram_store.py(import aftersys.pathsetup) keep their imports with# noqa.TestClass.serialize_into; the surviving no-argument definition is the one Python already bound, so behavior is unchanged.mooncake-rl/examples/rl_samples.pyandmooncake-wheel/tests/test_put_get_tensor.pyinto the import block, placed thescripts/test_drain_http_api.pydocstring abovefrom __future__ import annotations, narrowed a bareexceptto(TypeError, ValueError), and renamed an ambiguouslloop variable.Review tip: commit 1 is mechanical —
git show --stat 46749befis enough; the only commit that needs reading is1826d3ed.Module
Type of Change
How Has This Been Tested?
Test commands:
Test results:
ruff check/ruff format --checkpass repo-wide and for the PR diff (equivalent of thepython-lintCI job)python -m compileallpasses for every changed file__doc__norinspect.getdocis used anywhere in the repository, and the only file containing a doctest (scripts/ascend/perf/hccl_tools.py) has an unchanged docstring..git-blame-ignore-revsverified:git blamefalls back to the original authors for reformatted filesChecklist
./scripts/code_format.sh(not applicable: the script covers C/C++; Python is formatted withruff format)CONTRIBUTING.mdnote for.git-blame-ignore-revsAI Assistance Disclosure