tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
jdhollis 2020-08-10T01:03:35.124900Z

Yeah. .624 seems to be the breakpoint. (Spent the morning trying to fix my Cursive setup…)

alexmiller 2020-08-10T01:47:33.126200Z

I actually rewrote most of the tree stuff this morning, still working on it though

alexmiller 2020-08-10T01:48:57.126900Z

:dependents yes - that’s part of the lib map, :children no

alexmiller 2020-08-10T02:24:20.127700Z

@cfleming ah, I see where I broke it, will fix. I don't know who's updating the homebrew core tap, but it's just random versions now

👍 1
cfleming 2020-08-10T02:26:25.129300Z

@alexmiller Ok, I basically copied your make-tree function and fixed my copy in Cursive. As long as I can rely on the :dependents/`:children` bit coming back from resolve-deps that’s probably a better idea anyway, since I won’t have to fix anything if you change make-tree to do something different.

alexmiller 2020-08-10T02:30:52.130200Z

the bug was in the last refactoring of lib-paths

alexmiller 2020-08-10T02:31:47.130900Z

so basically in the guts of resolve-deps

alexmiller 2020-08-10T02:33:49.132300Z

you can't rely on :children - that's implementation detail leaking. :dependents you can rely on as that's part of the lib-map data structure and is spec'ed https://github.com/clojure/tools.deps.alpha/blob/master/src/main/clojure/clojure/tools/deps/alpha/specs.clj#L60-L64

cfleming 2020-08-10T02:34:18.132900Z

Is dependents enough to build the tree without children?

alexmiller 2020-08-10T02:34:50.133300Z

depends what you're trying to do with it

alexmiller 2020-08-10T02:35:04.133800Z

make-tree is going to be moving and changing quite a bit - are you using that directly?

cfleming 2020-08-10T02:35:14.134100Z

Basically, show the user a dependency tree in Cursive.

cfleming 2020-08-10T02:35:43.134700Z

I was, but after working around this bug this morning I’m now using a fixed copy of the old version.

alexmiller 2020-08-10T02:36:20.135200Z

this whole thing with you depending on whatever arbitrary version the user happens to have is crazy talk man

cfleming 2020-08-10T02:37:00.136300Z

That’s why I want data I can depend on in the resolve-deps results (or anywhere else, don’t care where I get it from) that I can use to build a tree to show the user.

alexmiller 2020-08-10T02:37:50.137300Z

the reason I'm rewriting make-tree is I suspect the same reason you're relying on that stuff - to better form the tree and the lib-map not being sufficient

cfleming 2020-08-10T02:38:03.137800Z

Basically, until there is a defined API that gives me what I need I have no choice but to hack the guts.

cfleming 2020-08-10T02:38:15.138300Z

Which is intrinsically tied to concrete versions.

alexmiller 2020-08-10T02:38:50.138900Z

well, depending on specific concrete versions is fine :) it's having no control over what you're using that seems like crazy talk

cfleming 2020-08-10T02:39:07.139700Z

I can never control what the user has installed.

cfleming 2020-08-10T02:39:29.140600Z

I can let them choose the version that they want to use, but I can’t mandate versions.

seancorfield 2020-08-10T02:39:30.140800Z

@cfleming What are you actually using this information for?

alexmiller 2020-08-10T02:39:47.141400Z

I guess I don't see why you can't use a specific version of tools.deps independent from whatever clj they have installed

cfleming 2020-08-10T02:40:22.142100Z

Because when you introduce new stuff in deps, people aren’t going to like having to update Cursive to get it.

alexmiller 2020-08-10T02:40:43.142600Z

seems better than having it break every time I update clj

cfleming 2020-08-10T02:40:46.142700Z

And as long as there’s a stable API, it shouldn’t matter.

alexmiller 2020-08-10T02:40:52.142900Z

there's not a stable API

alexmiller 2020-08-10T02:40:56.143100Z

that's the alpha part

cfleming 2020-08-10T02:41:04.143300Z

Then it will break.

cfleming 2020-08-10T02:42:39.143800Z

@seancorfield In this particular case, to show the user the deps tree in the IDE: https://cursive-ide.com/userguide/deps.html#viewing-your-project-dependencies

