Fork me on GitHub
#tools-deps
<
2019-10-07
>
Alex Miller (Clojure team)15:10:14

if anyone here is an add-lib user, can I ask the scenario where you're using it? is it 1) to definitely add a lib you know you need from prior experience 2) to add a lib you might want to use but are not sure if you need 3) to do a task at the repl that you definitely don't want in your deps.edn

1️⃣ 36
3️⃣ 12
2️⃣ 32
seancorfield17:10:03

Is 3) meant to include situations where you have a "scratch" REPL running just to try stuff out (e.g., helping beginners on Slack) and it would be less convenient to restart that REPL with difference deps rather than just adding a lib to the REPL? For me, such situations are usually not accompanied by deps.edn at all.

Alex Miller (Clojure team)17:10:04

you always implicitly have a deps.edn, even if it's just including clojure from the system deps.edn

Alex Miller (Clojure team)17:10:26

sounds like a mixture of 2 and 3

seancorfield17:10:26

Well, yeah, I meant the "project" (current directory) one. Libraries that I use add-lib for wouldn't generally go in either of the other files.

seancorfield17:10:54

I have a scratch directory that has deps.edn with {} in it and I usually start a plain REPL with -Sdeps on the command-line, but if add-lib was easier to use, I'd just start that plain REPL and then add-lib in anything I wanted to experiment with and just leave it running (instead of restarting with different deps).

plexus07:10:43

For me it would be mostly 1), especially in the early stages of a project I want to be able to add dependencies without having to restart the process. It could also be 2) if it's a lib I haven't used before, to be able to quickly evaluate it before committing to it.

dominicm15:10:43

I have played around with the idea of 3, maybe even for use in dev tooling libraries. But I haven't actually done it yet.

Alex Miller (Clojure team)15:10:35

by which you mean you would have a lib that called add-lib?

dominicm16:10:27

Yeah. Although essentially it's a library of things you'd do at the repl. I can't remember the details of why I was doing this now. Possibly to keep things "light" at someone's request, or maybe because I wanted to load things for dev time based on the config.edn

Alex Miller (Clojure team)15:10:03

and if you answered 1 or 2, how do ensure the dep gets added to deps.edn? do you do it at the same time you add-lib or rely on remembering later?

Alex Miller (Clojure team)15:10:06

not sure what that means? you add tests and rely on that failing later to tell you to add the lib?

delaguardo16:10:33

yes, not a perfect solution, but covers most of the problems something like Could not locate chesire/core__init.class, chesire/core.clj or chesire/core.cljc on classpath. usually is enough to remember what went missing

kenny16:10:16

Yep, pretty much the same thing as @U04V4KLKC. If the lib ends up getting used in the project, it will get added to a namespace's :requires. This will cause the project to fail CI tests if someone forgot to add it to the deps.edn.

dharrigan16:10:54

remember later

seancorfield17:10:23

For 1) I do it at the same time because it's a deliberate act. For 2) I do it later, once I've decided whether the lib is really what I need (so, yeah, I run the risk of forgetting but if I really need the lib, it'll end up required in the code base somewhere so tests will fail if I have forgotten to add it).

dominicm15:10:43

Later. Although I've been working on something which would remember what is add-lib'd and allow me to commit it. And also an alternative entry point for loading it and committing simultaneously.

Alex Miller (Clojure team)15:10:42

I'm currently exploring similar ideas

dominicm16:10:55

As an fyi, I currently don't find the git tag rewriting useful. I put comments into my deps.edn, and losing those is annoying. I've got a few toys that use rewrite-clj to avoid that (including a implementation of the git tag stuff), but they're difficult to write.

dominicm16:10:02

Or rather, it's useful, but that side effect makes it problematic.

Alex Miller (Clojure team)16:10:16

yeah, I'm probably going to remove that

dominicm16:10:52

I know :) but the external version would have the same problem, so would a commit-add-lib!

Alex Miller (Clojure team)16:10:11

well, I'm more exploring a "refresh" type option

Alex Miller (Clojure team)16:10:24

so you would be the one doing the add

dominicm16:10:56

Ah sync-deps, I think someone tried that here. They requested knowledge of the aliases in use so they could merge them together :)

Alex Miller (Clojure team)16:10:53

"sync" is ambiguous about the direction of the sync. "refresh" is deps.edn -> repl

dominicm16:10:37

That's fair. Refresh made me think of tools namespace and I struggled to separate the two.

Alex Miller (Clojure team)17:10:52

How do you know the version of the lib for add-lib? Do you: 1) Look it up on github or other source 2) Use LATEST or RELEASE

seancorfield17:10:33

I use "RELEASE" a lot when I'm just experimenting with a library. I only bake the version into deps.edn once I know I'm going to use it.

seancorfield17:10:29

The "refresh" scenario wouldn't cover a "scratch" situation where you're just trying a lib out in the REPL and don't want deps.edn created/updated.

Alex Miller (Clojure team)17:10:45

yes, I'm aware. investigating alternatives, making tables :)

dharrigan17:10:12

Mostly 1, sometimes 2.

dominicm17:10:04

I usually look it up, I need to look up the coord anyway. I don't memorize those.

✔️ 12