Fork me on GitHub
#tools-deps
<
2019-06-23
>
steveb8n05:06:22

Q: I can’t get :override-deps to work with :local/root deps. e.g. I have a default :git/sha dep and then for local dev I want to override that with a :local/root dep. Has anyone else made this work?

steveb8n05:06:23

starting a separate thread to stop annoying others

seancorfield05:06:04

This sounds like it should work, but I’d have to see the relevant parts of the deps.edn file I think…

steveb8n05:06:39

my specific problem is that the the :git/sha dep is not reachable in local dev so I’m trying to override it. however, with the override, it still tries to pull the :git/sha dep and that breaks

steveb8n05:06:35

I agree. it should work. however it appears that with an :override-deps, the overridden dep must still be accessible

steveb8n05:06:21

let me see if I can make a simple test case deps.edn to demo it

seancorfield05:06:36

I tried from the command line with an alias to provide override-deps and it seems to work…

seancorfield05:06:05

Yup, deleted my ~/.gitlibs folder and the :dev alias that overrides the dep with :local/root works fine. No attempt is made to clone the git repo.

👍 4
steveb8n05:06:24

ok, here’s a repro (I think)

steveb8n05:06:35

{:deps    {reifyhealth/specmonstah {:mvn/version "2.0.0-alpha-1"}}
 :aliases {:local {:override-deps {reifyhealth/specmonstah {:git/url ""
                                                            :sha     "8e47ffc60d3177cea90f2f657e73c48971d8a1e4"}}}}}

steveb8n05:06:03

yuck formatting

steveb8n05:06:54

then clojure -R:local -Spath | tr ‘:’ ‘\n’ | sort

steveb8n05:06:28

shows the alpha version, not my fork

steveb8n05:06:57

not quite the same as what I described but I think it might show how I am using the CLI opt wrong

steveb8n05:06:56

hmm, I wonder if my version of tools.deps is too old and this is a fixed bug. I’ll check that now

seancorfield05:06:20

(! 640)-> clj -Spath | tr ':' '\n' | sort| fgrep specmon
/Users/sean/.m2/repository/reifyhealth/specmonstah/2.0.0-alpha-1/specmonstah-2.0.0-alpha-1.jar

Sat Jun 22 22:50:18
(sean)-(jobs:0)-(~/clojure/steve)
(! 641)-> clj -A:local -Spath | tr ':' '\n' | sort | fgrep specmon
/Users/sean/.gitlibs/libs/reifyhealth/specmonstah/8e47ffc60d3177cea90f2f657e73c48971d8a1e4/src

Sat Jun 22 22:50:24
(sean)-(jobs:0)-(~/clojure/steve)
(! 642)-> cat deps.edn 
{:deps    {reifyhealth/specmonstah {:mvn/version "2.0.0-alpha-1"}}
 :aliases {:local {:override-deps {reifyhealth/specmonstah {:git/url ""
                                                            :sha     "8e47ffc60d3177cea90f2f657e73c48971d8a1e4"}}}}}
works for me

seancorfield05:06:39

-R:local behaves the same, I checked.

seancorfield05:06:53