cfleming 2020-08-10T02:45:11.145Z

If the user finds a particular version of deps breaks with a particular version of Cursive, they can choose the version of deps they want to use within Cursive, or they can downgrade their CLI until either Cursive or deps gets fixed.

seancorfield 2020-08-10T02:46:09.145900Z

I'm continually impressed at the work you do with Cursive but at the same time it just reinforces why I like a simple editor and simple command line tools 🙂

jdhollis 2020-08-10T17:18:54.174900Z

I’m a longtime Emacs guy, but Terraform support in IntelliJ is so good that it’s worth the hassle.

jdhollis 2020-08-10T17:23:35.175100Z

(Including the fact that IntelliJ is a battery hog.)

cfleming 2020-08-10T02:46:29.146100Z

ed will always be there for you.

cfleming 2020-08-10T02:46:33.146300Z

🙂

seancorfield 2020-08-10T02:48:51.146900Z

You can pry Atom/Chlorine and the Clojure CLI from my cold, dead hands mate!

seancorfield 2020-08-10T02:49:22.147600Z

(although I've recently taken to using Reveal instead of REBL, just as an experiment with my workflow... but I'm missing several of the REBL features)

cfleming 2020-08-10T02:50:07.148200Z

To be fair, I think you have a broken script until the CLI is fixed.

alexmiller 2020-08-10T02:50:40.148800Z

fixed in clj 1.10.1.645

alexmiller 2020-08-10T02:50:52.149100Z

which is uploading right now

seancorfield 2020-08-10T02:52:39.149300Z

looks fixed -- thanks @alexmiller

seancorfield 2020-08-10T02:55:58.149700Z

And my outdated deps script works again -- yay!

alexmiller 2020-08-10T03:00:53.151200Z

@cfleming I'll give you a heads up before I publish the tree stuff - still working on it.

cfleming 2020-08-10T03:01:03.151700Z

Ok, thanks.

alexmiller 2020-08-10T03:01:50.152700Z

just as background, deps expansion does not actually ever build an explicit tree during expansion and in fact it's not a tree, it's really a graph.

alexmiller 2020-08-10T03:02:53.153600Z

the make-tree/print-tree stuff is kind of retroactively trying to build a tree from what's in the lib map, but that's really also not an explicit tree and does not contain sufficient path info to respect the exclusions the user originally stated

alexmiller 2020-08-10T03:03:40.154400Z

I've rebuilt the tree stuff to work from the trace (which is actually returned in the metadata on the lib map if it was requested), but it's surprisingly complicated to rebuild a tree that matches the user's original intent

cfleming 2020-08-10T03:04:16.154800Z

I can believe that.

cfleming 2020-08-10T03:04:40.155200Z

Mostly I’d just like a stable way to replicate what you show the user on the command line in Cursive.

alexmiller 2020-08-10T03:05:22.156400Z

yeah, and there will be a function somewhere that can work from the trace (which you can actually emit from clj with -Strace) to give you that tree data

cfleming 2020-08-10T03:05:23.156500Z

I mean, I can actually show them a graph if required.

alexmiller 2020-08-10T03:05:57.157100Z

that's kind of the stuff I'm wrestling with - there are multiple things you might want to show

alexmiller 2020-08-10T03:06:38.157800Z

