tools-deps

kennytilton 2023-05-17T12:15:50.989879Z

The Google offers two solutions for deploying a deps.edn based project to Clojars, https://github.com/slipset/deps-deploy and https://github.com/applied-science/deps-library#usage. Are there any others? Is one or another preferred?

practicalli-johnny 2023-05-17T16:02:26.470839Z

Personally I'd prefer https://github.com/slipset/deps-deploy as I've seen it used by others and the maintainer seems active (and a nice person in my interactions with them), but I havent pushed anything (useful) to clojars myself. deps-deploy also supports signing (which may now be required - it should certainly be encourage). I didnt see a mention of signing on deps-library

kennytilton 2023-05-17T16:10:17.858929Z

Thx! The deps-deploy looked pretty accessible, and I am already doing the signing with Clojars so that should go smoothly. 🙏

👍 1
dominicm 2023-05-17T12:46:21.927409Z

@alexmiller RE https://clojure.atlassian.net/browse/TDEPS-229 I wrote https://git.sr.ht/~severeoverfl0w/clj-classpath-duplicates to do that already. It uses https://github.com/classgraph/classgraph to scan the classpath, only for fun/speed/convenience reasons, not because of necessity. I’m not sure I can be of any help, but happy to be if I can 🙂

dominicm 2023-05-17T12:48:55.676309Z

It was convenience: ClassGraph has a “findDuplicatePaths” method.

dominicm 2023-05-17T12:47:42.791269Z

Something that was very helpful in practice was including the digest. It allowed distinguishing “this is managed because I’ve got the versions lined up” vs “this is definitely different”

lread 2023-05-17T14:23:11.518079Z

Hello! I'm doing a little work on https://github.com/benedekfazekas/mranderson to more directly support deps.edn projects. For lein projects, MrAnderson supports marking deps specified in project.clj for inlining via metadata. An example:

:dependencies [^:inline-dep [rewrite-clj "1.1.47"]]
We are hashing out our options for deps.edn deps. I was thinking of using metadata like antq does (https://github.com/cljdoc/cljdoc/blob/08be85ad4074a54114d97d3423a597a9e21e5771/deps.edn#L13-L18), maybe something like so (1):
{:deps {^:mranderson/inline-dep rewrite-clj/rewrite-clj {:mvn/version "1.1.47"}}} 
Or like so (2):
{:deps {rewrite-clj/rewrite-clj ^:mranderson/inline-dep {:mvn/version "1.1.47"}}} 
But another option was proposed (3):
{:deps {rewrite-clj/rewrite-clj {:mvn/version "1.1.47"
                                 :mranderson/inline true}}} 
I'm guessing that the metadata approaches (1 and 2) might be less problematic to naive tooling because metadata would not be seen unless explicitly queried. But is there anything technically problematic with the non-metadata approach (3)? Does (3) seem maybe a bit more human-readable-friendly?

Alex Miller (Clojure team) 2023-05-17T15:00:29.196389Z

I'm going to promise you nothing on whether that metadata gets transferred through any tdeps/cli machinery

Alex Miller (Clojure team) 2023-05-17T15:00:55.320129Z

please also consider a separate map of data in :aliases and/or a separate file

Alex Miller (Clojure team) 2023-05-17T15:02:07.744809Z

aliases data can be easily read from the basis and is arbitrary data that you completely control

lread 2023-05-17T15:04:54.746979Z

Thanks @alexmiller, much appreciated!

lread 2023-05-17T15:09:34.866779Z

So the approach taken by antq (https://github.com/cljdoc/cljdoc/blob/08be85ad4074a54114d97d3423a597a9e21e5771/deps.edn#L13-L18) is probably something that you'd discourage, ya?

Alex Miller (Clojure team) 2023-05-17T15:17:39.027809Z

yes

👍 1
grzm 2023-05-17T15:04:16.972419Z

Good (java.time.Instant/now)! I’d like to create a classpath that just includes only paths in my project. clj -Spath -A:my-alias returns the full classpath: project paths, and paths to all of the deps as well. Right now I’ve been string-processing the full class-path, removing anything that’s an absolute path. Anyone have a better/another approach to recommend? (Now I’m kicking myself for not confirming whether inspecting the basis won’t provide something useful before asking the channel)

Alex Miller (Clojure team) 2023-05-17T15:09:15.188969Z

the basis has a map of :classpath parts, which have a value map telling you what it is and where it came from

Alex Miller (Clojure team) 2023-05-17T15:09:39.605169Z

so it would be quite easy to filter just the paths from the libs

Alex Miller (Clojure team) 2023-05-17T15:16:28.788409Z

(-> (td/create-basis {}) :classpath (get "src/main/clojure"))
;;=> {:path-key :paths}

(-> (td/create-basis {}) :classpath (get "/Users/alex.miller/.m2/repository/org/clojure/clojure/1.10.3/clojure-1.10.3.jar"))
;;=> {:lib-name org.clojure/clojure}

grzm 2023-05-17T15:16:55.387939Z

Thanks, @alexmiller!

Alex Miller (Clojure team) 2023-05-17T15:17:09.785969Z

the ordering of the classpath keys is in the basis under :classpath-roots

Dave Orme 2023-05-17T17:37:44.383749Z

Hi everyone! I'm wondering: does anyone know the official status of add-lib in the add-lib3 branch? Are there plans to develop it more / integrate it? Other threads have mentioned that it seems to have fallen out of sync with master though I confess I haven't tried a merge myself. I'm wondering if it would be supported if I did it? ### Background: I've been playing with ideas to create a Smalltalkish dynamic runtime for Clojure/script, and would like to use tools-deps for dynamically adding libraries, assuming this would be the appropriate way to do it. I have my own library (based on the technique Boot uses) but if there's going to be an officially-supported method, I would prefer to use that. Thoughts, ideas, and feedback are welcomed.

borkdude 2023-05-17T17:38:51.761229Z

@david586 Check out the clojure 1.12 alpha3 release notes, dude :)

Dave Orme 2023-05-17T17:39:31.249479Z

Ooooh. Okay; thanks!

Dave Orme 2023-05-17T17:53:03.190549Z

Follow-up question is in #clojure

imre 2023-05-17T20:52:02.451219Z

Is there a way to make the clojure cli (installed via brew) use a locally modified version of tools.deps? I'm planning to muck about with tools.deps a bit and would like to do some poking through the cli first

imre 2023-05-18T11:47:15.893009Z

btw, would it make sense to add a more graceful override for tools_cp for these kinds of thing? like an env var one could set?

imre 2023-05-18T23:10:11.378529Z

submitted a patch 🎉

Alex Miller (Clojure team) 2023-05-17T20:58:14.036569Z

you can identify the script via which clojure, then edit the tools_cp variable to include a pointer to a local source dir in the front of the classpath (like /path/to/your/tools.deps/src/main/clojure). the big caveat is that the tools jar is direct linked, so it is possible to walk into some weirdness, but I do test things this way and it usually works ok

Alex Miller (Clojure team) 2023-05-17T21:00:35.387869Z

also, depending on what you're hacking, you might need more active use of -Sforce to force recomputation of classpaths

imre 2023-05-17T21:06:15.748879Z

Thanks. I just want to do a bit of inspection to see if I could have a reasonable chance to add deps/root support to local/root. Should only be changes to clj files in tools.deps

Alex Miller (Clojure team) 2023-05-17T21:07:25.751979Z

go for it!

Alex Miller (Clojure team) 2023-05-17T21:07:30.872049Z

happy to have a patch on that to look at

imre 2023-05-17T21:08:40.611249Z

Will try to make some time for it, thanks!