tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
dharrigan 2020-05-20T06:15:16.101Z

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

dominicm 2020-05-20T10:34:19.103500Z

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

dharrigan 2020-05-20T11:22:38.103700Z

ooh. ta.

alexmiller 2020-05-20T12:43:28.106600Z

Yes, but it is included by default

alexmiller 2020-05-20T12:48:07.107Z

So I guess no :)

dominicm 2020-05-20T12:49:11.107200Z

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.

šŸ’Æ 1
dharrigan 2020-05-20T13:47:11.107500Z

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.

dominicm 2020-05-20T13:56:37.107900Z

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

alexmiller 2020-05-20T14:01:32.108100Z

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

dominicm 2020-05-20T14:01:52.108300Z

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

dharrigan 2020-05-20T16:12:13.108500Z

Probably safer to leave it in.

dharrigan 2020-05-20T16:12:18.108700Z

After all, storage is cheap šŸ™‚

idkfa 2020-05-20T07:41:13.103200Z

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.

2020-05-20T07:52:27.103300Z

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

seancorfield 2020-05-20T11:38:36.105300Z

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

ā˜ļø 1
teodorlu 2020-05-20T12:24:26.105600Z

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

2020-05-20T17:42:47.109100Z

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

alexmiller 2020-05-20T17:46:56.109800Z

Not currently. Iā€™ve been thinking about adding thAt

šŸ‘ 1
2020-05-20T17:50:32.110200Z

np, thanks

avi 2020-05-20T18:46:37.111500Z

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/

dominicm 2020-05-20T19:07:17.111600Z

@aviflax šŸ‘‹ That would be :deps/root :)

dominicm 2020-05-20T19:07:37.111700Z

https://github.com/roman01la/uix see an example in UIx

avi 2020-05-20T19:10:06.114300Z

šŸ‘‹ 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!

avi 2020-05-20T19:12:05.114900Z

Hmm thatā€™s not quite working. I set :deps/root to src/clj but the path added to the classpath is /src/clj/src šŸ˜ž

dominicm 2020-05-20T19:15:18.115Z

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

avi 2020-05-20T19:16:30.116Z

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.

dominicm 2020-05-20T19:16:56.116300Z

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

avi 2020-05-20T19:18:28.117100Z

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?

avi 2020-05-20T19:18:50.117700Z

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.

2020-05-20T19:24:09.118100Z

:deps/root

avi 2020-05-20T19:24:24.118300Z

Tried that already.

avi 2020-05-20T19:24:32.118800Z

Doesnā€™t work in this case, see above.

dominicm 2020-05-20T19:26:08.119900Z

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

avi 2020-05-20T19:26:28.120100Z

Yup, got it. Thanks though!

avi 2020-05-20T19:26:56.121300Z

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

alexmiller 2020-05-20T19:28:47.121700Z

I think this already does what you want

avi 2020-05-20T19:29:06.122300Z

Oh! What am I missing?

alexmiller 2020-05-20T19:29:09.122400Z

or rather let me back up...

alexmiller 2020-05-20T19:29:19.122700Z

what kind of project is the git dep?

alexmiller 2020-05-20T19:29:30.123Z

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

avi 2020-05-20T19:29:36.123200Z

project.clj

avi 2020-05-20T19:29:41.123500Z

but it has no deps

avi 2020-05-20T19:29:51.124Z

so Iā€™m specifying :deps/manifest as :deps

alexmiller 2020-05-20T19:30:01.124400Z

that should just work - what doesn't work?

avi 2020-05-20T19:30:35.124900Z

In the depā€™s dir structure, the Clojure code is inĀ `src/clj/`

alexmiller 2020-05-20T19:30:41.125100Z

ah, ok

avi 2020-05-20T19:31:02.126Z

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

alexmiller 2020-05-20T19:31:05.126200Z

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

avi 2020-05-20T19:31:10.126400Z

ah, ok

avi 2020-05-20T19:31:17.126600Z

would a ticket be helpful?

alexmiller 2020-05-20T19:31:21.126900Z

sure

avi 2020-05-20T19:31:31.127300Z

šŸ‘Œ

alexmiller 2020-05-20T19:31:45.127600Z

you coudl fork it and add a deps.edn though

avi 2020-05-20T19:32:05.127900Z

ah, good point. Maybe I will. Thanks!

alexmiller 2020-05-20T19:32:21.128200Z

or clone and do the same with a local project

avi 2020-05-20T19:32:52.128900Z

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

alexmiller 2020-05-20T19:35:50.129300Z

or that

avi 2020-05-20T19:52:36.130100Z

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

alexmiller 2020-05-20T19:54:33.131100Z

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

avi 2020-05-20T19:54:51.131500Z

yeah

avi 2020-05-20T19:54:54.131700Z

agreed!

alexmiller 2020-05-20T19:55:05.132Z

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

alexmiller 2020-05-20T19:55:49.132900Z

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)

avi 2020-05-20T19:56:07.133200Z

I can see it being a kind of support nightmare

avi 2020-05-20T19:56:28.133500Z

Iā€™m sure a million edge cases would pop up

avi 2020-05-20T19:57:49.134700Z

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?

idkfa 2020-05-20T21:45:23.134800Z

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

šŸ‘ 1