tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
borkdude 2021-02-24T11:02:17.056Z

Here is my stab at it: https://github.com/borkdude/deps-infer

borkdude 2021-02-24T11:39:07.057Z

I think this can be improved in various ways (as documented in the README). Having an up to date (daily) index (of namespaces to lib coords) of clojars (and mvn central) available is one of the best improvements. Not hard, just has to be maintained somewhere.

borkdude 2021-02-24T11:45:20.057700Z

I think such an index will also help detect namespace clashes in the entire clojure ecosystem which will be pretty useful

borkdude 2021-02-24T12:38:05.062Z

This tool can be used for e.g.:

- Making implicit deps explicit
- Checking which deps you are _not_ using by comparing the output with your existing `deps.edn`
- Porting a `lein` `project.clj` or `boot` `build.boot` to `deps.edn`
- Porting scripts (e.g. [babashka](<https://github.com/babashka/babashka>)
scripts) to a `deps.edn` project.
- Migrating from git deps to mvn deps
- Checking if there is a newer version available

pavlosmelissinos 2021-02-24T12:43:00.064300Z

I know where I'm posting this question and I'm not looking to start a flame war, but I've noticed that beginners tend to gravitate towards lein, not cli tools. 1. Is there a reason for that? 2. I suppose that part of the reason could be due to outdated tutorials on the web (lein was obviously more prevalent in the past). However, given that tools.deps is endorsed by nubank/cognitect, comes with clojure and is used by an increasing number of libraries, would you ever recommend lein over cli tools for new projects in 2021? If yes, why? edit: Apologies if this comes up too often 🙂

borkdude 2021-02-24T12:49:31.065Z

Probably UX is part of the equation: lein comes with a test runner, uberjar, etc, built-in

✅ 1
borkdude 2021-02-24T12:50:30.065600Z

tools.deps doesn't try hard to provide a full tool for most needs: you have to assemble it yourself

borkdude 2021-02-24T12:51:08.066200Z

there is a project in development called tools.build which might perhaps make this more beginner friendly, but this remains to be seen

borkdude 2021-02-24T12:58:53.066900Z

There was a thread on Reddit (I believe) recently about this, if you want to read comments from the community. I like both tools for what they are. Tools.deps / Clojure CLI allows you to only use what you need, which is generally better for startup, etc.

pavlosmelissinos 2021-02-24T13:42:02.067700Z

Ah, good points, thanks @borkdude. Are you referring to this thread? https://reddit.com/r/Clojure/comments/jailzq/aleksandar_simic_from_lein_to_deps_and_back_lndclj/

mpenet 2021-02-26T03:11:20.095600Z

Just + deps is a really good match

mpenet 2021-02-26T03:11:59.095800Z

Just gives you a lot for free

borkdude 2021-02-24T13:42:45.067900Z

No, it was a different one

borkdude 2021-02-24T13:45:38.068100Z

@pavlos It was related to this blog post: https://quanttype.net/posts/2021-01-14-clojure-project-management-tool-of-my-dreams.html

borkdude 2021-02-24T13:46:09.068400Z

Here is the Reddit thread: https://www.reddit.com/r/Clojure/comments/l3a2iz/clojure_project_automation_tool_of_my_dreams/

🙏 1
alexmiller 2021-02-24T14:27:10.069100Z

definitely more to come... from the world of tools.deps :)

2
2021-02-24T14:39:17.069600Z

deps-infer + add-lib would be an absolute dream

alexmiller 2021-02-24T14:42:02.070400Z

we've actually spent some time on this a couple times, but actually going further with integrating it into core

alexmiller 2021-02-24T14:42:41.071Z

still trying to figure out where to draw the boundaries

alexmiller 2021-02-24T14:44:04.071900Z

we'd love to give you a ton of power at the repl and maybe in ad hoc scripting, but not encourage you to make a mess of your actual programs :)

alexmiller 2021-02-24T14:45:03.072700Z

we are working on some stuff right now that is taking another step or two in this direction

🤤 8
borkdude 2021-02-24T14:49:02.073400Z

@jjttjj you can use deps-infer today :) It actually works quite well, I've solved a couple of small issues already

👍 1
borkdude 2021-02-24T14:49:31.074Z

And I'm co-ordinating now with @tcrawley to fetch deps info from clojars 😍

borkdude 2021-02-24T15:36:21.075400Z

The rewrite-edn lib was referenced here a couple of days ago and I thought I'd make a video on it: https://youtu.be/bPoe2N7J5yg

👍 2
mike_ananev 2021-02-24T16:02:10.075700Z

I did my own project workflow for tools.deps which has basic Leiningen functionality. https://github.com/redstarssystems/rssyslib

borkdude 2021-02-24T16:08:37.076Z

That's cool. Another attempt was done by @pyr as a joker script which I ported to babashka here: https://gist.github.com/borkdude/c34e8e44eb5b4a6ca735bf8a86ff64fa (original you can see via the forked link) This can even become its own GraalVM compiled standalone binary perhaps :)

borkdude 2021-02-24T16:08:59.076200Z

But I guess a template is more flexible because you can tweak it later and won't require others to install the tool

seancorfield 2021-02-24T18:08:15.076600Z

In case, any folks aren't in #news-and-articles

❤️ 6
borkdude 2021-02-24T18:13:25.077600Z

@seancorfield So you basically have one top-level project to rule them all. But this will be forbidden in the future, unless I have misunderstood the warning:

worldsingles/worldsingles {:local/root "../worldsingles"}

2021-02-24T18:16:32.078400Z

I believe the warning is for outside paths, not for local roots

borkdude 2021-02-24T18:16:58.078700Z

ah, you are correct sir

borkdude 2021-02-24T18:17:45.079500Z

So why did we have to discuss this for 2 years before this solution emerged? It makes sense to me at first glance ;)

borkdude 2021-02-24T18:19:33.080200Z

We have other scripts and Makefiles etc within the subprojects, so being in the subproject is a convenience maybe

borkdude 2021-02-24T18:19:53.080500Z

But it's good to have alternatives. Thanks for the write-up Sean!

seancorfield 2021-02-24T18:31:28.081500Z

@borkdude I think @hiredman had the same response when he read over a draft of that article last night 🙂

borkdude 2021-02-24T18:32:08.082700Z

I wonder how one top-level project solves the local/root caching issues you were seeing with the scripting approach. I've seen this problem in "normal" usages of local/root as well

seancorfield 2021-02-24T18:32:32.083300Z

I think I just kept holding out, hoping that the CLI would magically sprout a "fourth" deps.edn file in there... but I've given up on that now 🙂

seancorfield 2021-02-24T18:34:32.085700Z

Yeah, we're still at the mercy of :local/root transitive deps but it's much less of a problem now that we're not trying to auto-generate the deps.edn files: and now we only have a single .cpcache folder to worry about instead of one in every subproject, which means -Sforce should be sufficient in all cases now.

borkdude 2021-02-24T18:34:59.086300Z

Ah, transitive local/roots, yeah, that we don't have yet

borkdude 2021-02-24T18:35:18.086700Z

We only have direct ones for now

borkdude 2021-02-24T18:35:23.087Z

But this might change...

seancorfield 2021-02-24T18:35:30.087200Z

I still have a couple of tickets at work around cleaning up the last few vestiges of the "big shift" we just did last week to arrive at this new setup.

borkdude 2021-02-24T18:36:02.088300Z

What I like about the scripting approach is that it doesn't rely on any features that I don't use often, just a simple "what you see is what you get" deps.edn

borkdude 2021-02-24T18:36:29.089Z

But it's good to know that this works in case the scripting approach has clear negatives

seancorfield 2021-02-24T18:36:38.089300Z

Of course, the CLI / t.d.a may change again in the future and necessitate yet another (big) shift but I get the sense that we're much closer to the core team's thinking about how deps.edn should be used now than we were in either of our previous incarnations.