Fork me on GitHub
#tools-deps
<
2021-02-24
>
borkdude11:02:07

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.

borkdude11:02:20

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

borkdude12:02:05

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]()
scripts) to a `deps.edn` project.
- Migrating from git deps to mvn deps
- Checking if there is a newer version available

pavlosmelissinos12:02:00

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 🙂

borkdude12:02:31

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

3
borkdude12:02:30

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

borkdude12:02:08

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

borkdude12:02:53

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.

borkdude13:02:45

No, it was a different one

mike_ananev16:02:10

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

borkdude16:02:37

That's cool. Another attempt was done by @U06V097TP 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 :)

borkdude16:02:59

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

mpenet03:02:20

Just + deps is a really good match

mpenet03:02:59

Just gives you a lot for free

Alex Miller (Clojure team)14:02:10

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

6
jjttjj14:02:17

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

Alex Miller (Clojure team)14:02:02

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

Alex Miller (Clojure team)14:02:41

still trying to figure out where to draw the boundaries

Alex Miller (Clojure team)14:02:04

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 :)

Alex Miller (Clojure team)14:02:03

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

🤤 24
borkdude14:02:02

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

👍 3
borkdude14:02:31

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

borkdude15:02:21

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

👍 6
seancorfield18:02:15

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

❤️ 18
borkdude18:02:25

@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"}

hiredman18:02:32

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

borkdude18:02:58

ah, you are correct sir

borkdude18:02:45

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

borkdude18:02:33

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

borkdude18:02:53

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

seancorfield18:02:28

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

borkdude18:02:08

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

seancorfield18:02:32

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 🙂

seancorfield18:02:32

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.

borkdude18:02:59

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

borkdude18:02:18

We only have direct ones for now

borkdude18:02:23

But this might change...

seancorfield18:02:30

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.

borkdude18:02:02

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

borkdude18:02:29

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

seancorfield18:02:38

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.