what most of the deps tools show is basically a tree with every lib listed once (even though it's really possibly a dep at many points)

alexmiller 2020-08-10T03:07:22.158600Z

but you in particular might really want the "full" tree - full expansions at every node (could still stop at cycles in a path)

alexmiller 2020-08-10T03:08:01.159500Z

and then for debugging you really want to know - what version was requested, what version was actually selected, and what libs were excluded at which different points

cfleming 2020-08-10T03:08:46.160700Z

Yup, and then I could collapse duplicates to mirror what users are used to seeing in other tools, while still allowing them to expand them if required.

alexmiller 2020-08-10T03:09:09.161Z

all of that info is in the version map included in the trace but it requires a fair amount of trawling

cfleming 2020-08-10T03:10:57.161900Z

When you talk about the trace, do you mean something included in the new basis stuff?

alexmiller 2020-08-10T03:11:05.162100Z

no, pre-dates that actually

alexmiller 2020-08-10T03:11:18.162400Z

clj -Strace will dump a trace.edn file

cfleming 2020-08-10T03:12:07.163300Z

Is that documented anywhere? It doesn’t seem to be in the reference doc.

alexmiller 2020-08-10T03:12:44.164100Z

no, I wasn't sure how stable it was going to be. I added that when I made tools.deps.graph so basically prior to my conj talk

alexmiller 2020-08-10T03:13:22.164700Z

but it hasn't actually changed since then I don't think and this tree work will add another "user" of it

cfleming 2020-08-10T03:14:07.165400Z

Ok, looks like I could use that if the generation of it were available in t.d.a and I could call that.

alexmiller 2020-08-10T03:15:09.166300Z

it has been available in t.d.a since since last November in the return of resolve-deps

alexmiller 2020-08-10T03:15:26.166700Z

if you pass the :trace option, it will be included in the metadata of the lib map that's returned

alexmiller 2020-08-10T03:16:03.167100Z

that part is doc'ed at https://clojure.github.io/tools.deps.alpha/#clojure.tools.deps.alpha/resolve-deps

cfleming 2020-08-10T03:16:06.167300Z

Ok. If that’ll be a more stable thing for me to use I’ll start using that.

alexmiller 2020-08-10T03:16:32.167500Z

no plans to change it ;)

cfleming 2020-08-10T03:17:14.168200Z

What’s missing from the doc is descriptions of what’s actually in the trace log, or the runtime basis for that matter. Are they specced or something?

alexmiller 2020-08-10T03:17:34.168600Z

no, I wasn't quite ready to commit to them yet and haven't really caught up on that

alexmiller 2020-08-10T03:17:53.168800Z

the basis is doc'ed in calc-basis

alexmiller 2020-08-10T03:18:55.169500Z

it is all a bit strewn around atm and specs are missing some of those

alexmiller 2020-08-10T03:19:28.170300Z

so, definitely some doc debt to pay back. my time is kind of split right now with joining nubank :)

cfleming 2020-08-10T03:20:25.171200Z

Ok, when I get some time I’ll investigate switching to that, and falling back to what I do now if the metadata isn’t available. I’ll be interested to see your tree code when it’s done.

pez 2020-08-10T11:22:38.173100Z

Anyone know of a docker image containing both leiningen and clojure? I’m migrating a project piece by piece and am using the lein-tools-deps plugin. Currently using jdk 8, as well, unsure how hard that dependency is though.

cap10morgan 2020-08-14T18:33:39.182700Z

The clojure:latest image now has both lein and CLI tools installed if that helps.

❤️ 1
2020-08-10T11:27:32.173200Z

slightly off-topic but still ) In case if you are using github actions - https://github.com/DeLaGuardo/setup-clojure it can provision all three “main” clojure tools: leiningen, boot-clj and tools.deps

2020-08-10T11:30:29.173500Z

https://hub.docker.com/r/lambdaisland/clojure this image comes with all those tools as well

borkdude 2020-08-10T11:37:43.174100Z

@pez FWIW I usually just install clojure in a Docker container myself

👍 2
borkdude 2020-08-10T11:37:59.174400Z

See any of my latest projects

pez 2020-08-10T11:47:56.174600Z

For me this was on topic, because it is for CI I need it. (Using Circle-CI, but anyway.)

jdhollis 2020-08-10T17:28:21.175300Z

Installing Clojure and lein isn’t too difficult. This is an old snippet from a buildspec.yml for use with CodeBuild and CodePipeline. Adapting it to Docker should be relatively straightforward.

👍 1
pez 2020-08-10T17:58:05.177300Z

Yes, I went that path. (But installed clojure in a lein image.)

practicalli-john 2020-08-10T18:26:28.177500Z

@pez CircleCI has lots of docker images to choose from https://circleci.com/docs/2.0/circleci-images/#clojure

practicalli-john 2020-08-10T18:34:32.178200Z

Oh, it seems you mean Clojure CLI tools and not Clojure.... sorry.

pez 2020-08-10T20:27:56.179500Z

Yeah. The lein image contains Clojure but not the tools.deps stuff.