Self-hosted PyPI download badge service that winnows CI traffic out of download counts.
Project description
pypi-winnow-downloads
Self-hosted PyPI download badge service that winnows CI traffic out of download
counts. Produces shields.io-compatible endpoint
badges filtered by BigQuery's details.ci flag and an interactive-installer
allowlist (pip, uv, poetry, pdm, pipenv, pipx) — more honest than
any existing alternative for small or young Python packages.
The
pip*/uv/poetry/pdmbadge above is served by this project itself — eating our own dogfood. The endpoint went live on 2026-04-24 alongside the v0.1.0 release; the daily collector run keeps it current.
What the badge actually counts
The hero badge — labelled pip*/uv/poetry/pdm (Nd) (N=30 in the reference
deployment, configurable per-package via window_days) — counts downloads that meet
all of these conditions over the configured rolling window:
details.ci != True(BigQuery's CI-detection flag is not set)details.installer.nameis one of the interactive Python packaging tools:pip,uv,poetry,pdm,pipenv, orpipx(the asterisk inpip*coverspipitself pluspipenvandpipx, which delegate to pip and inherit its installer telemetry pattern)
Excluded (the things that inflate other badges):
- Mirrors:
bandersnatch,Nexus,devpi,Artifactory,z3c.pypimirror - Browser fetches via the PyPI web UI (
installer_name == "Browser") - Generic HTTP UAs used by scrapers and scanners (
requests,curl, etc.) - Unknown installer (
installer_name == "None") — uncategorised traffic that in practice is dominated by automated scanners
For context on how much these can dwarf real installs: at v1 deploy time, one
of the seed packages had 2,771 "non-CI" downloads in 30 days under a naïve
mirror-and-all-installers query, of which 1,325 (48%) was bandersnatch alone
and only 14 came from pip + uv + poetry + pdm. The honest signal is the 14.
The filter is fail-closed: a future pypinfo emitting a new mainstream
installer will be excluded until the allowlist in
src/pypi_winnow_downloads/collector.py is updated explicitly. That's a feature
for a project whose pitch is honesty.
Install
pip install pypi-winnow-downloads
The collector queries Google's public PyPI BigQuery dataset via
pypinfo, so before the first run you'll need a Google Cloud service
account JSON key. Pypinfo's
installation guide
walks the full setup (create a GCP project, enable the BigQuery API,
generate the JSON key) and recommends the broad BigQuery User role;
the narrower pair BigQuery Job User + BigQuery Data Viewer also
works and is what config.example.yaml and the reference deploy
document. Then point service.credential_file in your config at the
resulting file.
Run with a YAML config — copy
config.example.yaml
and edit:
winnow-collect --config /path/to/config.yaml
To deploy as a daily systemd timer plus a Caddy HTTPS service serving the
output directory, see
deploy/README.md.
Status
Alpha. Self-hosted reference deployment running at
pypi-badges.intfar.com, producing daily badges for four target
packages (the three seed packages in config.example.yaml plus
pypi-winnow-downloads itself for the dogfood badge). Expect rough
edges and possible breaking changes in the 0.x series.
Acknowledgments
This project rests on three pieces of upstream work:
- pypinfo by Ofek Lev: the BigQuery
query layer for the PyPI download dataset.
pypi-winnow-downloadsis essentially a filter and badge writer wrapped around pypinfo. - shields.io renders the endpoint badges. The collector emits the JSON shape that shields.io's endpoint badge consumes, so badges inherit its caching, theming, and SVG rendering.
- The
bigquery-public-data.pypi.file_downloadsdataset, hosted by Google as a public BigQuery dataset and populated by the PyPI Linehaul pipeline, is the underlying data source. Without it, no installer-level breakdown of PyPI downloads would be possible.
Designed and built collaboratively with
Claude Code (Anthropic) across
planning, implementation, review, and QA. Significant subsystems (the
pypinfo XDG_DATA_HOME isolation, the sys.executable-based pypinfo
resolver, the installer-allowlist filter, the deploy/ examples)
emerged through that planner / Dev / QA loop.
License
Licensed under the Apache License, Version 2.0.
© 2026 Chris Means.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pypi_winnow_downloads-0.1.3.tar.gz.
File metadata
- Download URL: pypi_winnow_downloads-0.1.3.tar.gz
- Upload date:
- Size: 133.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20d1911b1d244866ef0fc3137e30144a3268cbfe3a87cc76cd5c32dfc62e23be
|
|
| MD5 |
51212c5209e40bc6e640ae7a3690f08e
|
|
| BLAKE2b-256 |
63eb815d72ac7cc4f7b99482b34c98e92880bc9c06bcb191bfe048c2aab48c0e
|
Provenance
The following attestation bundles were made for pypi_winnow_downloads-0.1.3.tar.gz:
Publisher:
publish.yml on cmeans/pypi-winnow-downloads
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pypi_winnow_downloads-0.1.3.tar.gz -
Subject digest:
20d1911b1d244866ef0fc3137e30144a3268cbfe3a87cc76cd5c32dfc62e23be - Sigstore transparency entry: 1398863542
- Sigstore integration time:
-
Permalink:
cmeans/pypi-winnow-downloads@c06c9b650595cee51c61856b3838ad5e316ce5c1 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/cmeans
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c06c9b650595cee51c61856b3838ad5e316ce5c1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pypi_winnow_downloads-0.1.3-py3-none-any.whl.
File metadata
- Download URL: pypi_winnow_downloads-0.1.3-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d03f94bcb17c8e1413a0929b92bc73580f1cf965d04a265f478a1488d9e58a9
|
|
| MD5 |
2de958eb0b71f276c275109175d21a83
|
|
| BLAKE2b-256 |
c213bae9adee833e487bd803db3448766d282251de25f0b9b549f3f66400df57
|
Provenance
The following attestation bundles were made for pypi_winnow_downloads-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on cmeans/pypi-winnow-downloads
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pypi_winnow_downloads-0.1.3-py3-none-any.whl -
Subject digest:
1d03f94bcb17c8e1413a0929b92bc73580f1cf965d04a265f478a1488d9e58a9 - Sigstore transparency entry: 1398863548
- Sigstore integration time:
-
Permalink:
cmeans/pypi-winnow-downloads@c06c9b650595cee51c61856b3838ad5e316ce5c1 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/cmeans
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c06c9b650595cee51c61856b3838ad5e316ce5c1 -
Trigger Event:
push
-
Statement type: