This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-10-07
Channels
- # aleph (1)
- # announcements (2)
- # babashka (1)
- # beginners (49)
- # calva (1)
- # cider (5)
- # clj-kondo (14)
- # cljdoc (11)
- # cljsrn (6)
- # clojure (120)
- # clojure-austin (1)
- # clojure-europe (6)
- # clojure-finland (3)
- # clojure-italy (29)
- # clojure-nl (6)
- # clojure-spec (38)
- # clojure-uk (14)
- # clojurescript (65)
- # code-reviews (8)
- # cursive (20)
- # data-science (1)
- # datascript (5)
- # datomic (57)
- # emacs (6)
- # figwheel-main (2)
- # fulcro (32)
- # funcool (1)
- # jackdaw (7)
- # jobs (3)
- # joker (7)
- # kaocha (8)
- # keechma (3)
- # nrepl (7)
- # off-topic (25)
- # quil (3)
- # re-frame (10)
- # reagent (43)
- # remote-jobs (1)
- # ring (1)
- # shadow-cljs (173)
- # sim-testing (1)
- # spacemacs (1)
- # sql (3)
- # tools-deps (34)
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
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.
you always implicitly have a deps.edn, even if it's just including clojure from the system deps.edn
sounds like a mixture of 2 and 3
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.
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).
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.
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.
by which you mean you would have a lib that called add-lib?
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
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?
tests
not sure what that means? you add tests and rely on that failing later to tell you to add the lib?
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
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 :require
s. This will cause the project to fail CI tests if someone forgot to add it to the deps.edn.
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).
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.
I'm currently exploring similar ideas
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.
yeah, I'm probably going to remove that
I know :) but the external version would have the same problem, so would a commit-add-lib!
well, I'm more exploring a "refresh" type option
so you would be the one doing the add
Ah sync-deps, I think someone tried that here. They requested knowledge of the aliases in use so they could merge them together :)
"sync" is ambiguous about the direction of the sync. "refresh" is deps.edn -> repl
That's fair. Refresh made me think of tools namespace and I struggled to separate the two.
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
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.
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.
yes, I'm aware. investigating alternatives, making tables :)