Skip to content

[AAASM-4915] 🔧 (config): Consolidate python-sdk formatter on ruff#285

Merged
Chisanan232 merged 3 commits into
masterfrom
v0.0.1/AAASM-4915/config/consolidate_formatter_ruff
Jul 20, 2026
Merged

[AAASM-4915] 🔧 (config): Consolidate python-sdk formatter on ruff#285
Chisanan232 merged 3 commits into
masterfrom
v0.0.1/AAASM-4915/config/consolidate_formatter_ruff

Conversation

@Chisanan232

@Chisanan232 Chisanan232 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Description

Consolidate the python-sdk's Python formatting/import tooling from three
separate pre-commit hooks (black + isort + autoflake) onto a single
ruff setup, so the SDK has one Python formatter that is already its linter.

  • .pre-commit-config.yaml: removed the isort, autoflake, and black
    hooks; added the astral-sh/ruff-pre-commit block (ruff-check --fix +
    ruff-format) pinned to v0.15.21 (matching the ruff>=0.15.21 dev dep).
    ruff-check --fix folds in isort (rule I) and autoflake's unused-import/var
    removal (F401/F841); ruff-format is black-compatible.
  • ruff.toml already enabled I, F (incl. F401/F841), and a [format]
    section, so no lint-policy change was needed. Added quickstart_snippets/ to
    ruff's exclude to preserve the parity the removed trio had via the
    pre-commit top-level exclude — that dir holds vendored, verbatim quick-start
    excerpts (regenerated into docs by quickstart-tabs-check) that are partial
    governance slices ruff cannot lint/format.
  • Docs updated back to ruff format: .claude/CLAUDE.md, CONTRIBUTING.md,
    docs/guides/authoring-adapters.md.

Reformat diff size — black-equivalent: running ruff format . across the
tree touched only 6 files, +14 / -15 lines. Every change is a known,
cosmetic black↔ruff-format micro-difference — ruff joins implicit
string-concatenations that fit on one line, and prefers the parenthesized
assert cond, (msg) form. No structural reformatting. (quickstart_snippets/
was intentionally left untouched to keep the vendored copies verbatim.)

Commits are split: config change · reformat · docs — the reformat is its own
commit so reviewers can confirm no surprise formatting.

Type of Change

  • 🔧 Bug fix (tooling/config consolidation)

Breaking Changes

  • No

Related Issues

Testing

  • Manual testing performed
  • No new tests required — tooling consolidation; behavior is verified by the gates below

Gates run in the worktree (native _core shim intentionally not built):

  • ruff format --check . — clean
  • ruff check . — clean (All checks passed!)
  • mypy agent_assembly (as configured, --ignore-missing-imports) — Success: no issues found in 73 source files
  • pytest test/ -q1195 passed, 16 skipped
  • pre-commit run --all-files — passes end-to-end (proves black/isort/autoflake are gone and ruff-check/ruff-format run)

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated if needed
  • All tests passing

Chisanan232 and others added 3 commits July 20, 2026 12:13
Consolidate the python-sdk formatter/import tooling onto a single
ruff-pre-commit block: ruff-check --fix (isort I + autoflake F401/F841)
plus ruff-format (black-compatible). ruff.toml is the source of truth.

Also exclude quickstart_snippets/ in ruff.toml to preserve the parity the
replaced trio had via the pre-commit top-level exclude — the dir holds
vendored, verbatim doc excerpts that ruff cannot lint/format.

Refs AAASM-4915

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Apply ruff format across the tree after switching the formatter from
black. Diff is minimal and black-equivalent: 6 files, 14 insertions /
15 deletions — only ruff's implicit-string-concat joining and
assert-message parenthesization differ from black's output.

Refs AAASM-4915

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Update the contributor/adapter docs and repo CLAUDE.md to name ruff
format (and the new ruff check + ruff format pre-commit suite) now that
black/isort/autoflake are gone.

Refs AAASM-4915

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@Chisanan232

Copy link
Copy Markdown
Contributor Author

Claude Code review — merge-readiness

Verdict: ready to merge, pending required Pioneer approval. No blocking issues found. (This is an automated review — not an approval.)

CI

All 19 checks green — CI (build-and-test_all, unit/integration), CodeQL (python + analyze), SonarCloud Code Analysis, all Codecov _finish uploads, pip-audit, LangChain contract test, and Quick-start Tabs Drift. mergeable: MERGEABLE (no conflicts); mergeStateStatus: BLOCKED reflects only the missing required review, not a failing gate.

Codecov / SonarCloud

Both green — no blocking quality-gate or coverage findings on the PR.

Scope vs AAASM-4915 — all acceptance criteria met

  • ✅ black + isort + autoflake removed from .pre-commit-config.yaml; astral-sh/ruff-pre-commit block added (ruff-check --fix + ruff-format, pinned v0.15.21 matching the ruff>=0.15.21 dev dep). Single Python formatter.
  • ✅ Reformat is its own commit and is black-equivalent: 6 files, +14/-15, purely cosmetic black↔ruff-format micro-diffs — implicit-string-concat joins and the parenthesized assert cond, (msg) form. No structural reformatting, no logic touched.
  • ✅ Docs corrected back to ruff format: .claude/CLAUDE.md, CONTRIBUTING.md, docs/guides/authoring-adapters.md.
  • ✅ Gates: ruff format --check / ruff check clean, mypy clean, pytest 1195 passed / 16 skipped, pre-commit run --all-files passes end-to-end.

Side-effect check — no behavior change

  • The reformat is cosmetic only; runtime behavior is unchanged. Confirmed against the full diff.
  • quickstart_snippets/ ruff.toml exclude is genuine parity, not a new gap. Master's .pre-commit-config.yaml already carries a top-level exclude: '.github/|docs/|quickstart_snippets/' that applied to the old black/isort/autoflake trio — and it is unchanged here, so it still shields the dir from the new ruff hooks. The new ruff.toml exclude simply extends that same skip to bare-CLI ruff invocations (the gates run ruff directly), keeping the vendored, verbatim quick-start excerpts from being rewritten. Correct call.

One advisory (non-blocking)

Master had no ruff hook in pre-commit at all (lint was black+isort+autoflake there; ruff check was a documented manual gate — uv run ruff check .). This PR's ruff-check --fix hook runs the full pre-existing ruff.toml select set (E,W,F,I,B,C4,UP,ARG,SIM), so the pre-commit gate now blocks on more categories than the old trio did (bugbear/simplify/pyupgrade/etc.). That said: the ruff.toml select list is byte-identical to master — this PR adds no new lint rules — it only wires the repo's already-documented ruff standard into pre-commit, and it's a no-op on the current tree (ruff check clean, CI green). No action required; flagging only so the reviewer is aware the commit-time lint surface widened slightly beyond the literal "what black/isort/autoflake enforced" wording of the ticket non-goal.

— Claude Code (automated review)

@Chisanan232
Chisanan232 merged commit da7f7b3 into master Jul 20, 2026
26 checks passed
@Chisanan232
Chisanan232 deleted the v0.0.1/AAASM-4915/config/consolidate_formatter_ruff branch July 20, 2026 04:53
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