Fork me on GitHub
#tools-deps
<
2022-02-03
>
teodorlu12:02:59

What's a good way to look up the latest stable coordinate for a package?

$COMMAND_OR_SCRIPT org.clojure/clojure
# Not by manually browsing maven central, looking at clojars, or copying from Github READMEs
1.10.3

teodorlu12:02:56

so .. if I had actually read the docs, I would have found:

clj -X:deps find-versions :lib clojure.java-time/clojure.java-time

{:mvn/version "0.1.0"}
{:mvn/version "0.2.0"}
{:mvn/version "0.2.1"}
{:mvn/version "0.2.2"}
{:mvn/version "0.3.0"}
{:mvn/version "0.3.1"}
{:mvn/version "0.3.2"}
{:mvn/version "0.3.3"}

duckie 1
teodorlu13:02:48

With

alias clj-dep-versions="clj -X:deps find-versions :lib"
, we can
clj-dep-versions org.clojure/clojure

{:mvn/version "1.0.0"}
{:mvn/version "1.1.0"}
{:mvn/version "1.2.0"}
{:mvn/version "1.2.1"}
{:mvn/version "1.3.0-alpha5"}
...

teodorlu13:02:54

But I think I'll go with neil.

borkdude12:02:53

@teodorlu I have a babashka script for this called neil, which currently just add the lib directly to your deps.edn:

$ neil add dep :lib org.clojure/clojure :deps-file foo.edn
$ cat foo.edn
{:deps {org.clojure/clojure {:mvn/version "1.11.0-beta1"}}
 :aliases {}}

teodorlu12:02:29

ooh, that's even nicer. And I persume faster startup than JVM.

teodorlu12:02:51

Thank you 🙏

borkdude13:02:06

You can also use it to add a tools.build config + file to your repo:

neil add build

👍 1
teodorlu13:02:33

Provided NixOS package works great :thumbsup:

Godwin Ko13:02:03

What’s the difference between clj -Stree & clj -X:deps tree? In one of my project using clj-http, the first command runs fine but the second one throw exception of could not locate file on classpath :thinking_face:

Alex Miller (Clojure team)13:02:45

The first runs in your project classpath, the latter runs outside of it, but if you're just running those commands they should basically be the same. Can you share your clj version and the error?

Godwin Ko14:02:01

clj version is 1.10.3.967, here’s the output for clj -Stree

org.clojure/data.json 1.0.0
org.clojure/clojure 1.10.3
  . org.clojure/spec.alpha 0.2.194
  . org.clojure/core.specs.alpha 0.2.56
org.clojure/core.logic 1.0.0
org.clojure/tools.namespace 1.1.0
  . org.clojure/java.classpath 1.0.0
  . org.clojure/tools.reader 1.3.4
instaparse/instaparse 1.4.10
metosin/malli 0.2.1
  . borkdude/dynaload 0.2.2
  . borkdude/edamame 0.0.11-alpha.15
    X org.clojure/tools.reader 1.3.2 :older-version
  . org.clojure/test.check 1.1.0
org.clojure/math.combinatorics 0.1.6
org.clojure/core.match 1.0.0
org.clojure/data.priority-map 1.0.0
http-kit/http-kit 2.5.3
and here’s for clj -X:deps tree
Exception in thread "main" Syntax error compiling at (user.clj:1:1).
        at clojure.lang.Compiler.load(Compiler.java:7652)
        at clojure.lang.RT.loadResourceScript(RT.java:381)
        at clojure.lang.RT.loadResourceScript(RT.java:368)
        at clojure.lang.RT.maybeLoadResourceScript(RT.java:364)
        at clojure.lang.RT.doInit(RT.java:486)
        at clojure.lang.RT.init(RT.java:467)
        at clojure.main.main(main.java:38)
Caused by: java.io.FileNotFoundException: Could not locate org/httpkit/client__init.class, org/httpkit/client.clj or org/httpkit/client.cljc on classpath.
        at clojure.lang.RT.load(RT.java:462)
        at clojure.lang.RT.load(RT.java:424)
        at clojure.core$load$fn__6856.invoke(core.clj:6115)
        at clojure.core$load.invokeStatic(core.clj:6114)
        at clojure.core$load.doInvoke(core.clj:6098)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invokeStatic(core.clj:5897)
        at clojure.core$load_one.invoke(core.clj:5892)
        at clojure.core$load_lib$fn__6796.invoke(core.clj:5937)
        at clojure.core$load_lib.invokeStatic(core.clj:5936)
        at clojure.core$load_lib.doInvoke(core.clj:5917)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invokeStatic(core.clj:669)
        at clojure.core$load_libs.invokeStatic(core.clj:5974)
        at clojure.core$load_libs.doInvoke(core.clj:5958)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invokeStatic(core.clj:669)
        at clojure.core$require.invokeStatic(core.clj:5996)
        at clojure.core$require.doInvoke(core.clj:5996)
        at clojure.lang.RestFn.invoke(RestFn.java:436)
        at user$eval138$loading__6737__auto____139.invoke(user.clj:1)
        at user$eval138.invokeStatic(user.clj:1)
        at user$eval138.invoke(user.clj:1)
        at clojure.lang.Compiler.eval(Compiler.java:7181)
        at clojure.lang.Compiler.eval(Compiler.java:7170)
        at clojure.lang.Compiler.load(Compiler.java:7640)
        ... 6 more

