Skip to content

docs: fix the downloads badge, which was rate limited and off-colour - #58

Merged
shenxianpeng merged 2 commits into
mainfrom
claude/submit-patch-commit-check-42ac3i
Sep 7, 2026
Merged

docs: fix the downloads badge, which was rate limited and off-colour#58
shenxianpeng merged 2 commits into
mainfrom
claude/submit-patch-commit-check-42ac3i

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Sep 7, 2026

Copy link
Copy Markdown
Member

The downloads badge on the org profile rendered downloads | rate limited by upstream service instead of a number, in the first screenful of the profile, next to four badges that work.

-[[Downloads](https://img.shields.io/pypi/dm/commit-check?color=2c9ccd)](https://pypi.org/project/commit-check/)
+[[Downloads](https://img.shields.io/pepy/dt/commit-check?color=2c9ccd)](https://pepy.tech/projects/commit-check)

img.shields.io/pypi/dm reads pypistats on demand and gets throttled. img.shields.io/pepy/dt takes its number from pepy instead — shields.io calls api.pepy.tech with its own API key and caches for eight hours, so it is not exposed to the throttling that broke the old badge.

Why not pepy's own badge

The first commit here did the obvious thing and pointed at static.pepy.tech/badge/commit-check/month?color=%232c9ccd, matching what commit-check's README already uses. That came back with the right number and the wrong blue — visibly off from the four shields.io badges beside it.

pepy's source explains it. /badge/<project>/month is served by generate_last_30_days_badge, which hardcodes the colour and reads nothing from the query string (badge_service.py):

s = badge(left_text="downloads/month", right_text=downloads, right_color="blue")

Colour is only configurable on pepy's separate personalized-badge endpoint, which takes left_color/right_color. ?color= has never done anything on that route.

Going through shields.io instead means the colour is drawn by the same renderer as the PyPI, Marketplace, License and Website badges on the same row, from the same 2c9ccd — spelled the way they spell it, with no %23. It cannot drift from theirs, because it is the same code.

Two things to know

  • The number is now total downloads, not the last 30 days. /pepy/dt/:packageName (service definition) has no period parameter. This was a deliberate trade: an exact colour match was worth more than the period.
  • The same dead ?color= is in commit-check/README.md:6, so that badge is also showing pepy's default blue rather than the brand colour. Not touched here — different repository, and worth a one-line PR of its own.

Verification

Neither badge could be rendered here to compare: the egress proxy refuses static.pepy.tech, img.shields.io and shields.io alike. This rests on reading both services' source, not on a screenshot. What is not in doubt is the colour — the four neighbouring badges already prove shields.io renders 2c9ccd correctly.


🤖 Generated with Claude Code

https://claude.ai/code/session_018xYa7m3qup5wyN5MaXFgf6

The profile badge row rendered "downloads | rate limited by upstream
service" instead of a number. shields.io's pypi/dm endpoint reads
pypistats on demand and is throttled, so the badge fails in exactly the
place it is seen most.

pepy.tech serves a pre-rendered badge and is what commit-check's own
README already uses (README.md:6), down to the same brand blue, so this
is the pattern the project had already settled on rather than a new
dependency. The link follows the badge to the pepy project page, as it
does there.

The colour is spelled `%232c9ccd` because pepy takes a literal CSS colour
and the `#` has to survive the query string; shields.io accepted a bare
`2c9ccd`, which is why the two looked different.

Verified against commit-check/README.md rather than by fetching:
static.pepy.tech is refused by this sandbox's egress proxy.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018xYa7m3qup5wyN5MaXFgf6
@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 32 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 27cac5ef-bd2b-4489-af48-57eeaef9d896

📥 Commits

Reviewing files that changed from the base of the PR and between ba2ba1a and 25bbfb5.

📒 Files selected for processing (1)
  • profile/README.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Commit Check

All 4 checks passed

Show all 4 checks
Commit message
  ✔ PR title (docs: fix the downloads badge, which was rate limited and...)
  ✔ Commit 1/2 (docs: swap the rate-limited downloads badge for pepy.tech)
  ✔ Commit 2/2 (docs: render the downloads badge through shields.io, not ...)
Branch
  ✔ Branch (claude/submit-patch-commit-check-42ac3i)

commit-check 2.15.0 · Rules reference

The previous commit in this branch moved the badge to pepy's own renderer
and carried the `?color=%232c9ccd` that commit-check's README uses. The
badge came back the right number and the wrong blue, visibly off from the
four shields.io badges beside it.

pepy's source says why. `/badge/<project>/month` is served by
`generate_last_30_days_badge`, which calls the badge builder with
`right_color="blue"` hardcoded and reads no colour from the query string
at all:

    s = badge(left_text="downloads/month", right_text=downloads,
              right_color="blue")

Colour is only configurable on pepy's separate `personalized-badge`
endpoint, which takes `left_color`/`right_color`. `?color=` has never
done anything on either. The same dead parameter is in
commit-check/README.md:6, where the badge is also rendering pepy's
default blue rather than the brand colour.

So the badge now goes through shields.io's own Pepy endpoint --
`/pepy/dt/:packageName`, per services/pepy/pepy-downloads.service.js --
which keeps pepy as the data source but hands the drawing to the same
renderer as the PyPI, Marketplace, License and Website badges on the row.
The colour cannot drift from theirs because it is the same code and the
same `2c9ccd`, spelled the way they spell it, without the `%23` pepy
would have needed.

Two consequences worth knowing. The number is now total downloads rather
than the last thirty days, because that route has no period parameter.
And it does not inherit the throttling this branch set out to fix:
shields.io queries api.pepy.tech with its own API key and caches for
eight hours, rather than reading pypistats on demand the way the original
img.shields.io/pypi/dm badge did.

Neither badge could be rendered here to compare -- the egress proxy
refuses static.pepy.tech, img.shields.io and shields.io alike -- so this
rests on the two services' source rather than on a screenshot.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018xYa7m3qup5wyN5MaXFgf6
@shenxianpeng shenxianpeng changed the title docs: swap the rate-limited downloads badge for pepy.tech docs: fix the downloads badge, which was rate limited and off-colour Sep 7, 2026
@shenxianpeng
shenxianpeng merged commit 2c30822 into main Sep 7, 2026
3 checks passed
@shenxianpeng
shenxianpeng deleted the claude/submit-patch-commit-check-42ac3i branch September 7, 2026 12:57
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