Fork me on GitHub
#tools-deps
<
2020-07-28
>
Oliver George03:07:09

I'm curious how RELEASE resolves in this maven dep...

{:extra-deps {clj-kondo {:mvn/version "RELEASE"}}
   :main-opts  ["-m" "clj-kondo.main"]}
Perhaps it's a normal maven feature. Hard to google for "release"!

Alex Miller (Clojure team)03:07:56

RELEASE (and LATEST) are special "virtual" version numbers that tell Maven to look for the newest released version (non snapshot)

Alex Miller (Clojure team)03:07:30

they are officially unsupported by clj (but do kind of work with some big caveats)

Alex Miller (Clojure team)03:07:08

big caveat #1 - they break caching and you will never see a new release after the one that it first resolves to unless you -Sforce (or otherwise cause a cache recompute)

Alex Miller (Clojure team)03:07:50

at some point, we may actually prevent caching at all if you use these "versions"

Alex Miller (Clojure team)03:07:42

subtle caveat #2 - the answer you get is only as good as the metadata index in the repository. for maven or clojars, no worries. if you're using a bespoke s3 repo, then you probably aren't updating the right metadata files and you usually won't see the newest version

Alex Miller (Clojure team)03:07:04

generally, I think it's harmless to do this in -Sdeps to grab "latest". it's mildly bad to do it for tools in your deps.edn aliases (like the example here). it's very bad to do it for your project deps.

deactivateduser05:07:53

Does there happen to be an equivalent for git/sha coordinates? That could be quite handy…

Alex Miller (Clojure team)06:07:35

Intentionally not, for the same reasons re caching

deactivateduser06:07:59

I guess I don’t understand the caching issue. If you resolve “RELEASE” to a concrete version, and that version happens to exist in the cache already, wouldn’t tools.deps use it?

deactivateduser06:07:28

(and conversely, if it doesn’t, wouldn’t that version be added to the cache, and thereby eligible for future “cache hits”)

Alex Miller (Clojure team)06:07:15

The caching is based on time stamps of deps,edn files. If the file never changes (set to RELEASE), the class path is never recomputed, even if newer versions come out

Alex Miller (Clojure team)06:07:57

Caching of classpath (not lib version)

deactivateduser06:07:24

Ah ok. I assume there’s a good reason for making the deps.edn file the cache key, rather than just recomputing dependencies the classpath every time and having those in the cache?

Alex Miller (Clojure team)06:07:17

Recomputing deps starts a second JVM so it’s at least a second, usually more depending on io

Alex Miller (Clojure team)06:07:53

This is why clj starts faster than lein usually

Alex Miller (Clojure team)06:07:15

It also goes to build repeatability

Alex Miller (Clojure team)06:07:29

Or “clj repeatability”

deactivateduser06:07:04

Ok. I’ll assume there’s a good reason for needing a second JVM to do that (not requesting an explanation, btw, unless you’d like to provide one), and understood full well the performance implications of starting a JVM.

Alex Miller (Clojure team)06:07:24

it's running a Clojure program with a different classpath the program you're executing

Alex Miller (Clojure team)06:07:23

specifically, it's running tools.deps to compute the classpath based on your deps.edn (talking to Maven, maybe S3, maybe Git, etc). in the end it spits out the results in cache. Your actual program is then started with the classpath you intended. Once we've cached that work, we can spit the first part and just run the program.

deactivateduser06:07:28

So the advantage of caching based on the deps.edn file, rather than the classpath it contains, is all the I/O to talk to Maven, S3, git, etc.?

Alex Miller (Clojure team)07:07:04

well, that's all of the work. not much point to caching otherwise

Alex Miller (Clojure team)07:07:21

expanding and downloading a full deps tree can easily mean dozens of jars and many megabytes of network traffic (if your m2 and/or git cache is cold)

Alex Miller (Clojure team)07:07:04

even if you have all the jars, expanding the tree is more than you'd want to wait, example in tools.deps.alpha repo (~80 jars in the full tree), all jars in cache so no downloads:

Alex Miller (Clojure team)07:07:22

amac:tools.deps.alpha alex$ time clj -Sforce -e nil

real	0m3.028s
user	0m12.567s
sys	0m0.756s
amac:tools.deps.alpha alex$ time clj -e nil

real	0m0.745s
user	0m1.647s
sys	0m0.133s

Alex Miller (Clojure team)07:07:39

