Fork me on GitHub
#tools-deps
<
2021-11-05
>
Ed11:11:45

I want to include a local/root dependency, passing in an alias (so that it includes some extra-paths defined in that project). I recall this being a feature that was talked about but not yet implemented, but I can't find the ticket/ask clojure question/discussion ... Is this done? Can someone point me in the right direction? Or am I barking up the wrong tree?

Ed14:11:57

many thanks ... upvoted 😉

rickmoynihan12:11:16

I’ve often wondered about having something like that. I guess it might want to be constrained somehow, so a published deps.edn file can state which of its aliases are to be exported?

mpenet13:11:28

I would love to have aero like tag literals. stuff like #include #merge #env #join #profile #ref etc, seems that it could solve 99% of these kind of uses cases where some sort of composition is required

rickmoynihan13:11:42

Personally I think it makes sense for deps.edn to always be fully resolved, and not require interpretation. Though arguably some of the features like :paths accepting aliases, are implementing a constrained version of #ref You can of course already use aero to generate deps.edn. Indeed this is something I was meaning to ask with regards your deps-modules tool… why not just use aero?

mpenet13:11:57

because clj / tooling doesn't know how to handle it

mpenet13:11:25

the ultimate goal was to have the less friction for devs

mpenet13:11:43

the stuff you generate/modify should be a normal deps.edn file, what you see is what you get

mpenet13:11:17

it's difficult enough to push deps usage when everything works fine (to some extent) with lein

mpenet13:11:03

wysiwyg bit is actually a counter argument to aero style tags 🙂 but if it was part of tools-deps it'd be ok

mpenet13:11:13

one thing for sure, if we have to tell devs who are happy with lein that they have to juggle with tons of aliases to get stuff going they ll be resisting the change

mpenet13:11:21

(personally I just want to speed up dev when you juggle with tons of repos (esp. with deep deps trees), the fact a commit is immediately available from repo a to repo b is the big sell, no need to wait ci/build/deploy from other prs)

mpenet13:11:34

the rest is sugar on top

rickmoynihan13:11:14

Yeah — generating deps.edn from templates certainly isn’t without its problems… Though arguably tools.build substantially reduces the need to do that

mpenet13:11:37

clearly, I hate it, but it's "the least worst" solution imho so far

mpenet13:11:38

if we had #include/#refs the version pinning problem solved by deps-modules would be solved

mpenet13:11:01

include the version file in some internal key in your deps.edn files then #ref to the values you need for coords

mpenet13:11:03

you could also share aliases from one file to N other files in the "monorepo"

rickmoynihan13:11:54

I think there’s a risk it muddies the water around what subset of deps.edn is available in a local project and at deployment. #include seems dependent on the context.

mpenet13:11:13

I am not sure I follow

Joshua Suskalo13:11:39

What impact does putting a provided-scope dependency in the pom for a project and not the deps.edn in order to list an optional dependency? The provided scope dependency in this case would be to allow cljdoc to document my project.

Joshua Suskalo13:11:21

In particular I'm curious if having a provided dependency in the clojars release will pull in a dependency for anyone depending on my project with tools-deps (or leiningen).

mpenet13:11:43

#include is quite static. If you want to do conditional includes you can use stuff like profiles (in theory), or use aliases 🙂

borkdude13:11:23

This has been discussed before btw, you can find some conversation if you search this channel with "interpretation" or so. It was decided against then.

mpenet13:11:27

the risk is to end up in a situation where you're half way to have "deps.clj" where it's all clojure code anyway, then you can launch a rocket in space and merge your deps

mpenet13:11:51

@borkdude I guess it's still unsolved

Joshua Suskalo13:11:21

In particular I'm curious if having a provided dependency in the clojars release will pull in a dependency for anyone depending on my project with tools-deps (or leiningen).

borkdude13:11:44

@suskeyhose you can also provide a dependency scope in deps.edn afaik

Joshua Suskalo13:11:07

I was looking in the docs and I didn't see that, so I figured I'd have to put it in the template pom.

Alex Miller (Clojure team)13:11:21

provided scope in a clojars dep should not pull in a dep with any tool

borkdude13:11:23

oh hmm, well if Alex says you cannot, it is true :) perhaps use an alias?

borkdude13:11:50

(I was mixing it up with :exclusions which you can provide)

borkdude13:11:57

what's the reason not to do this with an alias...?

Joshua Suskalo14:11:18

Basically I have a project which requires a namespace from a library I don't depend on so that I can optionally extend that library to work with mine. cljdoc chokes on this because it's trying to analyze the namespace with a require for something not on the classpath, but if I specify a provided-scope dependency in the pom then it will include it on the classpath to allow analysis.

