Not sure if this is the correct channel, but following on from a discussion during @seancorfield’s talk today for the London Clojurians, I whipped up a prototype that will determine the namespaces for one or more tools.deps dependencies. Example usage:
(namespaces-for-deps! {'http-kit/http-kit {:mvn/version "2.5.0"}
'ring/ring {:mvn/version "1.8.2"}})
==> {http-kit/http-kit {:mvn/version "2.5.0", #snip#, :nses [org.httpkit.timer org.httpkit.client org.httpkit.encode org.httpkit.server org.httpkit.sni-client]}, ring/ring {:mvn/version "1.8.2", #snip#, :nses []}}
Code is here: https://gist.github.com/pmonks/982ce90dac11a4cefe45378c0db3d555 - feedback welcome, especially regarding whether this is worth turning into something else (CLI app, tools.deps plugin, wotnot).I actually have an impl of a couple things like this related to add-libs (buried in the add-libs3 branch atm)
well I did, can't remember where that branch is at now
I mean, it's trivial to do with combo of tools.deps/tools.namespace
Yep, and that’s all this code does. Definitely seems useful enough to want to surface - it was one of the few “holes” in Sean’s demo flow in today’s talk - “how do you determine the namespaces in a dependency at the REPL?“.
https://github.com/hagmonk/find-deps also adds some nice ergonomics.
FWIW I used tda’s resolve-deps
fn to pull down the requested dependencies, but that felt a bit heavyweight since it brings down the transitive graph of dependencies as well (which I don’t think tools.namespace needs to do its thing). Though I guess short-cutting the graph might cause problems with other tda-based tooling...
yeah, you can pretty easily use tools.deps to pull just a single lib - it's not exactly part of the main api but you can do it
Yeah cool - not a big problem to pull down the entire graph for this kind of “exploration time” logic, imvho.
it's really just crafting a call to (c.t.d.a.extensions/coord-paths 'the/lib {:mvn/version "1.2.3"} deps-edn)
which should download and return a vector with one path which is the jar
you do need to require c.t.d.a just to cause the multimethod extensions to all get loaded