(one caveat here is that the clj uber jar is not currently aot compiled - that's coming soon and will improve that first time, which includes a lot of loading)

Alex Miller (Clojure team)07:07:22

but it's still not time anyone wants to wait

Alex Miller (Clojure team)07:07:51

with a cold m2 cache, time is about 7.5 s (aot may knock a couple seconds off that)

deactivateduser15:07:22

I can see why that approach will be faster, though it breaks down (cache becomes stale) in the presence of dependencies that are expressed using a “floating” version reference (RELEASE, LATEST, SNAPSHOT, etc.). Those were deprecated in Maven3, and perhaps tools.deps should follow suit and emit a warning when it encounters such a thing?

seancorfield05:07:33

@deactivateduser10790 My dot-clojure deps.edn shows how you can resolve the head of the default branch -- in the comments.

seancorfield05:07:00

And then (load-master 'clojure/tools.trace)

seancorfield05:07:36

(following the http://github.com URL pattern, not the org.clojure/tools.trace Maven artifact pattern)

deactivateduser05:07:29

Potentially dumb question, but is it expected that code inside an EDN file would be executed? Or does that rely on a coincidence of how the Clojure EDN reader functions?

seancorfield05:07:23

@deactivateduser10790 Can you give a specific example?

seancorfield05:07:01

I mean, EDN can contain tagged literals and you can provide reader functions that process those... but that's not exactly "code inside an EDN file".

Alex Miller (Clojure team)05:07:57

edn files are data, not code, and are not evaluated

Alex Miller (Clojure team)06:07:33

They are read but that will only construct tagged literals, and clj does not provide a way to install readers for tagged literals

deactivateduser06:07:04

@seancorfield your example includes code (`(require '[clojure.tools.gitlib :as gitlabs]) …`) - how is that code evaluated?

seancorfield06:07:40

Those are comments showing what you would execute in your REPL...

seancorfield06:07:03

The files contains lots of comments explaining how to use the aliases, with links to repos.

deactivateduser06:07:30

Oh ok. So I would not put those in a deps.edn then.

seancorfield06:07:52

Huh? Those are comments and they are in a deps.edn file.

deactivateduser06:07:16

Yes they are, and as a result I would expect to uncomment them and have them Just Work:tm: .

seancorfield06:07:23

I mean, that repo literally is my ~/.clojure/deps.edn file.

deactivateduser06:07:36

But if I’m following you, you’re saying that’s not correct - that those lines need to be copypasta’ed into a REPL.

seancorfield06:07:03

Forgive me but I'm a bit shocked you would think code in EDN files would be evaluated...

deactivateduser06:07:14

I didn’t - that’s why I asked the question.

deactivateduser06:07:48

I was quite surprised to see commented out code in an EDN file.

deactivateduser06:07:26

(and by “quite”, I mean “very”…)

deactivateduser06:07:37

Regardless, @alexmiller separately explained that by design you can’t do an equivalent of RELEASE for git/sha coords in a deps.edn file.

seancorfield06:07:40

https://github.com/practicalli/clojure-deps-edn/blob/master/deps.edn contains comments with lots of shell commands, and even some elisp -- you wouldn't expect any of that to be executed just by reading the EDN file, would you?

deactivateduser06:07:34

Why would you assume I’ve read some random deps.edn file? Sadly I don’t have that much disposable time…

seancorfield06:07:03

Well, you read my file and came to a ... strange conclusion ... so I offered another example deps.edn and wondered what conclusion you would come to from that...

deactivateduser06:07:17

If you re-read my original question (https://clojurians.slack.com/archives/C6QH853H8/p1595913713054800), you might see why I was assuming a deps.edn-only solution, and therefore didn’t understand your non-`deps.edn` answer.

deactivateduser06:07:58

In general, answering questions people didn’t ask is a wonderful source of confusion. 😉

seancorfield06:07:36

With the Clojure CLI/`deps.edn` the "equivalent" to Maven/Leiningen/etc is often "some code that you run" -- which seemed like an acceptable answer to your question.

seancorfield06:07:31

That's why I was so puzzled by your follow-up question, as it seemed unrelated to my answer (I was thinking "No, of course reading EDN won't execute code!").

seancorfield06:07:37

I guess I should add "Here's some code you can run in your REPL" to my deps.edn file where there are code examples 🙂

☝️ 3
deactivateduser06:07:04

That would have avoided any confusion, no doubt. 😉

seancorfield06:07:20

It is sometimes so hard to predict your audience's state of mind 😆 (when writing documentation, I should add).

☝️ 3
deactivateduser06:07:40

Professional technical writing is such an under-appreciated skill, I’ve found.

spf07:07:31

Hey guys. If i have a setup as described in https://clojure.org/guides/deps_and_cli#_using_local_libraries. is there a way to fire up a repl in the hello project which reloads the time-lib deps if they are changed?

Alex Miller (Clojure team)07:07:14

no, that's not a built-in feature of Clojure (or Java). there are ways to do some variants of this but it's not common

Alex Miller (Clojure team)07:07:28

well, do you mean local dir or local jar?

Alex Miller (Clojure team)07:07:02

if local dir, you can just use Clojure's normal :reload or :reload-all mechanism built into require

spf07:07:24

i meant local dir

Alex Miller (Clojure team)07:07:37

yeah, so that's just normal reloading

spf07:07:45

ok. cool. thx

rickmoynihan13:07:18

any idea why running brew upgrade clojure/tools/clojure installs 1.10.1.561 not 1.10.1.590 ?

Alex Miller (Clojure team)13:07:48

561 is the newest stable release

Alex Miller (Clojure team)13:07:58

590 is a dev release

👍 3
seancorfield16:07:48

Following up from my comment in the announce thread:

{:paths [:clj-paths :resource-paths]
 :aliases
 {:clj-paths ["src/clj" "src/cljc"]
  :resource-paths ["resources"]}}
Is that correct, or should :clj-paths and :resource-paths be underneath an alias?

seancorfield16:07:24

If that is correct, I don't see the value since they are fixed labels and values -- am I missing something @alexmiller?

Alex Miller (Clojure team)16:07:28

oh, that is right - they are aliases

Alex Miller (Clojure team)16:07:40

an alias is just a name for some data

Alex Miller (Clojure team)16:07:37

this was the original meaning here but we have kind of gotten off talking about things that way by tying it into clj's usage of alias data to affect classpath construction

seancorfield16:07:11

OK, so how is that useful since they are just fixed values?

Alex Miller (Clojure team)16:07:20

at the moment, it's not very useful

seancorfield16:07:33

Also, you have this paragraph twice "Replace project environment ("tool")" -- one with plenty of detail, one with very little.

Alex Miller (Clojure team)16:07:01

that's actually intentional - the first part is kind of an overview, and the second is more how the tool works with more detail

Alex Miller (Clojure team)16:07:35

doing a lot of heavy editing on this page lately but will likely change more over time

seancorfield16:07:13

OK, I think it's just really confusing at the moment with two identical headers...

Alex Miller (Clojure team)16:07:38

I'm ok with that for the moment :)

Alex Miller (Clojure team)16:07:55

the toc at the top side bar may make the structure more evident

Alex Miller (Clojure team)16:07:25

I've gone through about 5 different structures for this page recently, and I don't think I'm done

😆 3
seancorfield16:07:40

On another wordsmithing issue: now that page refers to "tool" as something that might want to override :deps and/or :paths, this section name might be confusing (a different meaning of tools) https://clojure.org/reference/deps_and_cli#_clojure_tools_usage

Alex Miller (Clojure team)16:07:05

yeah, I've been fighting that, haven't decided what to do about it yet

Alex Miller (Clojure team)16:07:40

it's like naming things is hard

seancorfield16:07:10

Tools are just so useful 🙂

Alex Miller (Clojure team)16:07:36

but if you had say, a build tool that wanted to also use a subset of paths it might be useful

seancorfield16:07:37

The Maven install example is missing an alias tho' (even if the paths one isn't), yes?

{:aliases
 {:fn clojure.tools.deps.alpha.install/install
  ;; :args map could be provided but can pass on command line instead
  }}

seancorfield16:07:28

That's meant to be executed with -X:some-alias (most people will pick -X:install I suspect)

Alex Miller (Clojure team)16:07:53

I actually saw that late last night and forgot to fix

seancorfield16:07:39

I'm curious as to why that ability surfaced as a built-in option, given that JAR files can already be used as :local/root deps?

Alex Miller (Clojure team)16:07:24

it's not a built-in option, it's a built-in program

Alex Miller (Clojure team)16:07:01

didn't seem big enough to make into its own thing, depended heavily on all the code in tools.deps, wanted it for dev-local, etc

seancorfield16:07:16

Interesting...

Alex Miller (Clojure team)16:07:23

serves as a good example :)

Alex Miller (Clojure team)16:07:59

the plan is to shift some of the magic switches in clj over to just be programs you can -X

Alex Miller (Clojure team)16:07:33

some of those might become built-in to the root deps.edn, not sure yet

seancorfield16:07:02

The install line you gave in the announcement doesn't seem to work

Error: No available formula with the name "clojure/tools/[email protected]" 
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.

seancorfield16:07:23

That's from brew install clojure/tools/[email protected]

seancorfield16:07:31

(after a brew uninstall clojure)

seancorfield16:07:16

Should be 1.10.1.590

rickmoynihan16:07:37

wow need to get my head around these new tools.deps features; they might make some stuff I’ve been planning to do completely redundant :thinking_face:

rickmoynihan16:07:11

how is the -T alias different to having an alias with a :deps key?

seancorfield16:07:57

I need to figure out how to get the clojure script updated on a couple of our older servers since this would help eliminate some of the extra script stuff we've written (but I think there's a blocker for installing clojure on a couple of our old servers).

Alex Miller (Clojure team)16:07:13

It is exactly what was already there via -A, just has its own switch now

rickmoynihan17:07:38

ok so it just makes the intent clearer on the command line?

Alex Miller (Clojure team)17:07:51

A is meant to be an “all” kind of thing but this didn’t have its own name, so now it does

rickmoynihan17:07:48

so what would -T do with :extra-deps instead of :deps?

Alex Miller (Clojure team)17:07:02

(Which also helped further clarify some things in the code which has gone through some substantial changes)

Alex Miller (Clojure team)17:07:12

It would be ignored

👍 3
rickmoynihan17:07:08

wow I had no idea how many deps had unqualified names. I thought it was just a handful, but it’s way more than I expected

☝️ 3
Alex Miller (Clojure team)17:07:20

Each of the sub processes takes what it expects and ignores the rest, like all good Clojure programs :)

