Harden Manim quality validation: off-screen layout checks and single-font lint#20
Draft
Harden Manim quality validation: off-screen layout checks and single-font lint#20
Conversation
…t lint Co-authored-by: John Menke <jmjava@gmail.com>
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.
Summary
This PR strengthens Manim quality safeguards with extended validation and tests focused on:
weight=BOLD, positionalTextcolor)What changed
1) Extended layout/positioning checks (
manim_layout.py)LayoutValidatornow performs broader frame sampling and stronger checks:max_text_regions)min_text_height_px)min_contrast_ratio)It now degrades gracefully when tesseract is unavailable:
tesseract unavailable; layout checks skipped)2) Integrated Manim layout into main validator (
validate.py)Validator.validate_segment()now includes:layout_qualitycheck for Manim segmentsrun_pre_push()treatslayout_qualityas a hard failure (not soft warning), so off-screen/layout regressions in Manim recordings are blocked.3) Added static Manim scene lint (
manim_scene_lint.py)New source-level lint checks for
animations/scenes.py:Text.set_default(font=...)manim.font, defaultLiberation Sans)Text(..., font=...)weight=BOLDTextcolor arguments (e.g.Text("x", C_BLUE, ...))Integrated into
validate.pyasmanim_scene_lintfor Manim segments.4) Config and init updates
Config:manim.font(defaultLiberation Sans)validation.layoutdefaults for sampling/contrast/readability/densityvalidation.manim_lintdefaultsinit.pynow scaffoldsmanim.font: Liberation Sans.5) Demo scene cleanup to one font/no bold
Updated
docs/demos/animations/scenes.py:Text.set_default(font="Liberation Sans")weight=BOLDusage with size/color emphasisfont="Monospace"overrides to keep a single familyno major layout issues)6) Docs updates
README now documents new validation controls:
manim.fontvalidation.layout.*validation.manim_lint.*docs/demos/docgen.yamlincludesmanim.fontand example layout/lint config.Tests
Added:
tests/test_manim_layout.py(positioning/contrast/readability behavior)tests/test_manim_scene_lint.py(single-font and font pitfall linting)Verification
python3 -m pytest tests -q --ignore=tests/e2e-> 92 passedpython3 -m ruff check src tests-> All checks passedIssue linkage
Addresses #2, #9, #10 and enforceable source-level/font-safety parts of #4.