Skip to content

Add coverage badges for package READMEs - #21

Merged
patrickballard merged 3 commits into
wheelgap:mainfrom
sarankumar1325:feat/coverage-badges
Nov 10, 2026
Merged

patrickballard merged 3 commits into
wheelgap:mainfrom
sarankumar1325:feat/coverage-badges

Conversation

@sarankumar1325

Copy link
Copy Markdown
Contributor

Closes #2

What this changes

scripts/build_badges.py reads data/coverage.json and writes a shields.io endpoint JSON file per package, badge/<canonical-name>.json. The publish job in .github/workflows/scan.yml runs it into _site/badge/ at deploy time; the files are not committed.

What counts: platforms that have a wheel result for the newest non-free-threaded Python in the scan (currently 3.15, eight platforms). Colour scale: all platforms brightgreen, at least three-quarters green, at least half yellow, any wheel orange, none red. Names are the PEP 503 canonical form (lowercase, -).

The package lookup card now has a "Badge for your README" snippet, for example:

[![wheels](https://img.shields.io/endpoint?url=https://wheelgap.github.io/tracker/badge/numpy.json)](https://wheelgap.github.io/tracker/#package=numpy)

with a Copy button.

Checked locally: python3 scripts/build_badges.py data/coverage.json /tmp/badge-out wrote 5000 files (boto3 8/8 brightgreen, psycopg2 1/8 orange), and node --check site/app.js passed.

AI tools used (if any): An AI assistant helped draft the script and the lookup-card snippet. I chose the 3.15 / colour-scale rule, ran the script on the current scan, and checked the site script.

@patrickballard

Copy link
Copy Markdown
Contributor

Thanks @sarankumar1325, this looks good overall: the badge counts are easy to follow, the file names are checked before anything is written, and the lookup card escapes the snippet properly.

Because it adds a script under scripts/ and a step to the publish job in .github/workflows/scan.yml (and the issue is a help wanted one), Patrick will review and merge this one himself rather than us doing it on the usual fast path. Nothing is needed from you in the meantime.

(Review assisted by Claude.)

@patrickballard

Copy link
Copy Markdown
Contributor

Thanks @sarankumar1325, this is a really nice addition! I reviewed it and a second reviewer did too. The counts and colours match coverage.json (numpy 8/8, cryptography 6/8, psycopg2 1/8), every snippet URL has a matching badge file, the lookup card escapes everything, and the Copy button fails gracefully.

I pushed two commits (e6d81e3 and 2ddee46) before merging:

  • Pyodide is left out of the count. There's no 3.15 Pyodide target today, but once one is added every badge would become "x/9". numpy would drop to 8/9, because Pyodide bundles numpy itself rather than getting it from PyPI.
  • The label names the Python (wheels py3.15). When the scan moves to a newer Python, a lot of badges will drop overnight because packages haven't shipped wheels for it yet (168 packages already score lower on 3.15 than on 3.14). With the Python in the label, the badge still says what it's counting.
  • A failed lookup gets a grey unknown badge instead of a red 0/8.
  • The script stops if a package's results don't line up with the targets. Before, it quietly counted a missing result as "no wheel".
  • Badge files carry cacheSeconds of 12 hours, since the data only changes nightly.
  • Tidying: the lookup card reuses canonicalName, the CSS no longer has fallbacks for variables that always exist, and the README has a short Badges section.

Merging now. If you'd like a next one, tracker #3 (a page per package, with titles, descriptions and a sitemap) is a help-wanted issue nobody has picked up. It pairs well with the badges, since each badge could link to its package's own page. Comment there and we'll assign it to you.

(Review assisted by Claude.)

@patrickballard
patrickballard merged commit 308ce6a into wheelgap:main Nov 10, 2026
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.

Coverage badges for package READMEs

2 participants