Skip to content

Add download stats and release dates to mix hex.info#1130

Open
s3cur3 wants to merge 1 commit intohexpm:mainfrom
s3cur3:add-downloads-and-dates-to-hex-info
Open

Add download stats and release dates to mix hex.info#1130
s3cur3 wants to merge 1 commit intohexpm:mainfrom
s3cur3:add-downloads-and-dates-to-hex-info

Conversation

@s3cur3
Copy link
Copy Markdown

@s3cur3 s3cur3 commented Mar 30, 2026

This adds download counts and release dates (provided by hex.pm/api/packages/[package_name]) to the mix hex.info [package_name] and mix hex.info [package_name] [version] commands.

Download counts for the overall package info include yesterday, last 7 days, and all-time.

Two decisions I'm not entirely sure of, but happy to revisit:

  • Showing the download numbers for the current version (like the Hex.pm website does) would require a second HTTP request, which seemed iffy.
  • I wasn't clear on what the "recent" key in the downloads meant (it looks like it might be the last 8 releases?), so I left that out of the download output since I was unable to give a more concrete label for it.

(The formatting on the before/after table below is a little weird... GitHub seems to be adding additional spaces between "paragraphs.")

Resolves #1128

BeforeAfter

$ mix hex.info jason
A blazing fast JSON parser and generator in pure Elixir.

Config: {:jason, "~> 1.4"}
Locked version: 1.4.4
Releases: 1.5.0-alpha.2, 1.5.0-alpha.1, 1.4.4, 1.4.3, 1.4.2, 1.4.1, 1.4.0, 1.3.0, ...

Licenses: Apache-2.0
Links:
GitHub: https://github.com/michalmuskala/jason


$ mix hex.info jason
A blazing fast JSON parser and generator in pure Elixir.

Config: {:jason, "~> 1.4"}
Releases: 1.5.0-alpha.2 (2023-07-07), 1.5.0-alpha.1 (2022-10-16), 1.4.4 (2024-07-26), 1.4.3 (2024-06-29), 1.4.2 (2024-06-29), 1.4.1 (2023-07-07), 1.4.0 (2022-09-12), 1.3.0 (2021-12-21), ...

Downloads:
Yesterday: 20120
Last 7 days: 362042
All time: 196976983

Licenses: Apache-2.0
Links:
GitHub: https://github.com/michalmuskala/jason


$ mix hex.info jason 1.5.0-alpha.2
Config: {:jason, "~> 1.5.0-alpha.2"}
Documentation at: https://hexdocs.pm/jason/1.5.0-alpha.2
Dependencies:
  decimal ~> 1.0 or ~> 2.0 (optional)
  jason_native >= 0.0.0 (optional)
Published by: michalmuskala (michal@muskala.eu)

$ mix hex.info jason 1.5.0-alpha.2
Config: {:jason, "~> 1.5.0-alpha.2"}
Released: 2023-07-07
Documentation at: https://hexdocs.pm/jason/1.5.0-alpha.2
Downloads: 25694
Dependencies:
  decimal ~> 1.0 or ~> 2.0 (optional)
  jason_native >= 0.0.0 (optional)
Published by: michalmuskala (michal@muskala.eu)

This adds download counts and release dates (provided by `hex.pm/api/packages/[package_name]`) to the `mix hex.info [package_name]` and `mix hex.info [package_name] [version]` commands.

Download counts for the overall package info include yesterday, last 7 days, and all-time. Showing the download numbers for the current version (like the Hex.pm website does) would require a second HTTP request, which seemed iffy. I also wasn't clear on what the "recent" key in the downloads meant (it looks like it might be the last 8 releases), so I left that out of the download output.

Resolves hexpm#1128
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.

Feature request: Additional information in mix hex.info [package_name]

1 participant