clojars / clojars-web

A community repository for open-source Clojure libraries
https://clojars.org
Eclipse Public License 1.0
469 stars 114 forks source link

Show dependents #814

Closed vemv closed 2 years ago

vemv commented 2 years ago

This GH feature is nice https://github.com/brettwooldridge/HikariCP/network/dependents i.e. I might be interested in knowing who depends on a given artifact.

Some use cases:

I believe GH's dependents feature has Clojure as sort of a second-class citizen, so having it in Clojars would seem handy. Naturally it could be placed below this section:

image

Cheers - V

tobias commented 2 years ago

That's a really great idea @vemv! I went ahead and implemented it. You should now see a Dependents section below Dependencies. That will show up to 10 projects that depend on the current jar version, with a link to a page that will show all of the projects and their versions that depend on it:

image

Potemkin is a good example:

Does that work for you?

vemv commented 2 years ago

That's amazing @tobias ! Happy to see this alive and so quickly.

Personally, when visiting e.g. https://clojars.org/clj-kondo (no version in the url) I'd expect the dependents to be any dependents, regardless of the version.

My reasoning is that some libraries update quite frequently, so an update shouldn't make the dependents "disappear".

If visiting https://clojars.org/clj-kondo/versions/2021.10.19 (with version with the url) the algo would be more straighforward: show dependents on that specific version.

I do imagine the rationale behind the current impl, i.e. if dependent x was only a dependent for a very old version, then it's not accurate to show that as a dependent forever and ever.

Perhaps a middle ground algo can be worked out, e.g.

A lib x is considered a dependent of lib y at version v if:

Of course sky is the limit with heuristics, probably one can start small and grow it from there.

Cheers - V

vemv commented 2 years ago

ps - there's a typo (Dependenies)

tobias commented 2 years ago

Thanks for the feedback @vemv!

That makes sense. One issue with the route without a version is it just takes you to the latest non-SNAPSHOT version, so that page is really a version page. But I agree it would be useful to be able to see the dependents of the project, not just the version.

What if, for every version, we:

ps - there's a typo (Dependenies)

Thanks! I fixed this on main, but haven't yet deployed it.

tobias commented 2 years ago

@vemv I implemented what I outlined above, please take a look and let me know what you think.

vemv commented 2 years ago

Hey @tobias it looks very neat, kudos!

I definitely see myself / others giving much use to the current impl.