Fork me on GitHub
#tools-deps
<
2023-07-05
>
cfleming01:07:43

Is it documented anywhere that tool aliases can use :deps and :paths, and that this will replace the project deps? https://clojure.org/reference/deps_and_cli#_arg_map_keys doesn’t mention it, and I can’t find it explicitly mentioned in the reference, but there’s an example at https://clojure.org/reference/deps_and_cli#_using_tool_aliases. What is the difference between doing this and using :replace-deps?

Alex Miller (Clojure team)04:07:14

No difference, they are aliases

Alex Miller (Clojure team)04:07:50

Same with paths and replace-paths

Alex Miller (Clojure team)04:07:11

Kind of a historical artifact at this point

cfleming04:07:39

Is one or the other the preferred way going forward?

seancorfield04:07:55

I'll be interested to hear it there's a preference at this point... The official guide suggests :deps (and paths is rarely needed but I'd expect :paths to be suggested), but I don't remember the history...

cfleming05:07:02

Does it? The deps and cli ref mostly mentions :replace-deps, and only has :deps in examples. I can’t see anywhere there where it’s even documented that :deps is a thing you can use (although the doc is big and dense, I might have missed it).

seancorfield05:07:38

The official tools.build guide, I meant, shows :deps.

seancorfield05:07:58

Yes, the CLI/deps guide/reference talks about :replace-deps and :replace-paths in https://clojure.org/reference/deps_and_cli#_replace_project_environment_tool and https://clojure.org/reference/deps_and_cli#_arg_map_keys but that was about how to get tool-like behavior before -T existed I think? But https://clojure.org/guides/tools_build#_setup talks about -T and :deps and :paths.

cfleming05:07:50

Well, the deps and cli ref definitely discusses -T, as well as installing tools and running them via aliases. I don’t think it’s a big deal, but the inconsistency makes it more confusing than it needs to be right now.

seancorfield06:07:28

Sure, but that reference has this example:

:aliases {
   :linter {:deps {cool/lint-tool {:git/tag "..." :git/sha "..."}}
            :ns-default cool.lint.tool}
With :deps, not :replace-deps.

seancorfield06:07:21

I agree it could be cleaned up. I'm not sure it's "inconsistent" tho'...

cfleming06:07:37

Yes, I know, I linked that above. But having it appear like that in examples, when there’s no mention in the doc that that is even possible, is confusing.

seancorfield06:07:43

It omits quite a bit of nuance (but that's nothing new for Clojure docs).

seancorfield06:07:07

No mention of what in the doc?

cfleming06:07:42

That you can use :deps in aliases instead of :replace-deps. Under “Arg Map Keys” only the replace- versions are shown.

seancorfield06:07:44

You're not joining the dots tho'... All of the tool examples use :deps and the narrative around -T says that project :deps / :paths are ignored so you only get :deps and :paths from the alias (or the tool) -- and that if :paths is omitted you get ["."]. That's all consistent.

cfleming06:07:33

I guess we’ll have to agree to disagree. Anyway, at least I understand what’s going on now.

seancorfield06:07:34

The :replace-deps / :replace-paths stuff is not inconsistent with that: it says that in any context (`-M`, -X, or -T), those override the other deps/paths.

seancorfield06:07:12

I'm not sure what we're disagreeing on -- but I'm glad you understand the docs, I think?

cfleming06:07:46

No, I understand what is going on after Alex clarified it for me above 🙂

1
practicalli-johnny08:07:27

Personally I find the :deps and :path shortcuts make learning and maintaining Clojure CLI projects more involved. deps and paths do different things depending on if they are at the top level or in an :aliases definition. I encourage use of the explicit names to make it obvious as to what the configuration will do.

cfleming08:07:59

Sounds very wise to me.

dpsutton13:07:07

I’m having an issue using a dep from maven. The dep is https://central.sonatype.com/artifact/org.nd4j/nd4j/1.0.0-M2.1 (org.nd4j/nd4j). I can browse to it at https://repo1.maven.org/maven2/org/nd4j/nd4j/1.0.0-M2.1/ . But there are no jars in that folder, just a pom and checksums. Looking at the pom I don’t see it labelled as a bom, but I do see <modules> that makes me think it is using a feature that tools.deps doesn’t support. > ❯ clj -Sdeps ‘{:deps {org.nd4j/nd4j {:mvn/version “1.0.0-M2.1”}}}’ -P > Error building classpath. Could not find artifact org.nd4j:nd4j:jar:1.0.0-M2.1 in central (https://repo1.maven.org/maven2/)

Carsten Behring13:07:00

Figure out which modules you need and then add them one-by-one ? This is one of them: https://repo1.maven.org/maven2/org/nd4j/nd4j-tensorflow/1.0.0-M2.1/nd4j-tensorflow-1.0.0-M2.1.pom

dpsutton13:07:18

ok. so modules are opaque to tools.deps and i can unfurl them manuall?

dpsutton13:07:33

Is there a way to consume this dependency with tools.deps?

Alex Miller (Clojure team)13:07:19

pom-only or bom dependencies are not currently supported as top-level deps, this is a wip area (https://clojure.atlassian.net/browse/TDEPS-202)

dpsutton13:07:48

how can i recognize that this is “pom-only” dependencies? Is it <modules>?

Alex Miller (Clojure team)14:07:10

<packaging>pom</packaging>

dpsutton14:07:28

ah. thank you

Alex Miller (Clojure team)14:07:54

modules is about maven build time, doesn't affect anything on consumption side

🙏 1