Skip to content

Reduce and tighten code comments and docstrings repo-wide - #6095

Merged
danielhanchen merged 1 commit into
mainfrom
comment-trim-all
Jun 9, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
comment-trim-all

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Repo-wide pass to make code comments and docstrings as succinct as possible without losing intent. Follows the same comment-only approach as #6029, extended to the entire Python codebase.

What changed

  • Removed comments that merely restate what obvious code does, especially on small internal/private/auxiliary helpers.
  • Collapsed multi-line comment and docstring blocks into one or two lines where the meaning survives.
  • Shortened verbose docstrings on internal helpers; kept concise, useful docstrings on public API.
  • Preserved load-bearing comments: non-obvious "why" notes, gotchas, units, math derivations, and GitHub issue/PR links.

Scope

All Python files across the repo: unsloth/ (incl. kernels, models, registry, optimizers), studio/backend, tests/, scripts/, unsloth_cli/, and the root CLIs. 311 files trimmed for a net reduction of about 4,600 lines.

This is based on the #6029 branch so the diff here shows only the incremental repo-wide changes on top of that PR. The studio/frontend TypeScript/JavaScript is intentionally out of scope and can be a separate follow-up.

Guarantee

Comments and docstrings only, no code changes. Every changed file was verified two ways:

  • AST signature comparison against main (ast.dump with docstrings blanked) reports code unchanged for all 355 changed files vs main.
  • Every changed file byte-compiles.

Two early edits that touched string-literal contents (JS comments embedded inside page.evaluate("""...""") strings, and a bare module-level triple-quoted string) were caught by the AST check and reverted, so the final result is strictly comment/docstring-only.

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

Copy link
Copy Markdown
Contributor

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 performs a comprehensive refactoring of comments, docstrings, and formatting across the entire codebase, including utility scripts, backend services, routes, and test suites. The changes primarily focus on making docstrings and comments more concise, removing redundant dividers, and improving overall readability without altering any functional logic. I have no feedback to provide as there are no review comments or issues identified in these stylistic updates.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Base automatically changed from studio-comment-trim to main June 9, 2026 06:07
@danielhanchen
danielhanchen merged commit 187144d into main Jun 9, 2026
61 of 63 checks passed
@danielhanchen
danielhanchen deleted the comment-trim-all branch June 9, 2026 06:09
Etherll added a commit to Etherll/unsloth that referenced this pull request Jun 11, 2026
Resolved conflict in unsloth/models/sentence_transformer.py: kept this
branch's functional rewrites in all 15 conflict hunks (upstream's side
was only the repo-wide comment-tightening/ruff-reflow passes unslothai#6079/unslothai#6095
applied to pre-rewrite code), while preserving upstream's auto-merged
cosmetic edits in non-conflicting regions via git merge-file --ours.

Co-Authored-By: Claude Fable 5 <[email protected]>
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