Fork me on GitHub
#tools-deps
<
2020-01-30
>
onetom10:01:37

i have some issues suddenly downloading the expectations/clojure-test dependency:

% clj -Aexpect                         
Downloading: expectation/clojure-test/1.2.1/clojure-test-1.2.1.pom from 
Downloading: expectation/clojure-test/1.2.1/clojure-test-1.2.1.jar from 
Error building classpath. Could not find artifact expectation:clojure-test:jar:1.2.1 in central ()
my project's deps.edn explicitly specify these repos:
:mvn/repos
          {"clojars"        {:url ""}
           "central"        {:url
                             ""
                             #_""}
           "" {:url ""}
           "datomic-cloud"  {:url ""}}
im not sure how to debug the situation

practicalli-johnny12:01:24

;; - see https://github.com/clojure-expectations/expectations ;; - and https://github.com/clojure-expectations/clojure-test ;; - run your expectations: clj -A:test:expect:test-runner (using cognitect test runner)

:expect
  {:extra-deps {expectations              {:mvn/version "RELEASE"}
                expectations/clojure-test {:mvn/version "RELEASE"}}}  

practicalli-johnny13:01:08

My blog has more up-to-date info about deps.edn and the Clojure CLI, I havent moved that to the book yet https://practicalli.github.io/blog/archives/ See July and August articles

practicalli-johnny13:01:54

The #tools-deps channel is also useful for deps.edn issues

practicalli-johnny13:01:41

You can also send me a direct message if you need help and cant find where to get help

borkdude10:01:24

Maybe you have a typo, expectation vs expectations?

onetom10:01:26

my ~/.clojure/deps.edn also contains one repo:

:mvn/repos {
	"datomic-cloud" {:url ""}
  }
how are this per-user and per-project :mvn/repos are getting merged?

Alex Miller (Clojure team)13:01:52

Just that - they are merged, project merged over user merged over built in

onetom10:01:16

indeed, thanks @borkdude!

onetom10:01:11

i tried to copy out the deps specification from a remote, terminal based emacs, running in an iterm2, but it has mouse support, so i could only yank it into the remote emacs' kill ring... that's why i retyped it locally... incorrectly...

onetom10:01:01

im battling with emacs for months now, slowly learning more and more about it but i still end up falling back to cursive to get things done... im really wondering if there is some easy way to get into clojure development with emacs or everyone goes through these serious birthing pains? i found https://practicalli.github.io/clojure/ recently which seems promising

borkdude10:01:08

@onetom This is a bit off topic for this channel, but feel free to continue about learning clojure in #beginners

4
borkdude10:01:39

(or #emacs, #off-topic , etc)

dharrigan14:01:07

that graph view for deps is aaaammmmaaaaazing 🙂

maleghast14:01:05

graph view..? I think that I may have missed something, but scrolling back I can't find it... 😞

dominicm15:01:15

Tools.deps.graph

dharrigan14:01:11

Thanks Alex!

kszabo15:01:30

Sadly --size doesn’t work with gitlibs based monorepo dep that uses :deps/root specified deps.edn which references a sibling monorepo folder dep via :local/root "../aws" . Quite the contrived example. Here’s the obfuscated stacktrace:

/Users/kszabo/.gitlibs/libs/monorepo/aws/8badc505955040c6a8780bfab4e0484ca4c69a45/aws is not a relative path
java.lang.IllegalArgumentException: /Users/kszabo/.gitlibs/libs/monorepo/aws/8badc505955040c6a8780bfab4e0484ca4c69a45/aws is not a relative path
	at $as_relative_path.invokeStatic(io.clj:414)
	at $file.invokeStatic(io.clj:426)
	at $file.invoke(io.clj:418)
	at clojure.tools.deps.alpha.extensions.git$eval1027$fn__1029.invoke(git.clj:43)
	at clojure.lang.MultiFn.invoke(MultiFn.java:239)
	at clojure.tools.deps.graph$get_size.invokeStatic(graph.clj:95)
	at clojure.tools.deps.graph$get_size.invoke(graph.clj:93)
	at clojure.tools.deps.graph$make_dep_node.invokeStatic(graph.clj:107)
	at clojure.tools.deps.graph$make_dep_node.invoke(graph.clj:99)
	at clojure.tools.deps.graph$make_graph$fn__1522.invoke(graph.clj:125)

Alex Miller (Clojure team)15:01:10

yeah, that came up recently, will fix on next rev

❤️ 4
Alex Miller (Clojure team)21:01:18

is now fixed in tools.deps.graph 0.2.30

🎉 4
thanks3 4
dominicm16:01:48

If I have a main that takes arguments that look like clojure's (e.g. pack) and I run like so:

clojure -A:pack -- -A:for-pack-pls
Then both the -- and the -A:for-pack-pls are passed to pack, but I'd only expect the -A:for-pack-pls to be passed.

dominicm16:01:53

Oh, looks like it's because -- is an unknown flag to the cli, so it just passes it along... It would be handy if it actually followed the -- convention itself.

dominicm16:01:48

Open to a patch?

borkdude16:01:41

I was also considering this for the irrelevant unclojure.

dominicm16:01:25

What's unclojure? 😄

borkdude16:01:56

you know, the off-topic one 🙂

Alex Miller (Clojure team)16:01:20

is that a question for me re tools.deps or for pack?

Alex Miller (Clojure team)16:01:42

sorry, I don't understand what's being requesteed

Alex Miller (Clojure team)16:01:53

what is the -- convention?

borkdude16:01:02

the arguments after -- should be passed as *command-line-args*

borkdude16:01:14

s/should/could

Alex Miller (Clojure team)16:01:23

so is this really a clojure.main request?

dominicm16:01:38

No, this is a tools.deps request. The patch would be to the clojure script

borkdude16:01:50

the only tool where I've seen this is the docker cli

borkdude16:01:56

but I bet there are many others

dominicm16:01:13

git uses it too, in case you have files starting with -

dominicm16:01:43

diff --git a/src/main/resources/clojure b/src/main/resources/clojure
index 851d1a6..c6170a3 100755
--- a/src/main/resources/clojure
+++ b/src/main/resources/clojure
@@ -55,6 +55,10 @@ do
       help=true
       shift
       ;;
+    --)
+      shift
+      break
+      ;;
     *)
       break
       ;;