(! 644)-> clj -Sdescribe
{:version "1.10.1.447"

steveb8n05:06:01

I’m 1.9.0.391

steveb8n05:06:22

doesn’t seem likely it’s a bug but I guess I should rule that out

seancorfield05:06:01

Yeah, I think this is a bug that was fixed (ages ago).

steveb8n05:06:58

yeah. I just ran the same commands you pasted in and local does not change the result

steveb8n05:06:05

I’ll trying upgrading

steveb8n05:06:29

not sure how 😉

steveb8n05:06:39

I’ll go find the docs for upgrading

steveb8n05:06:43

mac. I think it’s “brew upgrade clojure”

steveb8n05:06:45

trying that now

seancorfield05:06:02

Yup, that’s the right command.

steveb8n05:06:10

waiting on Aussie broadband 🙂

seancorfield05:06:56

Sorry. Mine’s about 150M down and 7.5M up.

steveb8n05:06:58

mines 94m down which is really good for Aussie. I can’t complain. I suspect the latency hurts despite the good bandwidth

seancorfield05:06:30

Yah, we have global monitors for our work stuff and the latency from Asia/Australia is pretty bad.

seancorfield05:06:55

(our main data center is US East Coast and our primary AWS region is also US East Coast)

steveb8n06:06:53

ok. that fixed it in the repro case! brilliant

steveb8n06:06:00

let me check my original

steveb8n06:06:25

yep, fixed there too

🎉 4
steveb8n06:06:47

thanks for being a sounding board/tester 🙂

steveb8n06:06:53

I’ll try to pay it forward

seancorfield06:06:59

1.9 is super old. So many changes, fixes, enhancements since then!

seancorfield06:06:24

(but then I’m the guy who always runs Clojure alpha/beta builds in production! LOL!)

steveb8n06:06:29

yeah. I’m using 1.10 for my project, just not for the CLI that kicks it all off

steveb8n06:06:38

now I am 🙂

steveb8n06:06:36

have a good day/night. and thanks again for the videos, I’m gonna go watch the rest of them now

seancorfield06:06:16

G’nite! It’s 11:15pm here and definitely bedtime.

steveb8n05:06:06

btw: @seancorfield I just watched your video on deps.edn. really useful. thanks.

seancorfield05:06:54

Glad it was helpful!

seancorfield05:06:12

Can you share your deps for the git/url and local/root deps in the alias?

didibus19:06:52

Is there a way to specify jvm options but not for an alias?

didibus19:06:15

And not at the command line

didibus19:06:31

So have them specified in deps.edn for when I run main

seancorfield20:06:47

Right now they only work inside an alias @didibus — it’s a known issue/limitation. Sounds like the team may change that at some point…

didibus20:06:07

I see, thx !

andy.fingerhut21:06:13

Does anyone happen to know when you make a text file beginning with #! /usr/bin/env clojure on a Unix/Linux system, once the JVM begins and the Clojure reader starts reading the file, is the Clojure reader also given that first line to read as well?

andy.fingerhut21:06:48

Or is there some code somewhere that somehow skips over it, and thus the Clojure reader never sees it?

andy.fingerhut21:06:22

And if so, do you know where that "skipping" code is?

Alex Miller (Clojure team)21:06:07

It skips lines that start with #!

Alex Miller (Clojure team)21:06:31

Or rather, those act as single line comments

andy.fingerhut21:06:41

thx. Someone was asking how this script worked, and I think I knew all of the magic, except that part. Now my magical knowledge is complete! https://gist.github.com/ericnormand/6bb4562c4bc578ef223182e3bb1e72c5

Alex Miller (Clojure team)21:06:07

It was certainly a future looking escape in the reader :)

andy.fingerhut21:06:06

And I have a vague feeling that I have asked this and/or discovered it before, and was also then surprised that it has been around since 2009

andy.fingerhut21:06:22

Do you think it belongs in the Reading Clojure Characters guide, or better to keep it obscure? 🙂

Alex Miller (Clojure team)22:06:27

Well I don’t think it belongs there as it’s not really part of the Clojure language

Alex Miller (Clojure team)22:06:03

Really more syntax intentionally ignored by Clojure

Alex Miller (Clojure team)22:06:23

Could be on the reader page

andy.fingerhut23:06:24

I haven't followed the myriad ways people have used deps and clj/clojure, but does the approach on that page: https://gist.github.com/ericnormand/6bb4562c4bc578ef223182e3bb1e72c5 pretty much a good way to go, if you want to embed the JVM and/or clj/clojure options within the same file as the Clojure code? As in, have people found other ways to combine those options together into the same file as the Clojure code, so that those options do not end up in a separate file/script somewhere?

futuro12:06:30

I love the use of #_ to hide the shell opts from the Clojure reader.

andy.fingerhut16:06:41

It does restrict you a little bit, in that those first 16 lines must be valid shell syntax, as well as legal Clojure syntax, but yeah, I am pretty sure it is not the first language where someone has found a handful of dual-language lines of code.

futuro17:06:26

Hmm, that’s a good point.