Show release download totals - #21
Merged
masonasons merged 1 commit intoJul 30, 2026
Merged
Conversation
FastGH already parses each asset's download_count and shows it per file, but nothing totalled it, so a release never displayed a download number. Finding out how many times a release was downloaded meant opening it and adding the asset counts up by hand. - models/release.py: new Release.total_downloads property (sums the assets) and format_downloads() for singular/plural, matching the existing ReleaseAsset.format_display() wording. format_display() now reads "(8 assets, 194 downloads)". The download part is omitted when a release has no assets, so releases carrying only the auto-generated source archives are not padded with a meaningless "0 downloads" — source archives are not assets and GitHub never counts them. - GUI/releases.py: a "Downloads:" line beside the existing "Assets:" line in the releases-list preview pane, and "Downloads: N across N assets" in the release details dialog. Both are omitted when the release has no assets. - tests: 12 tests covering the total (sum, single asset, no assets, all zero, download_count absent from the API payload), the singular/plural wording, and format_display both including and omitting the count. Deliberately not included: a repo-wide total across releases, and reordering the assets list by download count. Both were raised in masonasons#20 as design calls rather than part of this change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #20, which you gave the go-ahead on. Scope is exactly what was proposed there — nothing extra.
The gap
FastGH already parses
download_countandReleaseAsset.format_display()already shows it per file. What was missing was any total, so a release never displayed a download number anywhere — you had to open a release and add its asset counts up by hand.What this does
models/release.pyRelease.total_downloadsproperty, summing the assets.format_downloads()handling singular/plural, worded to match the existingReleaseAsset.format_display().format_display()now reads(8 assets, 194 downloads).GUI/releases.pyDownloads:line next to the existingAssets:line in the releases-list preview pane.Downloads: N across N assetsin the release details dialog.One judgement call
The download figure is omitted when a release has no assets, rather than showing
(0 assets, 0 downloads).Releases carrying only the auto-generated "Source code (zip/tar.gz)" links are common, and those are not assets — GitHub does not count them and never reports a number for them. So on those releases a
0 downloadswould be permanent noise on every row rather than information. With assets present,0 downloadsis shown, because that is a real and sometimes interesting result. Same rule in all three places, and both behaviours are covered by tests.Happy to always show it instead if you'd prefer the simpler rule.
Verification
python -m pytest tests/), 67 intest_models_release.py, of which 12 are new.download_countabsent from the API payload, singular/plural wording, andformat_display()both including and omitting the count.format_displaytests still hold — the added text does not disturb the"1 asset"/"1 assets"assertions.Release.from_github_apirather than testing only against fixtures:Not included
Per #20, and left as your design calls: a repo-wide total across releases, and reordering the assets list by download count (that one changes existing behaviour).