Fork me on GitHub
#tools-deps
<
2020-05-20
>
dharrigan06:05:16

is it necessary to include clojure as a dep in the deps.edn? I've seen a few projects with it included.

dominicm10:05:19

There was a news-and-articles by daniel janus recently about this

Alex Miller (Clojure team)12:05:28

Yes, but it is included by default

dominicm12:05:11

My personal thoughts are that you should mark your minimum required version. Because if you don't update your computer (for some reason) and then rock up on a project using Clojure 1.22 features, and you've got 1.15 you'll be scratching your head for a while. One less thing to manage externally.

💯 4
dharrigan13:05:11

It's more to do with docker containers. If I can remove the dependency (as it's already there as part of openjdk-11-tools-deps-slim-buster), then I can remove it from the deps.edn file, thus making the binary ever so slightly smaller.

dominicm13:05:37

Hmm, I think you'll only get one copy either way...

Alex Miller (Clojure team)14:05:32

you need to have it, and you will via the install deps.edn, it's just a question of version

dominicm14:05:52

Maybe by removing it, you're just forcing to match the version in your docker.

dharrigan16:05:13

Probably safer to leave it in.

dharrigan16:05:18

After all, storage is cheap 🙂

idkfa07:05:13

Hello, I've seen examples of installing dependencies using clj -Sdeps '{:deps {bidi {:mvn/version "2.1.6"}}}' but I was wondering if it's possible to instruct clj to install dependencies listed in deps.edn without doing anything else? Similar to lein deps I suppose.

delaguardo07:05:27

clj -Spath as an option. it will download dependencies and print out calculated class-path

seancorfield11:05:36

I think I've seen clj -e nil given as a quieter example.

☝️ 4
teodorlu12:05:26

I've used clj -e :deps-download-complete when building Docker images

idkfa21:05:23

Thanks for the suggestions, that's really helpful. My use case is also for building Docker images.

👍 4
dvingo17:05:47

is there a way via clj to see all available aliases?

Alex Miller (Clojure team)17:05:56

Not currently. I’ve been thinking about adding thAt

👍 4
dvingo17:05:32

np, thanks

avi18:05:37

I apologize for the probably FAQ, but I have searched for this… when I specify a gitlib as a dependency, is there a way to specify the path within the gitlib to the source code? e.g. there’s a dep I’d like to use which has its Clojure code in src/clj/

dominicm19:05:17

@aviflax 👋 That would be :deps/root :)

avi19:05:06

👋 Hi Dominic, thanks! I saw :deps/root in the docs, but the description therein says: > Specifies the relative path within the root to search for the manifest file. In the case of this particular dep, the manifest file doesn’t even really exist… I’m faking it by manually setting :deps/manifest to :deps, to finagle tools.deps into treating this dep as if it has an empty deps.edn, which works in this case because the dep has no dependencies itself. Anyway, that’s why I didn’t try it, but it makes sense that it would also change how the lib is added to the classpath. I’ll try it. Thanks!

avi19:05:05

Hmm that’s not quite working. I set :deps/root to src/clj but the path added to the classpath is /src/clj/src 😞

dominicm19:05:18

Oh I see "to the source code". Yeah, that makes sense. I'm not sure you can get away with that.

avi19:05:30

I figured. I kinda wish there was a way to override that src segment that tools.deps adds to the end of the root. Something like :deps/code-path or something.

dominicm19:05:56

It would probably be :deps/paths or something :).

avi19:05:28

Thanks for the link, but I’m not really understanding that function. I think you’re pointing out that there isn’t currently a way to do this?

avi19:05:50

I was thinking maybe :deps/paths but I’m not sure about the plural part. I’m not sure it makes sense to add multiple entries to the classpath for a dep.

avi19:05:24

Tried that already.

avi19:05:32

Doesn’t work in this case, see above.

dominicm19:05:08

@aviflax I am saying there's no way to do this currently :)

avi19:05:28

Yup, got it. Thanks though!

avi19:05:56

I guess I’ll open a ticket/issue as a feature request, couldn’t hurt.

Alex Miller (Clojure team)19:05:47

I think this already does what you want

avi19:05:06

Oh! What am I missing?

Alex Miller (Clojure team)19:05:09

or rather let me back up...

Alex Miller (Clojure team)19:05:19

what kind of project is the git dep?

Alex Miller (Clojure team)19:05:30

what kind of manifest file (pom, lein, deps)

avi19:05:36

project.clj

avi19:05:41

but it has no deps

avi19:05:51

so I’m specifying :deps/manifest as :deps

Alex Miller (Clojure team)19:05:01

that should just work - what doesn't work?

avi19:05:35

In the dep’s dir structure, the Clojure code is in `src/clj/`

avi19:05:02

I tried setting `:deps/root` to `src/clj` but the path added to the classpath was then `/src/clj/src`

Alex Miller (Clojure team)19:05:05

yeah, there is no way right now to externally set a git dep's paths

avi19:05:17

would a ticket be helpful?

Alex Miller (Clojure team)19:05:45

you coudl fork it and add a deps.edn though

avi19:05:05

ah, good point. Maybe I will. Thanks!

Alex Miller (Clojure team)19:05:21

or clone and do the same with a local project

avi19:05:52

I was thinking maybe I’ll open a PR to contribute the deps.edn to the main project; I’d rather not use a fork indefinitely

avi19:05:36

I posted the request as a question to ask as that seems to be the preferred way to suggest an issue these days: https://ask.clojure.org/index.php/9314/is-it-possible-to-override-the-paths-of-a-git-dep

Alex Miller (Clojure team)19:05:33

I think the question presupposes the need to do this, but maybe the broader request is about supporting lein projects

Alex Miller (Clojure team)19:05:05

or even more broader, supporting extensible project types, one of which could be lein

Alex Miller (Clojure team)19:05:49

tools.deps is actually written to support this but clj does not expose that capability currently (b/c there are a lot of questions about how to do it well)

avi19:05:07

I can see it being a kind of support nightmare

avi19:05:28

I’m sure a million edge cases would pop up

avi19:05:49

maybe once tools.deps drops the “alpha” — then there could be a subsequent alpha/beta/whatever release that would enable the feature, with the caveat that it’s unstable, only for testing, etc?