Fork me on GitHub
#tools-deps
<
2023-05-17
>
kennytilton12:05:50

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-johnny16:05:26

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

kennytilton16:05:17

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

đź‘Ť 2
dominicm12:05:21

@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 🙂

dominicm12:05:55

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

dominicm12:05:42

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”

lread14:05:11

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)15:05:29

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

Alex Miller (Clojure team)15:05:55

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

Alex Miller (Clojure team)15:05:07

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

lread15:05:54

Thanks @alexmiller, much appreciated!

lread15:05:34

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?

grzm15:05:16

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)15:05:15

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)15:05:39

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

Alex Miller (Clojure team)15:05:28

(-> (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}

Alex Miller (Clojure team)15:05:09

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

Dave Orme17:05:44

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.

borkdude17:05:51

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

Dave Orme17:05:31

Ooooh. Okay; thanks!

Dave Orme17:05:03

Follow-up question is in #C03S1KBA2

imre20:05:02

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

Alex Miller (Clojure team)20:05:14

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)21:05:35

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

imre21:05:15

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)21:05:30

happy to have a patch on that to look at

imre21:05:40

Will try to make some time for it, thanks!

imre11:05:15

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?

imre23:05:11

submitted a patch 🎉