ci: publish PyPI download badges from a reliable endpoint - #252
Conversation
The README's download badges break regularly. shields.io's pypi/dm badge reads pypistats.org's /recent endpoint, which is aggressively rate limited; when it refuses, shields renders "rate limited by upstream service" and GitHub's camo proxy caches that error image, so the badge stays broken long after the upstream recovers. Measured on 20cfc30: the camo-cached image for rosetta-mcp showed the rate-limit text while a direct fetch returned 594/month. Read pypistats' /overall series instead, which answers reliably, sum the last 30 days excluding mirrors, and publish a shields endpoint JSON to an orphan `badges` branch. Counts match what shields reports when it does work: rosetta-mcp 594, rosetta-cli 540. Mirrors stay excluded deliberately. Including them roughly quadruples the number (2442 and 2008) without a single extra install, which is why pepy.tech reports "2k" for both packages. Runs daily, on demand, and on changes to its own files. No secrets needed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
git switch --orphan already starts with an empty tree, unlike git checkout --orphan, so the git rm only emitted a fatal pathspec error into the job log. Caught by simulating the step against a local bare repository. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
I think we should restructure those badges completely:
|
|
Thanks @omaiesh. To fix:
On the second: There is also a direction conflict to settle first: this PR publishes to an orphan What checks out: the premise holds — I confirmed |
The README's download badges break regularly. shields.io's pypi/dm badge reads pypistats.org's /recent endpoint, which is aggressively rate limited; when it refuses, shields renders "rate limited by upstream service" and GitHub's camo proxy caches that error image, so the badge stays broken long after the upstream recovers. Measured on 20cfc30: the camo-cached image for rosetta-mcp showed the rate-limit text while a direct fetch returned 594/month.
Read pypistats' /overall series instead, which answers reliably, sum the last 30 days excluding mirrors, and publish a shields endpoint JSON to an orphan
badgesbranch. Counts match what shields reports when it does work: rosetta-mcp 594, rosetta-cli 540.Mirrors stay excluded deliberately. Including them roughly quadruples the number (2442 and 2008) without a single extra install, which is why pepy.tech reports "2k" for both packages.
Runs daily, on demand, and on changes to its own files. No secrets needed.