Skip to content

List TailClass and count npm downloads in the profile totals - #3

Merged
johanbeytell1 merged 2 commits into
mainfrom
arena/a405a710-github
Nov 11, 2026
Merged

johanbeytell1 merged 2 commits into
mainfrom
arena/a405a710-github

Conversation

@johanbeytell1

Copy link
Copy Markdown
Member

Summary

Two related changes: the profile now advertises our npm presence alongside PyPI, and the totals job counts npm downloads instead of ignoring them.

1. README (profile/README.md)

  • Top badges: added PyPI → View Packages (https://pypi.org/user/Infinitode/) and npm → View Packages (https://www.npmjs.com/org/infinitodeltd) next to the existing Hugging Face badge.
  • Status section: new TailClass entry (after CloakJS) with npm version, total npm downloads, monthly npm downloads, GitHub stars, commit activity and last commit badges, plus a note mapping which registry holds what.
  • Our projects: TailClass bullet added, linking to the npm package.
  • Stay Updated: PyPI and npm links.

Both accounts were verified live: npm infinitodeltd is the org that owns tailclass (v1.0.2), and PyPI Infinitode is "Infinitode Pty Ltd" with 10 projects. Note the deliberate case difference — Infinitode on PyPI, infinitodeltd on npm.

2. npm downloads (scripts/update-download-badges.py)

  • Discovery mirrors the PyPI rule with no hand-maintained list: the repo name lowercased (TailClass → tailclass), accepted only when the registry metadata links back to that exact repo (including git+https://…/x.git and git+ssh://git@… forms) or — only when the metadata names no GitHub repo at all — the repo's package.json declares the name. Metadata pointing at a different repo is always rejected.
    • This matters in practice: live discovery found 9 same-named npm packages that are not ours (localshare, alloy, blurjs, valx, open-arc, codesafe, cloakjs, scriptify, github). Our LocalShare repo really does declare "name": "localshare" in its package.json, so a naive name match would have credited a stranger's package.
  • Totals: the registry point API is queried in consecutive 540-day windows (18 months is the API cap) starting from the package's first publish day (time.created), floored at 2015-01-10, which is npm's oldest data. TailClass is 4 days old, so that is a single request: …/point/2026-11-08:2026-11-11/tailclass.
  • A failed or malformed window raises rather than adding a partial sum, so the existing 5% drop guard still protects the published figure. Fallback is the rounded shields.io /npm/dt badge (documented as a possible undercount, since shields caps its range).
  • npm is included in download_sources and the published total; the job summary prints package … -> npm/tailclass and per-package counts.

Testing

  • 48 unit tests pass (python3 -m unittest discover -s scripts -p 'test_*.py'), including new coverage for ownership and the collision case, package.json fallback, time.created parsing, lifetime-bounded windows (contiguous, ≤540 days, clamped to the floor), the raises-instead-of-undercounting case, shields fallback, and an end-to-end badge rewrite that now includes npm.
  • Live dry run against the real GitHub and npm registries discovered 24 repos and mapped exactly one npm package (Infinitode/TailClass → npm/tailclass).
  • api.npmjs.org is unreachable from my sandbox, so the exact download fetch is covered by tests against the documented response shape; the drop guard means the first scheduled run cannot publish a bad number.

Existing behaviour is untouched: stars/forks, PyPI counting, jsDelivr, the README rewrite and the --dry-run / --allow-decrease flags all work as before.

johanbeytell1 and others added 2 commits November 11, 2026 13:33
Add TailClass to the projects list and the package status section, with npm
version/downloads/star badges. Add top badges and Stay Updated links for the
PyPI maintainer profile (Infinitode) and the npm org (infinitodeltd).

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Discover npm packages from the public repos the same way PyPI packages are
discovered: the repo name lowercased, accepted only when the registry metadata
links back to that exact repo or, when the metadata names no GitHub repo at
all, the repo's package.json declares the name. Metadata pointing at a
different repo always loses (npm 'localshare' style collisions).

All-time downloads come from the registry point API, summed over consecutive
540-day windows from the package's first publish day (18 months per query is
the API limit, 2015-01-10 is the oldest data). A failed or malformed window
raises rather than contributing a partial sum, so the drop guard still works.
The shields.io /npm/dt badge is the fallback, and npm now counts toward
download_sources and the published total.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
@johanbeytell1
johanbeytell1 merged commit ecd2650 into main Nov 11, 2026
1 check passed
@johanbeytell1
johanbeytell1 deleted the arena/a405a710-github branch November 11, 2026 13:35
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.

1 participant