Code is easier to describe, here's the change I'm proposing ^

👍 4
Alex Miller (Clojure team)16:01:36

just restating to make sure I'm getting it... clojure takes command lines of the form clojure [dep-opt*] [init-opt*] [main-opt] [arg*] and makes java command lines of the form java [java-opt*] -cp classpath clojure.main [init-opt*] [main-opt] [arg*] and the -- introduces a separator between [dep-opt*] and the rest?

dominicm16:01:25

Yes (Although I'm now going to double check that's what happens with my patch)

Alex Miller (Clojure team)16:01:06

not clear to me how that patch does that, but I get the intent now

dominicm16:01:19

*) delegates to init-opt by catching unrecognized arguments (e.g. -e) and passing them on. -- works similarly, but it does a shift before break in order to remove the -- before continuing.

Alex Miller (Clojure team)16:01:38

seems ok to me if you want to make a ticket/patch

dominicm16:01:45

haha, I have a silly way to prove that it works.

❯ echo '(println "HELLO")' > -A:kafka
❯ clojure -- -A:kafka                       
HELLO

dominicm16:01:51

Okay, sending both in now 🙂

Alex Miller (Clojure team)16:01:58

also need to handle: windows script, help text, and man file

dominicm16:01:16

Maybe a stupid question, where's the windows script? Not in brew-install?

dominicm16:01:19

I don't see it on master

Alex Miller (Clojure team)16:01:54

that is the correct branch

borkdude16:01:24

btw dominic, Powershell also works on Linux and Mac nowadays, if you want to test some snippets

Alex Miller (Clojure team)16:01:39

the change is probably pretty obvious

borkdude16:01:18

even then it's nice to test, unless you're not making obvious mistakes all the time like I do 😛

dominicm16:01:23

My distro hasn't got powershell landed yet, some bug with libressl and dotnet.

Alex Miller (Clojure team)16:01:31

the man file is in doc/clojure.1

Alex Miller (Clojure team)16:01:45

also, you should make a corresponding PR on https://github.com/clojure/clojure-site with a doc update to content/reference/deps_and_cli

Alex Miller (Clojure team)16:01:53

another test to check is that there isn't an issue with the built-in clojure.main support for - arg

Alex Miller (Clojure team)16:01:29

I think it's fine, but would be good to check it

dominicm16:01:37

There isn't a problem 🙂

dominicm16:01:07

@alexmiller Just to check, happy with "Stop parsing arguments, and pass remaining arguments to clojure.main" as the doc?

dominicm16:01:57

I've gone ahead with that string, can easily swap it out if you'd prefer something else 🙂

Alex Miller (Clojure team)17:01:51

I don't know, whatever. I'll update after I apply and look at it

dominicm17:01:35

haha, okay 🙂

jffry17:01:51

aws-vault uses this pattern (a tool for acquiring temporary credentials in AWS, and then running a command with those creds as env vars) aws-vault exec profile-name --flag-for-aws-vault -- some-command --flag-for-command

👍 4
seancorfield18:01:49

"The argument ‘--’ terminates all options; any following arguments are treated as non-option arguments, even if they begin with a hyphen." (to save folks reading it)

borkdude18:01:33

@seancorfield I looked for that on the tools.cli README earlier because of this conversation but Cmd+f on -- didn't get me anything

seancorfield19:01:54

@borkdude Yeah, the README doesn't mention it -- it just links to the GNU doc as the "spec" of the behavior.

borkdude19:01:25

Ah -- thanks 🙂