Fork me on GitHub

Are there any plans to support data-readers in deps.edn :args data?


The use case is defining overrides for an integrant system, allowing #ig/ref. Obviously it’s also easy to put that system in a separate file, and read that, so not a big deal, and I can imagine that it’d add complexity to tools.deps. Just curious.

Alex Miller (Clojure team)12:08:32

I don’t think there’s any need for that

Alex Miller (Clojure team)12:08:47

Or do you mean for data in aliases in deps.edn?


for context #ig/ref creates a record type. I suspect Rick is trying to pass in the integrant system to run via deps.edn aliases.

Alex Miller (Clojure team)13:08:20

when you use -X the alias data is actually loaded in the context of the program you're running, so the data readers available via data_readers.clj[c] are available (but not currently being used in the edn/read, so seems like this shouldn't be too hard


Yeah it’s for data in aliases


And yeah I was thinking the same, using data_readers.clj(c) would be great for this.

Alex Miller (Clojure team)13:08:47

I will log a jira for this, seems a reasonable thing to want


@dominicm’s suspicions are right… Essentially I’m writing a script, that wants to leverage some integrant components pre-defined in libraries. I currently have the system defined in a var in my program, and it would be useful to be able to override some of the components configs via args. I could obviously just put it in a separate edn config file; but it’s another config file (sigh) for something that’s intended to be pretty minimal.


It would be fab if tools.deps could do this… it’d make configuring and overriding bits of integrant systems much nicer.


Though I warn you, it’ll be a slippery slope, I’ll probably next want data aliases and command line args to be meta-merged 😆

Alex Miller (Clojure team)13:08:28

what does "meta-merged" mean?


Well I was just joking about supporting meta-merge 🙂 But I meant: which is very useful for doing deep merges of data. We tend to structure our integrant systems into profiles that get applied and meta-merged in a certain order.


So in a tools.deps meta-merge context you could have data aliases for each of those profiles, and meta-merge them all together in the specified order, with -Sdeps and command line args on top etc. I was only joking though assoc-in makes more sense for tools.deps.

Alex Miller (Clojure team)14:08:30

well, that's there for -X with an :args map and pathed data on the command line

Alex Miller (Clojure team)14:08:32

I'm not going to use meta-merge on deps data, but your program can combine data from multiple aliases that you load in any way you want

Alex Miller (Clojure team)14:08:42

by loading it via the runtime basis


:thumbsup: Ahh yes that’s true — I’d forgotten I could do that.


I think that would work quite nicely actually :thinking_face:


I already have it slurped in my REPL 😁

Alex Miller (Clojure team)14:08:13

I guess that code could use data readers too :)


Yeah was just going to ask about that

Alex Miller (Clojure team)14:08:02

edn/read-string takes an optional opts map where you can pass :readers

👍 3
Alex Miller (Clojure team)14:08:17

(def basis (edn/read-string {:readers *data-readers*} (-> (System/getProperty "clojure.basis") jio/file slurp)))


yeah that would work nicely with TDEPS-163

Alex Miller (Clojure team)14:08:46

there are other places that edn/read-string that you don't control, so those should do this too

Alex Miller (Clojure team)14:08:00

inside tools.deps (deps reader) and the exec stub (command line)


Yeah I can’t do anything without TDEPS-163 also supporting the readers properly

Alex Miller (Clojure team)14:08:09

I probably won't get to it today, but it shouldn't be a big deal


No rush, but it’ll be great to see this


Other use cases for us are that we like to represent URIs as data, not strings… and we have quite a lot of URIs in config data.

Alex Miller (Clojure team)13:08:18

I'm guessing you mean deps.edn and -Sdeps alias data merged?

Alex Miller (Clojure team)13:08:51

those will be merged now, but perhaps not in the way you want :)