👍 3
seancorfield17:07:34

Should this check include tools_aliases now?

-h|--help|"-?")
      if [[ ${#main_aliases[@]} -gt 0 ]] || [[ ${#all_aliases[@]} -gt 0 ]]; then
        break
      else
        help=true
        shift
      fi
      ;;

seancorfield17:07:55

Maybe I'm just missing the actual flow of the script then, nm.

Alex Miller (Clojure team)17:07:30

Yeah this has to do with falsely interpreting a -h appended to main aliases as a help opt

seancorfield17:07:30

(I was just grepping for (tool|all).alias through the new script out of curiosity)

Alex Miller (Clojure team)17:07:52

Would be curious if you try the win install :)

seancorfield17:07:01

@alexmiller re: -h -- that means that clojure -A:test:runner -h and clojure -T:test:runner -h behave differently.

seancorfield17:07:10

(! 1537)-> clojure -T:test:runner -h|more
Version: 1.10.1.590

...
(! 1538)-> clojure -A:test:runner -h|more
Unknown option: "-h"
Wasn't sure whether that was intentional or not since you said -T and -A were "the same"?

seancorfield17:07:38

(the first case displays help -- -h is not passed to the main program; the second case passes -h to the main program in the test runner here)

Alex Miller (Clojure team)17:07:39

this is kind of a corner case - the condition is guarding against having -A/-M supplying the first part of the main args and then -h on the command line where it is not actually the main args to pass to clojure.main. I'm not worried about it.

seancorfield17:07:24

Fair enough. Just wanted to point out that it is a difference between -A and -T 🙂

Alex Miller (Clojure team)17:07:25

there's no difference in how :deps and :paths work, which is what I meant

rickmoynihan17:07:26

Just tried doing -X:myfn in one of my projects and I get the error:

rickmoynihan17:07:28

clojure -X:myfn
Execution error (FileNotFoundException) at clojure.main/main (main.java:40).
Could not locate clojure/tools/deps/alpha/exec__init.class, clojure/tools/deps/alpha/exec.clj or clojure/tools/deps/alpha/exec.cljc on classpath.

Alex Miller (Clojure team)17:07:45

are you on clj 1.10.1.590?

rickmoynihan17:07:16

I thought I was

rickmoynihan17:07:44

$ clojure --help
Version: 1.10.1.590

...

seancorfield17:07:50

I get that too, also on 1.10.1.590:

(! 974)-> clj -Sdescribe
{:version "1.10.1.590"
 :config-files ["/usr/local/Cellar/[email protected]/1.10.1.590/deps.edn" "/Users/sean/.clojure/deps.edn" "deps.edn" ]
 :config-user "/Users/sean/.clojure/deps.edn"
 :config-project "deps.edn"
 :install-dir "/usr/local/Cellar/[email protected]/1.10.1.590"
...
(! 975)-> clj -X:example
Execution error (FileNotFoundException) at clojure.main/main (main.java:40).
Could not locate clojure/tools/deps/alpha/exec__init.class, clojure/tools/deps/alpha/exec.clj or clojure/tools/deps/alpha/exec.cljc on classpath.

Full report at:
/var/folders/p1/30gnjddx6p193frh670pl8nh0000gn/T/clojure-13599808261801984368.edn
(! 976)-> cat deps.edn 
{:aliases
 {:example
  {:fn clojure.core/println
   :args {:n 1}}}}
(! 977)-> 

Alex Miller (Clojure team)17:07:52

if you clj -Sdescribe and then jar tf <the-install-dir/clojure-tools-1.10.1.590.jar | grep exec.clj

Alex Miller (Clojure team)17:07:32

what installer are you using?

rickmoynihan17:07:51

the jar is further down than that in /usr/local/Cellar/[email protected]/1.10.1.590/libexec/clojure-tools-1.10.1.590.jar

Alex Miller (Clojure team)17:07:09

sorry, bad multi copy/paste on my part, that's right

rickmoynihan17:07:16

exec.clj is in there yes

rickmoynihan17:07:34

$ jar tf /usr/local/Cellar/[email protected]/1.10.1.590/libexec/clojure-tools-1.10.1.590.jar  | grep exec.clj
clojure/tools/deps/alpha/exec.clj

seancorfield17:07:58

(yup, same here)

rickmoynihan17:07:59

brew was the installer

Alex Miller (Clojure team)17:07:25

clj -Sdeps '{:aliases {:myfn {:fn clojure.core/pr}}}' -X:myfn is a standalone example

rickmoynihan17:07:17

ah wait sorry was in a project with a broken edn file

seancorfield17:07:23

(! 982)-> clj -Sdeps '{:aliases {:myfn {:fn clojure.core/pr}}}' -X:myfn
Execution error (FileNotFoundException) at clojure.main/main (main.java:40).
Could not locate clojure/tools/deps/alpha/exec__init.class, clojure/tools/deps/alpha/exec.clj or clojure/tools/deps/alpha/exec.cljc on classpath.

Full report at:
/var/folders/p1/30gnjddx6p193frh670pl8nh0000gn/T/clojure-12219293780956477884.edn

Alex Miller (Clojure team)17:07:36

ah, I was able to repro

rickmoynihan17:07:41

$ clj -Sdeps '{:aliases {:myfn {:fn clojure.core/pr}}}' -X:myfn
Execution error (FileNotFoundException) at clojure.main/main (main.java:40).
Could not locate clojure/tools/deps/alpha/exec__init.class, clojure/tools/deps/alpha/exec.clj or clojure/tools/deps/alpha/exec.cljc on classpath.

Full report at:
/var/folders/ln/536xqskd3_g80n5pdbsjkrjw0000gn/T/clojure-8308868078358895829.edn

Alex Miller (Clojure team)17:07:54

it matters whether you're in a directory with a deps.edn

Alex Miller (Clojure team)17:07:17

well, that's definitely a bug :)

seancorfield17:07:38

Crashes for me whether there's a deps.edn file or not.

Alex Miller (Clojure team)17:07:57

hm, maybe it's a cached classpath for me or something

rickmoynihan17:07:20

there are 3 hard things in computer science…

🙈 3
🙉 3
🙊 3
seancorfield17:07:52

I tried it via an alias in a deps.edn file (shown above), then tried via the command line with just {} in deps.edn, and then tried in a directory with no deps.edn -- all of them crash the same way. Even tried -Sforce and it still failed.

rickmoynihan17:07:35

I tried two of those; just tried with -Sforce too — and same

Alex Miller (Clojure team)17:07:46

well, that's weird. :) I've been using this for a while and others have tested it as well, somehow never saw an error

Alex Miller (Clojure team)17:07:13

I'm sure it will make sense when I understand why it's doing it ... this is why it's a dev release!

Alex Miller (Clojure team)17:07:45

-X has to go at the end, in case that affects anything you tried

rickmoynihan17:07:16

nope, I had -X as my only alias

rickmoynihan17:07:38

Well I’d be happy to try and help narrow debug it but I’m afraid I need to call it an evening 😞 I’ll check back here tomorrow. Thanks for your help, and also thanks for the feature… it looks like it’ll be really useful.

Alex Miller (Clojure team)17:07:56

ah, this makes sense to me now, and why it worked for me

Alex Miller (Clojure team)17:07:29

and why things others tried worked. such a combination of coincidences... anyhow will fix

seancorfield17:07:47

Now I'm curious, what's the bug?

Alex Miller (Clojure team)17:07:23

it's not putting that class on the classpath, obviously :)

Alex Miller (Clojure team)17:07:32

I was testing in the tools.deps.alpha repository itself

Alex Miller (Clojure team)17:07:01

and others were testing things that used the install program, which requires you to pull in tools.deps.alpha

Alex Miller (Clojure team)17:07:27

I may actually have flubbed a merge somewhere

Alex Miller (Clojure team)19:07:31

@seancorfield @rickmoynihan ok, new clj 1.10.1.596 is available, should fix this

👍 3
rickmoynihan22:07:58

works now! Thanks 🙂

seancorfield19:07:37

Looks fixed! Thank you!

Alex Miller (Clojure team)19:07:47

if you try it on windows (or linux), would be happy to hear there too

seancorfield19:07:49

@vlaaad If you want to get strings from the command line in your -X-executed function, you can always use *command-line-arg* (although you'd have to discard leading arguments passed to the CLI itself I guess)

seancorfield19:07:37

(! 1010)-> clj -A:test -X:example :test value
("-X:example" ":test" "value") ({:test value})
Looks like you'd only have to skip over the first arg?

vlaaad19:07:50

I don't want to make every arg a string 🙂

seancorfield19:07:21

How would you want the CLI to distinguish between "I want this as a string" vs "I want this as an EDN value"?

seancorfield19:07:09

It seems like you'd have to try to read as EDN and if you got an error or a symbol then use the whole argument as a string, else whatever the EDN reader produced? Which is open to all sorts of surprises I would expect...?

vlaaad19:07:12

I guess it's impossible to have it both simple and easy 😞

vlaaad19:07:34

I don't want to deal with escaping because I use both powershell and bash that have different escaping rules. With those, whenever I have a need to escape I wish I just used a file. This might be a bit too limiting for convenience, but I'd be fine with this: everything that can be read as number/boolean/keyword/nil -> number/boolean/keyword/nil everything else, including things that can be read as collections -> string

vlaaad19:07:09

it doesn't work with repeated args though

vlaaad19:07:55

I've been thinking a bit more about simple vs easy, and currently I think I'm overreacting, I think escaping might be an okay price to pay for the limitations different approaches provide

Alex Miller (Clojure team)19:07:37

when you have static data, the best thing to do is put it in deps.edn and reference via alias

seancorfield19:07:30

> including things that can be read as collections -> string I think that's a bad idea since it's common to want to pass a map of stuff when calling Clojure function (in general) so that choice would force EDN parsing on everyone

Alex Miller (Clojure team)19:07:02

with -X you are always passing a map - the command line is overrides to the data in deps.edn

Alex Miller (Clojure team)19:07:18

and the overrides support nested paths

seancorfield19:07:20

Right, I meant as one of the arguments (inside that map)

Alex Miller (Clojure team)19:07:40

nested paths gets you out of another set of cases

seancorfield19:07:45

i.e., to produce a nested map

vlaaad19:07:13

like -X:deploy :envs '#{"prod" "qa"}'

seancorfield19:07:26

Yeah, having :test 1234 and :test [1234 5678] produce a number and a string respectively would be very strange.

vlaaad19:07:38

I agree 🙂

Alex Miller (Clojure team)19:07:44

it turns out vectors are actually ok bash if you use the comma

vlaaad19:07:55

not ok pwsh

Alex Miller (Clojure team)19:07:04

:test [1234,5678] is actually ok

seancorfield19:07:42

I sympathize with the additional pain on PS (I too use it from time to time with the Clojure CLI) but since the vast majority of Clojure CLI users are on macOS/Linux I'd rather not make all their lives more painful, just to make PS less painful -- and it's already a bit painful to use for the Clojure CLI...

Alex Miller (Clojure team)19:07:55

maybe this is a topic for #clj-on-windows but what's the story on the new Windows terminal?

vlaaad19:07:56

hmm, I might be tripping, [1,2,3] worked fine in pwsh

seancorfield19:07:15

and clj -X:example [:test,:value] 1234 works on macOS so, yay, portability! 🙂

seancorfield19:07:20

@alexmiller The new Windows terminal is just a fancy tabbed shell around existing PS, cmd, and Linux terminals.

nate19:07:05

out of curiosity, why are unqualified lib names now deprecated? was there a deeper issue that needed addressing or is it just because qualified names are unambiguous and more correct?

nate19:07:23

I saw it in the blog post that he posted https://insideclojure.org/2020/07/28/clj-exec/

nate19:07:47

which mentioned the deprecation again, but I was curious if there was a deeper reason for it

dominicm20:07:31

To encourage use of groupid

dominicm20:07:21

And discourage hiccup/hiccup in favor of com.weavejester/hiccup. But in a general sense, not the global sense.

sveri20:07:20

Finally 🙂 That was one thing that always made me wonder why one would have unqualified library names when clojure is so heavily rooted in java.

Alex Miller (Clojure team)19:07:15

not sure what I can add beyond what's in the blog

Alex Miller (Clojure team)19:07:58

unqualified names are bad so we're going to stop encouraging them in this area

nate19:07:50

that makes sense, thank you

vlaaad20:07:23

PS C:\Users\Vlaaad\Projects\tdeps> cat .\deps.edn
{:aliases {:prn {:fn clojure.core/prn}}}
PS C:\Users\Vlaaad\Projects\tdeps> clj -Sdescribe
{:version "1.10.1.596"
 ..."}
PS C:\Users\Vlaaad\Projects\tdeps> clj -X:prn
Execution error (FileNotFoundException) at clojure.main/main (main.java:40).
Could not locate clojure/tools/deps/alpha/exec__init.class, clojure/tools/deps/alpha/exec.clj or clojure/tools/deps/alpha/exec.cljc on classpath.

Alex Miller (Clojure team)20:07:00

hrm, let me check on that, shouldn't be using that class anymore

vlaaad20:07:53

-Spath is

C:\Users\Vlaaad\.m2\repository\org\clojure\clojure\1.10.1\clojure-1.10.1.jar;C:\Users\Vlaaad\.m2\repository\org\clojure\spec.alpha\0.2.176\spec.alpha-0.2.176.jar;C:\Users\Vlaaad\.m2\repository\org\clojure\core.specs.alpha\0.2.44\core.specs.alpha-0.2.44.jar;src
`

Alex Miller (Clojure team)20:07:49

path is fine, it's the class, I missed one change there

Alex Miller (Clojure team)20:07:05

windows 1.10.1.600 has the fix

dominicm20:07:43

Does -X compose?

borkdude20:07:24

What do you mean by that?

Alex Miller (Clojure team)20:07:32

depends what you want to compose with :)

Alex Miller (Clojure team)20:07:43

with all the classpath stuff, yes

Alex Miller (Clojure team)20:07:04

but if you want to run multiple things, write a program that does so and run it with -X :)

dominicm20:07:05

I don't want to write lots of programs! I want to change my programs on a whim at the cli. Start a socket server, start a whatever, run the program in the local project that does setup, run my custom dev function.

dominicm20:07:50

(We've discussed before though, not really trying to convince, but I hoped that exec would provide this)

dominicm20:07:49

Right now I'm (ab)using the fact you can supply an init and a main to load a dev.clj in my home directory, which will run things based on the directory the jvm started in...

Alex Miller (Clojure team)20:07:18

there's this thing called a repl that lets you do like ... anything

😆 3
dominicm20:07:09

Yeah, but I have to like type all these weird ( characters.

3
vlaaad20:07:39

PS C:\Users\Vlaaad\Projects\tdeps> clj -Sdescribe
{:version "1.10.1.600" ...}
PS C:\Users\Vlaaad\Projects\tdeps> clj -X:prn
Execution error (ExceptionInfo) at clj-exec/check-first (clj_exec.clj:32).
Invalid first arg to exec: prn

vlaaad20:07:33

could it be PS escaping away the :? :thinking_face: other args like -A:alias work fine thogh

Alex Miller (Clojure team)20:07:03

will take a look, not sure

Alex Miller (Clojure team)20:07:33

maybe I'm missing the first arg I match in the pwsh for this, but seems like we'd get nothing here, not part of the arg

Alex Miller (Clojure team)20:07:09

how hard is it for you to just modify the ClojureTools.psm1 ?

Alex Miller (Clojure team)20:07:08

I think line 84 just needs to be $ExecAlias += $arg, $params

Alex Miller (Clojure team)20:07:28

it's losing the matching $arg right now

vlaaad18:07:53

I tried what you suggested, now clj "-X:prn" :a 1 succeeds, while clj -X:prn :a 1 still fails with error Invalid token: :

vlaaad18:07:52

hacked it to work with this:

$sym, $params = $params
$ExecAlias += "$arg$sym", $params
now it doesn't work with "-X:prn" though

vlaaad18:07:05

seems to be PS parsing issue:

> echo -X:prn
-X:
prn

vlaaad18:07:47

> echo -A:prn
-A:
prn

vlaaad18:07:28

hmm, that works:

s> clj -A: beep:boop:bap
WARNING: Specified aliases are undeclared: [:beep :boop :bap]
Clojure 1.10.1
user=>

Alex Miller (Clojure team)18:07:10

is there a difference in powershell parsing a single thing (into leading char / remaining char) or many things?

vlaaad18:07:16

you mean -XXX:yyy vs -X:y ?

Alex Miller (Clojure team)18:07:49

no, I mean are we getting different behavior on clj -X:foo vs clj -X:foo :a 1 ?

vlaaad19:07:34

no:

PS C:\Users\Vlaaad\Projects\tdeps> clj -X:prn :a 1
{:a 1}
PS C:\Users\Vlaaad\Projects\tdeps> clj -X:prn
nil

vlaaad19:07:47

but this wont work: clj "-X:prn", because I made the script to expect args -X: and prn separately

vlaaad19:07:24

so what we really need to do is accept both -X:alias and -X: , alias for powershell to make it predictable

vlaaad19:07:37

I'll try to write some powershell..

vlaaad19:07:58

if ($arg -eq "-X:") {
        $sym, $params = $params
        $ExecAlias += "$arg$sym", $params
      } else {
        $ExecAlias += $arg, $params
      }

vlaaad19:07:16

PS C:\Users\Vlaaad\Projects\tdeps> clj "-X:prn" :a 1
{:a 1}
PS C:\Users\Vlaaad\Projects\tdeps> clj "-X:prn"
nil
PS C:\Users\Vlaaad\Projects\tdeps> clj -X:prn
nil
PS C:\Users\Vlaaad\Projects\tdeps> clj -X:prn :a 1
{:a 1}

Alex Miller (Clojure team)19:07:29

the code for other aliases in tools.deps is actually tolerant of the split here, maybe that's necessary for the -X stuff too. in other words, we've been masking this problem

dominicm20:07:28

In earnest, there's a little bit of a desire to hide implementation behind flags. Telling someone to run clojure -A:nrepl:piggieback is easier than explaining that they need to run a set of functions once waiting for the repl to connect, and then press buttons on their editor, in an exact sequence to make it work. Right now I use jvm options.

seancorfield20:07:13

Dang, we use a lot of single-segment lib names at work! 😞

seancorfield20:07:39

(updating 27 deps.edn files in our monorepo!)

Alex Miller (Clojure team)21:07:27

feedback on the warning message? I tried to make it useful

seancorfield21:07:42

Annoying, but perfect.

seancorfield21:07:01

The only slightly weird thing was that I seemed to get all of the warnings twice?

Alex Miller (Clojure team)21:07:33

that dimly rings a bell. I wrote this like a month ago. I think because it's encountered during canonicalization and also during expansion or something?

👍 3
seancorfield21:07:49

Am I right in thinking the new "alias data" feature is going to allow people to add all sorts of configuration stuff into deps.edn as data under an alias?

seancorfield21:07:17

Folks have been asking for that for quite a while 🙂

Alex Miller (Clojure team)21:07:26

like most things, taste is helpful

seancorfield21:07:36

(and have been told in the past, "don't do that" 🙂 )

Alex Miller (Clojure team)21:07:44

it might be a good place to put like, build configuration

seancorfield21:07:34

Hmm, and because aliases don't compose, it's "just" fixed data so I guess that's a nice place to draw the line.

seancorfield21:07:21

I suspect shadow-cljs and other tools might leverage it for build config to avoid having a separate file for that...

dominicm21:07:16

Aliases can compose, but it's down to their interpreter to decide how.

Alex Miller (Clojure team)21:07:39

btw, I don't know if add-libs works with latest (haven't tried). I am still injecting the lib map atm which is what add-libs works starts from, but not sure if it also uses anything else in tools.deps that's changed. the branch I have has the stuff to switch to basis but also other stuff too so some interpolation will need to be done, not sure when I'll get to that

seancorfield21:07:44

NP. I just updated my dot-clojure deps.edn to rename the alias from :deps to :add-lib and add notes that it should be considered experimental and likely to break or go away 🙂

seancorfield21:07:14

(I had forgotten that the installed deps.edn contains a :deps alias when I originally added it)

seancorfield21:07:09

I also just cleaned up the :rebl* aliases to reflect the latest REBL having its own deps.edn files for java8 and openjfx15ea (plus some reorganization and updating several versions).

borkdude21:07:57

My work is now finally using deps.edn/tools.deps/clojure CLI (how do you even call this stuff?). I moved out our front-end build to it (using figwheel.main / cljs.main) last week while we still do the uberjar and REPL stuff with boot. Also now we can finally run Java 11 everywhere, since we were stuck, the boot frontend stuff didn't work with it (at least not for us).

ghadi21:07:06

that's exciting @borkdude

borkdude21:07:23

Also we use this dev script to start 3 processes simultaneously: clojure -A:cljs/dev, clojure -A:less/dev and ./boot dev, while having only one terminal tab open: https://gist.github.com/borkdude/8f5dff7c2330ca520403eb44c9013a83, just as a convenience

dominicm21:07:47

3 jvms! I bet that doesn't integrate well with cider jack in. Might I suggest starting 3 threads instead?

borkdude21:07:36

I've always avoided cider-jack-in, I always use cider-connect. Even more so now I'm developing on a remote machine but editing files in my local emacs using tramp.

borkdude21:07:40

Threads may work but it's not a huge deal right now. We need at least two JVMs given we're using two different build/classpath/dependency tools right now.

seancorfield21:07:14

"I've always avoided cider" -- ftfy 🙂

👏 3
seancorfield21:07:46

As part of this monorepo deps cleanup I'm doing (to prevent all those DEPRECATED warnings!) I'm also removing the last few references to nREPL in our setup since neither I nor my team mate use that now.

dominicm21:07:04

seems unfair to people who use jack in. ¯\(ツ)

borkdude21:07:25

Well, I asked my teammates and this was all OK for them, so I guess we're good 🙂

rickmoynihan22:07:59

I’m curious why the new tools.deps adds a tool to do local maven installs. Is this something people frequently need? I’ve probably only ever needed to install free form jars into my local maven repo a few times in the past ten years. I mean sure if I’ve built a jar myself I will frequently want to install it, but it seems strange to supply a method to install jars, but not build them. I’m just curious what problem it’s solving for people.

rickmoynihan22:07:06

Am I missing something in my workflow; or is it just that this happens to have been baked before other build tasks in tools.build?

kenny22:07:37

Perhaps related to Datomic's dev-local needing to be installed into your local Maven repo to be used (it's not distributable).

seancorfield23:07:38

^ That is what Alex said when asked earlier @rickmoynihan

rickmoynihan23:07:41

ahh ok makes sense in that use case. Thanks @seancorfield

andy.fingerhut23:07:35

@alexmiller Robot Chicken has some pretty darned funny riffs on Star Wars scenes, including the one you linked above: https://www.youtube.com/watch?v=WpE_xMRiCLE

😂 3
vlaaad18:07:53

I tried what you suggested, now clj "-X:prn" :a 1 succeeds, while clj -X:prn :a 1 still fails with error Invalid token: :