Popularity of Hex packages?

Did anyone make a list of “most popular” Hex packages for other packages (not end applications) based on the mix.exs of all the packages in Hex? The column “Most downloaded” on Hex is not a perfect proxy because it may be driven mostly by end applications, not libraries.
If not, is there an easy way to retrieve all the mix.exs in Hex to run such surveys?

1 Like

That is an interesting question! To re-render your question, you’re basically asking for the library with the most transitive dependencies yea? I expect downloads is a pretty good proxy for that but as you say, it is a slightly different question.

1 Like

I ran this query:

SELECT dependencies.name, count(packages.id)
FROM packages
JOIN (
	SELECT package_id, max(inserted_at)
	FROM releases
	GROUP BY package_id
) latest_releases ON packages.id = latest_releases.package_id
JOIN releases ON releases.package_id = latest_releases.package_id AND releases.inserted_at = latest_releases.max
JOIN requirements ON requirements.release_id = releases.id
JOIN packages AS dependencies ON dependencies.id = requirements.dependency_id
WHERE dependencies.repository_id = 1
GROUP BY dependencies.id
ORDER BY count(packages.id) DESC;

It counts the number of packages where the the most recent version has a direct dependency on a given package, note that it does not count transitive dependencies.

The results for the top 100 packages are:

package count
jason 2462
httpoison 1830
poison 1772
plug 975
ecto 896
hackney 627
tesla 599
timex 577
ecto_sql 559
phoenix 510
postgrex 447
telemetry 387
plug_cowboy 377
phoenix_html 351
cowboy 312
ex_doc 311
uuid 259
google_gax 257
phoenix_live_view 254
sweet_xml 253
poolboy 242
ex_aws 238
gettext 224
decimal 219
floki 184
elixir_make 171
elixir_uuid 170
castore 164
rustler 159
redix 153
exprotobuf 149
finch 149
oauth2 147
gen_stage 142
phoenix_ecto 137
phoenix_pubsub 136
nimble_options 132
gleam_stdlib 129
telemetry_metrics 122
ueberauth 121
amqp 121
amqp_director 121
jsx 120
httpotion 119
joken 110
nimble_parsec 110
typed_struct 108
lager 108
nerves 106
absinthe 105
earmark 102
mint 102
telemetry_poller 101
cachex 98
ex_aws_s3 98
yaml_elixir 95
inflex 89
recase 88
protobuf 85
membrane_core 84
nerves_system_br 81
ex_machina 76
xml_builder 74
zotonic_core 73
faker 72
exjsx 69
connection 68
confex 67
jose 67
goth 66
opentelemetry_api 66
mime 66
comeonin 66
grpc 64
csv 62
money 61
phoenix_live_dashboard 60
websockex 59
fuse 59
bcrypt_elixir 58
broadway 58
ranch 58
credo 57
req 57
distillery 55
guardian 55
exconstructor 54
nimble_csv 52
bamboo 52
gun 50
google_protos 49
rustler_precompiled 48
esbuild 47
db_connection 46
flow 46
tzdata 46
gproc 46
jsone 45
bunch 44
jiffy 44
6 Likes

If anyone wants to productionize this and make it available on hex.pm contributions would be very welcome.

1 Like

Thanks. I’m not surprised that Jason is #1 (but I was expecting ex_doc), or by the success of Phoenix-related stuff. I’m more surprised by the absence of dialyxir.

Both ex_doc and dialyxir are dependencies used in dev so they wouldn’t show up as Hex dependencies.