Skip to content

Replace deprecated pybadges Python dependency with pure MATLAB SVG generator#47

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/create-svg-badge-replacement
Draft

Replace deprecated pybadges Python dependency with pure MATLAB SVG generator#47
Copilot wants to merge 2 commits intomainfrom
copilot/create-svg-badge-replacement

Conversation

Copy link
Contributor

Copilot AI commented Mar 18, 2026

pybadges is 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 all matbox.py.* and py.pybadges.* calls. SVG generation is now handled by four local functions:

    • generateBadgeSvg — assembles the shields.io flat-badge SVG format
    • computeTextWidth — sums per-character widths using a Verdana 11 px lookup table
    • getCharWidths — 95-entry table (ASCII 32–126) reverse-engineered from existing repo badges; output is byte-identical to pybadges for verified inputs
    • xmlEscape — sanitises label/message before embedding in XML
  • PyNamespaceTest.m — Removed the three test methods that installed, uninstalled, and queried pybadges. 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

% Before: required Python + pip + pybadges at runtime
matbox.utility.createBadgeSvg("tests", "21 passed", "green", projectDir)

% After: identical call, pure MATLAB, no external dependencies
matbox.utility.createBadgeSvg("tests", "21 passed", "green", projectDir)

The generated SVG matches the existing .github/badges/*.svg files 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.

…dge generator

Co-authored-by: ehennestad <17237719+ehennestad@users.noreply.github.com>
Copilot AI changed the title [WIP] Add MATLAB implementation for SVG badge creation Replace deprecated pybadges Python dependency with pure MATLAB SVG generator Mar 18, 2026
Copilot AI requested a review from ehennestad March 18, 2026 12:06
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.

2 participants