Godwin Ko14:02:08

I switch from clj-http to http-kit to see if that’s a library specific issue, but seem not……

Godwin Ko14:02:20

my deps.edn is a very simple one, nothing special I guess

{:paths ["src" "resources"]
 :deps {http-kit/http-kit {:mvn/version "2.5.3"}
        instaparse/instaparse {:mvn/version "1.4.10"}
        metosin/malli {:mvn/version "0.2.1"}
        org.clojure/core.logic {:mvn/version "1.0.0"}
        org.clojure/core.match {:mvn/version "1.0.0"}
        org.clojure/data.json {:mvn/version "1.0.0"}
        org.clojure/data.priority-map {:mvn/version "1.0.0"}
        org.clojure/tools.namespace {:mvn/version "1.1.0"}
        org.clojure/math.combinatorics {:mvn/version "0.1.6"}}
 :aliases {:nrepl {:extra-deps {cider/cider-nrepl {:mvn/version "0.25.5"}
                                refactor-nrepl/refactor-nrepl {:mvn/version "2.5.1"}}
                   :main-opts ["-m" "nrepl.cmdline"
                               "--middleware" "[cider.nrepl/cider-middleware,refactor-nrepl.middleware/wrap-refactor]"
                               "--interactive"]}}}

Alex Miller (Clojure team)14:02:44

ah, so the difference is in your user.clj being included - there is actually a fix for this in the Clojure CLI released yesterday - 1.10.3.1075

1
Godwin Ko14:02:07

confirm that 1.10.3.1075 fixed the issue, thx a lot :man-bowing::skin-tone-2:

Alex Miller (Clojure team)14:02:05

happy coincidence :)

😄 1
seancorfield17:02:33

Figured I'd move the conversation here from #announcements -- I'd lean toward just removing it as a file at this point but I don't know whether there are still tools out there relying on the files instead of using t.d.a as a library. I think there might also be a little confusion if clojure -Sdescribe stops showing the root deps.edn file but the docs all continue to talk about merging three deps.edn files? Updating the brew-install version to "match" the t.d.a resources' version is the path of least resistance but that redundancy is definitely starting to bother me.

Alex Miller (Clojure team)17:02:26

there are still tools (notably the datomic stuff) that I believe are still pulling the file via -Sdescribe so I'm going to continue letting it drag along for a while

Alex Miller (Clojure team)17:02:39

I have filed prs/issues on projects I'm aware of still using old APIs using this older stuff to get it cleaned up but for now, I'm ok being lazy about cleaning it up

seancorfield17:02:02

OK, so just update the brew-install deps.edn to avoid confusion? (and to help those legacy tools work "properly")

Alex Miller (Clojure team)17:02:29

I will probably also start just extracting it from tdeps so there is only one thing to update

1
simonkatz20:02:30

If I have an alias in a project-level deps.edn file, is there something I can add to my user-level deps.edn to add some dependencies to that alias? (Maybe I have :dev aliases in multiple projects, and I want to add some dev dependencies to all projects.) (If I have a :dev alias in both places, it seems that the user-level one is ignored rather then merged.)

Alex Miller (Clojure team)20:02:55

you can use multiple aliases, so user deps.edn could have shared stuff and project level could have per-project

Alex Miller (Clojure team)20:02:27

then clj -A:common:dev ... or whatever

simonkatz21:02:35

@alexmiller OK, that makes sense. Thanks. The problem (if that’s what it is) is that maybe I have the :dev alias shared across my team, and maybe shared scripts and/or a shared Emacs .dir-locals file specifying (cider-clojure-cli-aliases . "dev") , so that eg starting a REPL from Emacs does nice things. So it would be nice to be able to piggyback onto the :dev alias in my user-level deps.edn. Maybe I’m just doing it wrong.

simonkatz21:02:45

Hmmm, I could agree with my team to have a :user-level-dev alias, and our shared scripts etc could refer to that.