Fork me on GitHub
#tools-deps
<
2018-09-14
>
niclasnilsson15:09:31

Using deps.edn, when developing an app with some libs locally, what’s the intended way when App -> LibA and LibA -> LibB. Is there a way to do this without tainting App’s deps.edn with App’s dependencies dependencies (where all are local)?

dominicm15:09:14

@niclasnilsson :local/root I think?

mpenet15:09:21

you can have a profile with local dependencies

mpenet15:09:26

I mean an alias

niclasnilsson15:09:47

@dominicm Only seems to work in one “layer”, not picking things up recursively

niclasnilsson15:09:21

@mpenet, yep, that’s what I’d like to avoid. It’s just boring.

mpenet15:09:23

well you can add exclusions and explicit deps to other local deps

mpenet15:09:39

but yeah, it requires some work

dominicm15:09:55

@niclasnilsson I see, you mean when all 3 are local. Transitive aliases don't work, I don't think there's anyway to configure libraries to load in transitive local mode.

niclasnilsson15:09:55

And (I think) even when LibA is local and LibB is on github for instance, App doesn’t seem to pick it up. (Unless I did something wrong)

richiardiandrea16:09:47

The local dep issues are quickly becoming a problem for our Cursive users - we spend a lot of time clicking on the error dialogs popping up - we tried adding :manifest :deps but the the use from the command line broke for some reason. I might invest some time digging into it...

cfleming16:09:48

@richiardiandrea I think you want :deps/manifest :deps

richiardiandrea16:09:34

Ah yep I think with put that sorry 😃 will come up with a repro first then we'll see

Alex Miller (Clojure team)17:09:45

@niclasnilsson don’t forget that you can put aliases in ~/.clojure/deps.edn too and then combine them with stuff in your project. so if you had a bunch of local dep overrides, you could declare them there (without touching your project deps.edn)

👍 4
jcf23:09:28

Something that just occurred to me. Languages like Ruby and Perl that have spent a lot more time optimising their CLIs have relatively succinct (but also somewhat cryptic) APIs for interactic with text. Consider the following examples, first in Ruby and the an approximation using clj:

$ echo 4 | ruby -pne '$_.to_i + 1'
4
$ echo 4 | clj -e '(inc (Long/parseLong (first (line-seq (java.io.BufferedReader. *in*)))))'
5
I'd argue that $_ is hard to remember and Google, but if you want to apply an operation to each line in some input the Ruby syntax is quite convenient (assuming you can remember it). Are there plans on adding similar switches to the new clj executable to support process *in* with a bit less ceremony?

Alex Miller (Clojure team)23:09:55

just append - at the end

jcf23:09:31

Hi @alexmiller! How would I change echo 4 | clj -e '(inc (Long/parseLong (first (line-seq (java.io.BufferedReader. *in*)))))' to make use of -? Sorry for being dumb but it's not immediately obvious to me.

jcf23:09:50

I have used - with other programs before, but not with clj.

jcf23:09:58

main-opts
       -m, --main ns-name
              Call the -main function from namespace w/args
       -r, --repl
              Run a repl
       path   Run a script from a file or resource located at path
       -      Run a script from standard input

jcf23:09:35

I've found - in the man page for clj.

jcf23:09:04

For context I'm thinking I want to make it easier doing something like curl | jq '.users' | clj -e '...' so I can combine Clojure with other tools I have on the command-line.

jcf23:09:52

I can of course do everything from Clojure, but just wondering if there's thought going into the API for passing in data to a new Clojure process.