Joshua Suskalo14:11:51

I can't do this with an alias because cljdoc is dependent entirely on the maven release and ignores the deps.edn

borkdude14:11:10

Another alternative: provide another library which has your namespace

borkdude14:11:17

+ the required library

Joshua Suskalo14:11:25

that's far from ideal when part of the usecase here is that the user shouldn't need to know if the other library is in their transitive dependencies

borkdude14:11:09

I see yeah.

Joshua Suskalo14:11:20

What I'm doing is in the library farolero I'm extending flow's mechanism to not catch the unwinding mechanism. That's something that should be transparent because someone using farolero shouldn't need to know if a library they're using is using flow internally

dominicm23:11:20

your deps.edn and pom.xml don't need to directly connect.

dominicm23:11:40

In clip I manually maintain the pom.xml with provided dependencies so that cljdoc will work.

Andreas S.14:11:42

Hello when I'm trying to run "clj" from the CLI I get this: Error: Could not find or load main class clojure.main Caused by: java.lang.ClassNotFoundException: clojure.main

Alex Miller (Clojure team)14:11:33

do you have a deps.edn in the current directory or not?

Andreas S.14:11:04

im on windows

Andreas S.14:11:16

yes I havea deps.edn in the directory

Alex Miller (Clojure team)14:11:34

if you run from a directory without a deps.edn, does it work?

Andreas S.14:11:48

you mean with lein?

Alex Miller (Clojure team)14:11:58

no, if you run clj from a different dir

Andreas S.14:11:17

in all other directories it says the same thing

Andreas S.14:11:31

no I think this is quite old

Andreas S.14:11:41

where do I find the latest installer?

Alex Miller (Clojure team)14:11:43

well, probably best to start with a new install

Andreas S.14:11:39

thank you alex that worked!

rickmoynihan16:11:09

Oh, forgot to say… I’ve been using it all day, and it works fine so far :thumbsup: The -X:deps list feature happened to be exactly what I was wanting to check something

borkdude18:11:19

I'm also happy about the manifest addition: less -Sforce !

Alex Miller (Clojure team)19:11:34

be gentle, kind friends

borkdude19:11:04

I was trying to give a compliment, did I fail? ;)

Alex Miller (Clojure team)19:11:42

no, I'm agreeing we should "use less force"

borkdude19:11:23

make deps, not jar? ;)

borkdude19:11:46

slogan in favor of git deps ;)

respatialized18:11:29

is there a way to specify a git SHA for a :local/root dep?

Alex Miller (Clojure team)18:11:21

it might be possible to use a git local url and a git sha as a git dep

Alex Miller (Clojure team)18:11:32

but I have not tried it

Alex Miller (Clojure team)18:11:49

if it doesn't work, feel free to file a bug at https://ask.clojure.org

Alex Miller (Clojure team)18:11:42

from a quick perusal of code and a couple tests, I think this won't work right now, but could easily be made to work

respatialized18:11:54

yeah one thing I ran into fairly quickly was the requirement that paths be relative rather than absolute (inherited from clojure.tools.gitlibs based on the stacktrace)

respatialized18:11:04

I can file a full report if you like

Alex Miller (Clojure team)18:11:39

that's really a subset of the problem - the code that translates git urls to cache dirs and libs doesn't handle either raw paths or relative urls

Alex Miller (Clojure team)18:11:45

but yeah, that would be great

respatialized18:11:56

will do ✔️

respatialized19:11:31

it seems like the URL issue is complected with the SHA issue; I will file separate issues for each

Alex Miller (Clojure team)19:11:45

yeah, I don't expect to support shas for :local deps

Alex Miller (Clojure team)19:11:15

if you want to treat something as a git dep, it will need to be a git dep

respatialized19:11:46

ah, I see - so really the SHA issue takes care of itself if the URL issue is fixed. Feel free to close the first one then.

borkdude19:11:11

git also supports local file support right?

git clone /srv/git/project.git
is that something that can be used in that scenario?

Alex Miller (Clojure team)19:11:23

well, doesn't work with absolute paths or relative .. paths (although it might work in some cases, it's doing unholy things to the gitlibs dir)

Alex Miller (Clojure team)19:11:12

all just a matter of fixing the url -> cache-path function, which is a bit of a hack anyways

borkdude19:11:13

I see now that is the second issue, sorry for not paying attention

Alex Miller (Clojure team)19:11:37

trying to decide how far I want to go to unhack it :)