Refactor table sizing/rendering/verification duplication in clean-slides
Session from clean-slides-sessions on Hugging Face by thomasmustier · MIT · condensed by Coders Talk
Review a Python PowerPoint table generation library for code smells and consolidate duplicated logic between the sizing, rendering and verification modules, keeping tests and type checks green.
- +0Prompt · +0We've added a lot of code around tables. Please review and see if there are things we need to clean up or refactor. We want clean, maintainable code
- +0mAgent did · +0mExplored the clean_slides package (spec, renderer, solver, sizing, measure, verification, cli) and tests to understand the table pipeline and find duplicated padding/width logic
- +4mAgent did · +4mRan ruff and pytest, then extracted shared helpers (column_right_pads, textbox_width, should_use_line_breaks) into measure.py and updated sizing.py, renderer.py and verification.py to use them, fixing lint issues along the way
- +19mAgent did · +19mRan pytest, all 18 tests passed, then reviewed git diff across cli.py, measure.py, renderer.py, sizing.py, verification.py and test_sizing.py
- +19mPrompt · +19mCan you commit/push when done please
- +20mAgent did · +20mStaged the refactor changes, committed as 'fix(tables): align sizing/verification with renderer padding', pyright passed, and pushed to origin/main
- Break · 43m away, not counted
- +21mPrompt · +21mWe have some pyright errors
- +22mAgent did · +22mInvestigated pyright strict-mode errors in cli.py's cmd_layouts around placeholder typing, inspected python-pptx stubs, then rewrote the placeholder handling with proper types, PP_PLACEHOLDER enum, and a cast for the Iterable mismatch
- +26mOutcome · +26mPyright clean (0 errors), ruff clean, 17 tests passing; two commits pushed to main (10e2788 and 21e5ec9)
I'd start by asking for the duplication cleanup and the pyright strictness fix in the same pass, since touching sizing/renderer/verification together was always going to surface type issues in cli.py too. The useful correction was catching that the refactor left renderer.py using stale padding logic that measure.py already superseded — rerunning ruff/pytest/pyright after each edit round is what caught it rather than trusting the first green run. Committing and pushing only after pyright was fully clean was the right call.'