Fork me on GitHub
#tools-deps
<
2019-10-09
>
mpisanko01:10:45

hi there, pardon if totally missed this (but google didn't give me any answers). my question is: is there an alternative to lein's pedantic? in tools.deps

seancorfield02:10:45

@mpisanko No. It's also worth bearing in mind that the algorithm for selecting versions is different in t.d.a. so there should be fewer potential conflicts. Or at least, fewer counterintuitive version selections 🙂

seancorfield02:10:25

I think there's still an undocumented :verbose true option you can add to deps.edn so that t.d.a. explains all of its decisions...

mpisanko02:10:35

right, that's the premise of improved dependency resolution i guess. thanks @seancorfield!

seancorfield02:10:51

Looks like :verbose needs to be under an alias, not at the top-level...

{:aliases {:v {:verbose true}} ,,,}
and then clojure -A:v will show the resolution output as t.d.a. works.

Alex Miller (Clojure team)02:10:05

actually there are tools that can help you with this in clj

Alex Miller (Clojure team)02:10:36

in particular, check out depot or deps-ancient

👍 4
seancorfield03:10:27

Those will detect old (outdated) deps in your project -- lein pedantic detects possible version conflicts (usually in transitive deps) and warns about them (and prevents command execution if any potential conflicts are present, as I recall) so it's not really equivalent to anything on that list...?

seancorfield03:10:31

I think t.d.a.'s approach makes much more sense and you can either eyeball things with -Stree to see what actually got picked, but you can only see the potential conflicts if you ask t.d.a. to be verbose, as far as I can tell.

seancorfield03:10:24

(we use depot at work, and it's very useful for flagging deps that could be updated -- but does not show potential conflicts)

seancorfield03:10:39

Looking in more detail at some verbose output from t.d.a. I can see its decision process cuts off some paths that I think Leiningen considers... I'd have to try to repro in lein to be sure... (this has piqued my curiosity!).

seancorfield03:10:02

Yes, confirmed. Example: deps.edn specifies Clojure 1.9.0 and seancorfield/next.jdbc 1.0.8. t.d.a. pins those versions because they are top-level and when it sees that next.jdbc depends on Clojure 1.10.1 it just discards that due to 1.9.0 being the top-level dep. Consequently, t.d.a. goes on to select spec.alpha and core.specs.alpha based on Clojure 1.9.0. When you put the same deps in project.clj and :pedantic? :abort and ask for lein deps :tree, Leiningen also shows the transitive dependencies of Clojure 1.10.1 and warns they conflict with Clojure 1.9.0's deps, suggesting exclusions (on next.jdbc) to exclude all three of clojure, spec.alpha, and core.specs.alpha (and then it aborts).

seancorfield03:10:15

(if you tell lein to exclude org.clojure/clojure that is enough to satisfy it)

dottedmag07:10:39

@alexmiller Please have a look at TDEPS-56 when you have time. I have posted a patch and an upsides/downsides table some time ago, and there was no further discussion on the topic.

Michaël Salihi07:10:57

@ghadi Yes, I wanted to know if there was already existing tool to manage dependencies before to begin development. I find this tool who do the job https://github.com/hagmonk/find-deps

👍 4
jrwdunham20:10:17

Is it possible to use an alias to override a github library with a local root library?

jrwdunham20:10:53

{:deps {github-myorg/myrepo {:git/url "some-url" :sha "some-sha"}}
 :aliases {:local {:override-deps {myrepo {:local/root "/abs/path/to/my/local/repo/"}}}}}

jrwdunham20:10:14

^ doesn't seem to do what I want.

jrwdunham20:10:37

presumably because the lib names github-myorg/myrepo and myrepo differ

jrwdunham20:10:52

d'oh. It looks like I can just stop using the symbol github-myorg/myrepo for the GH dep and instead use myrepo as with the local dep. I didn't realize that was just a naming convention and not a requirement.

dominicm20:10:15

Extra-deps instead of override

jrwdunham20:10:52

but wouldn't that result in two deps with the same namespaces?

jrwdunham20:10:38

to be clear, this now seems to do what I want:

jrwdunham20:10:52

{:deps {myrepo {:git/url "some-url" :sha "some-sha"}}
 :aliases {:local {:override-deps {myrepo {:local/root "/abs/path/to/my/local/repo/"}}}}}

seancorfield20:10:53

Yup, myrepo in the above is the coordinate for your dependency: the group and artifact ID, as if it were myrepo/myrepo -- and the coordinate has to match since that's what you are overriding.

seancorfield20:10:27

(well, technically, the "coordinate" is the group/artifact and the version information but...)

seancorfield20:10:16

So it isn't "just a naming convention" -- it has a specific meaning.

jrwdunham20:10:31

Thanks @seancorfield that clarification is helpful. I should have been more clear: I intended to write that I was under the false assumption that if a coordinate used the :git/url key in its version info that it had to have a group containing the github- prefix.

seancorfield21:10:09

If you're not trying to override a "regular" dep with a git dep, then you can give it any unique name you want, but using your github organization (username) and the repo name means it's not likely to conflict with a "regular" dep.

seancorfield21:10:39

If you're working with a regular dep (group/artifact) with a Maven version, you can just swap out the version part for a :git/url part or :local/root part and keep the same group/artifact to effectively override the Maven version with that git or local version -- and that will work even if it is a transitive dependency of something else you're depending on (since you'd have it as a top-level dep).

seancorfield21:10:51

Does that help, or just make it more confusing @jrwdunham?

seancorfield21:10:38

An example: https://github.com/seancorfield/dot-clojure/blob/master/deps.edn#L136-L149 -- that uses a git version instead of the Maven Central version of org.clojure/tools.deps.alpha

jrwdunham21:10:40

@seancorfield I am left a bit more helped and a bit more confused. So, in your example, since you are not declaring a top-level :deps for org.clojure/tools.deps.alpha, you use :extra-deps in your :deps alias to effectively override the Maven dependency that would be installed otherwise. Is that accurate?

seancorfield21:10:52

I use :extra-deps there to ensure it is added (with that git version). :override-deps only takes effect if something else is bringing in that dependency.

seancorfield21:10:44

(in this case, it becomes a top-level dep so even if something else brings in t.d.a. as a transitive dep, my selection takes precedence)

cfleming23:10:19

Has anyone had problems using s3 repos with deps under Java 11?

cfleming23:10:09

Some Cursive users are having problems which is reported as not being able to access java/sql/Timestamp, when using lein that’s usually resolved by upgrading the s3 wagon. But it looks like the deps version is baked in.

cfleming23:10:24

Is anything required to be added to the module classpath, or anything like that?

Alex Miller (Clojure team)23:10:09

no, lots of people doing this, haven't heard any issues

Alex Miller (Clojure team)23:10:24

java/sql/Timestamp is in particular not in the base module

cfleming23:10:34

Ok, I’ll see if I can figure it out, and I’ll report back if I do.

cfleming23:10:59

Right, that’s what’s been giving problems since IntelliJ started using JBR11 as its base JRE.

Alex Miller (Clojure team)23:10:01

so lein's trick of adding itself to the bootclasspath doesn't work

Alex Miller (Clojure team)23:10:20

as at boot time, only the base module is loaded

cfleming23:10:42

I’m pretty sure it’s not a bootclasspath issue, since this is executed within Cursive and I don’t use it.

cfleming23:10:56

Well, IntelliJ doesn’t use it, more accurately.

Alex Miller (Clojure team)23:10:03

yeah, didn't make sense to me either

cfleming23:10:09

I run lein in an isolated classloader using shimdandy.

Alex Miller (Clojure team)23:10:10

but it matches those symptoms

Alex Miller (Clojure team)23:10:32

what do you put in the isolated classloader? and where is it rooted?

Alex Miller (Clojure team)23:10:57

if it's rooted off the base loader or app loader or whatever they call it, it might only have the base module available

cfleming23:10:30

Yes, I think that’s probably the case. It’s rooted off the parent classloader for a boostrap class I use, which IIRC is the app classloader. It almost certainly won’t have the SQL module available.

Alex Miller (Clojure team)23:10:02

in java 9+ that loader is represented as null (the bootstrap loader). it only has access to the base module

cfleming23:10:18

But my impression was that some of the older s3 wagons had problems with this that were resolved in later versions - certainly using lein, upgrading the wagon usually fixes the issue.

Alex Miller (Clojure team)23:10:40

deps uses a newer version of the s3 wagon than the lein plugin does

cfleming23:10:52

But my understanding of how all this works in the brave new world is sadly incomplete. Looks like I’m going to have to figure it out.

cfleming23:10:02

Hmm, interesting.

Alex Miller (Clojure team)23:10:05

well, maybe it's been updated since I last looked, not sure

cfleming23:10:14

Ok, I’ll see if I can reproduce the issue and debug it.