-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't show download count, it's always -1 for PyPI #23
Conversation
pispy/data/package.py
Outdated
@@ -42,9 +42,6 @@ class PackageURL(NamedTuple): | |||
digests: dict[str, str] | |||
"""The digests for the URL.""" | |||
|
|||
downloads: int | |||
"""The number of downloads for the URL.""" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to still keep this in the class.
pispy/data/package.py
Outdated
@@ -89,7 +86,6 @@ def from_json(cls, data: dict[str, Any]) -> "PackageURL": | |||
return cls( | |||
comment_text=url("comment_text"), | |||
digests=url("digests", {}), | |||
downloads=url("downloads", 0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned elsewhere, I think I'd prefer to keep this in the class.
@@ -208,7 +208,6 @@ def compose(self) -> ComposeResult: | |||
("MD5 Digest", self._url.md5_digest, Value), | |||
("Uploaded", self._url.upload_time_iso_8601, Value), | |||
("Has Signature", "Yes" if self._url.has_sig else "No", Value), | |||
("Downloads", f"{self._url.downloads:,}", Value), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good call. I've even said a couple of times on stream while tidying this up that I should either filter out the -1 or just plain not show it anyway now.
Updated! |
Awesome, thanks. I know it seems a bit daft still loading the unused stuff anyway, but I was considering a sort of "show all values" toggle at some point, perhaps, maybe, possibly. |
The downloads count is always -1 in the JSON response for PyPI packages, so we might as well not show it:
https://mail.python.org/pipermail/distutils-sig/2013-May/020855.html
That says 0, but it was later changed to -1 to make it more obviously not-real.
(It's possible other package indexes do return a download count, but it looks like this tool only checks PyPI, and I would expect that to be the most common one anyway.)