Replace deprecated pybadges Python dependency with pure MATLAB SVG generator - #47
Replace deprecated pybadges Python dependency with pure MATLAB SVG generator#47ehennestad with Copilot wants to merge 2 commits into
Conversation
…dge generator Co-authored-by: ehennestad <17237719+ehennestad@users.noreply.github.com>
|
Superseded by #62 + ehennestad/matbox-actions#8: badge rendering moves out of MATLAB entirely — tasks emit badge JSON and CI renders SVGs with badge-maker (the shields.io reference implementation), so no MATLAB reimplementation of the badge format is needed. For the record, review of this branch found two blockers beyond the merge conflict: (1) the new test class errors during class setup ( 🤖 Generated with Claude Code |
pybadgesis deprecated and requires Python, pip, and runtime package installation just to write an SVG string. This PR removes that dependency entirely with a self-contained MATLAB implementation.Implementation
createBadgeSvg.m— Full rewrite. Drops allmatbox.py.*andpy.pybadges.*calls. SVG generation is now handled by four local functions:generateBadgeSvg— assembles the shields.io flat-badge SVG formatcomputeTextWidth— sums per-character widths using a Verdana 11 px lookup tablegetCharWidths— 95-entry table (ASCII 32–126) reverse-engineered from existing repo badges; output is byte-identical to pybadges for verified inputsxmlEscape— sanitises label/message before embedding in XMLPyNamespaceTest.m— Removed the three test methods that installed, uninstalled, and queriedpybadges. The general pip-error test is retained.CreateBadgeSvgTest.m— New test class covering file creation, SVG structure, all five colours, custom filename, space→underscore conversion, colour hex correctness, XML escaping, and the missing-path error.Example
The generated SVG matches the existing
.github/badges/*.svgfiles exactly.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.