clj-on-windows 2020-09-25

Clojure v1.10.1.697 (stable) landed at scoop bucket.

👍🏻 1

That was fast!

Alex Miller (Clojure team) 2020-09-25T19:27:29.003800Z

nice!

Alex Miller (Clojure team) 2020-09-25T19:27:54.004300Z

I actually tested this one about 100x more on windows than I have previously so hoping I didn't miss something

Alex Miller (Clojure team) 2020-09-25T19:28:18.005Z

(thank you AWS workspaces...)

Looks like I've got some work to do for deps.clj :)

Alex Miller (Clojure team) 2020-09-25T19:32:13.005800Z

yeah, feel free to ping me if questions. there are a lot of changes

Alex Miller (Clojure team) 2020-09-25T19:32:27.006100Z

I actually meant to ping you prior and I forgot :)

I think I'll just diff the bash script I based the port on against the newest and then just start porting those. I think it's just a few command line options and then bump tools jar, done

Alex Miller (Clojure team) 2020-09-25T19:34:52.007700Z

the command parsing changed a bit and the interface into the clojure bits has also drifted a bit (although I ended up putting a lot of stuff back for -R and -C - removing those had slimmed it down)

Alex Miller (Clojure team) 2020-09-25T19:35:04.008100Z

also, there is a new exec.jar that gets included in the classpath for -X

Alex Miller (Clojure team) 2020-09-25T19:35:31.008400Z

so that changes the install

Thanks for the heads up.

Alex Miller (Clojure team) 2020-09-25T19:54:20.009500Z

yeah

Alex Miller (Clojure team) 2020-09-25T19:54:57.009800Z

it's not as bad as it looks :)

I thought something changed about -A, but this still works:

$ cat ~/.clojure/deps.edn | grep depot
           :depot {:extra-deps {olical/depot {:mvn/version "RELEASE"}}
                   :main-opts ["-m" "depot.outdated.main"]}
clj -A:depot
Is there a blog article that lays out the breaking changes?

Alex Miller (Clojure team) 2020-09-25T20:18:39.010900Z

there aren't many now

Alex Miller (Clojure team) 2020-09-25T20:19:24.011800Z

-T, -O, -Sresolve-tags were all removed, so those are breaking changes

Alex Miller (Clojure team) 2020-09-25T20:19:45.012400Z

-R and -C both still do exactly what they did before (but warn)

Alex Miller (Clojure team) 2020-09-25T20:20:28.013400Z

-A is still the same but will warn if you supply :main-opts

I didn't see a warning with clj -A:depot though, or did you mean command line args?

Alex Miller (Clojure team) 2020-09-25T20:21:14.014800Z

no, I meant an alias that has :main-opts

ah, hmm. old clojure on the path somewhere I guess..

$ clojure -Sdescribe
{:version "1.10.1.561"

:s

borkdude@MBP2019 ~/Dropbox/dev/clojure/deps.clj (1.10.1.697*) $ brew uninstall clojure
Uninstalling /usr/local/Cellar/clojure/1.10.1.697... (10 files, 18.7MB)
borkdude@MBP2019 ~/Dropbox/dev/clojure/deps.clj (1.10.1.697*) $ which clojure
/usr/local/bin/clojure

Alex Miller (Clojure team) 2020-09-25T20:22:24.016200Z

-M does more than it used to (takes all args) so that could potentially surprise someone expecting to use it only for the :main-opts and not use the other parts of an alias

Alex Miller (Clojure team) 2020-09-25T20:23:06.017Z

if you've installed an @ release of clojure, you might need to explicitly uninstall those

What is the "official" way to pull in deps from an alias that includes :main-opts but start a REPL instead of running the :main-opts? Is that still -R?

Alex Miller (Clojure team) 2020-09-25T20:23:51.018100Z

you can do it with -R, but I would suggest just not doing this at all

Alex Miller (Clojure team) 2020-09-25T20:24:09.018400Z

break it into two aliases

It's very common to see recommendations for :test as an alias to include both :extra-paths ["test"] and :extra-deps <some test tool> :main-opts ["-m" "<run the tool>"] and it used to be that you could just use -R to pull in the test dependencies but start a REPL. Doing that now tells you -R is deprecated and to use -A for a REPL -- but if you use -A you don't get a REPL, it runs any :main-opts -- so I think that's going to confuse people.

Hmm, I guess you needed -C there as well?

tries to remember how things used to work in 561...

Yeah, that would need -C:test -R:test ... OK, I'll just crawl back into my hole ...

(I still think -R should have been expanded so it could be the REPL option but I know Rich doesn't agree so this will be the last time I mention it 🙂 )

Alex Miller (Clojure team) 2020-09-25T20:33:41.024300Z

"very common" == where?

Cognitect's test-runner -- which is where everyone else will copy it from: https://github.com/cognitect-labs/test-runner#usage

Alex Miller (Clojure team) 2020-09-25T20:37:08.025700Z

on my list of things to update :)

Alex Miller (Clojure team) 2020-09-25T20:38:13.026300Z

my impression of cljs-test-runner is that it's saying to use -A for main opts so that's not a case of above

Alex Miller (Clojure team) 2020-09-25T20:38:32.026600Z

you'll get the warning, it says to use -M, and that's what you want

so tl;dr how can you pull :test alias deps? that's a pretty common thing for me to do (e.g. before hopping on a train)

I guess it finds tests to run by searching the filesystem (which I think Cognitect's test-runner does too). But both of those conflict with the :test alias in the system deps.edn which is where folks would normally get their :extra-paths ["test"] from so I guess it's really a bigger problem...

Alex Miller (Clojure team) 2020-09-25T20:43:12.029900Z

-P can be used with all other exec options to download deps, make classpath, but not execute (-P = prepare)

Both of those runners should really use a different alias than :test I think.

Alex Miller (Clojure team) 2020-09-25T20:43:37.030200Z

why is that a conflict?

Well, the cljs-test-runner :test alias hides the system alias so that's probably a bad idea (since you can't start a REPL with your test folder on the path without doing something else).

Alex Miller (Clojure team) 2020-09-25T20:46:01.033Z

I don't understand why this is a problem

And the same goes for the Cognitect test-runner really: although it does have :extra-paths to pull in your test code, again you can't start a REPL with your test folder on the path -- unless you duplicate that path into a separate alias.

The conflict is between running the tool using :test and starting a REPL using :test.

(as you said: the solution is to separate the runner from the classpath/deps needed to run a REPL with tests)

Alex Miller (Clojure team) 2020-09-25T20:47:34.034700Z

those seem like two things

Alex Miller (Clojure team) 2020-09-25T20:47:39.034900Z

and you should have two aliases

Yes, we agree on that. I'm just saying that the two most common test runners for the CLI both do the wrong thing in their usage instructions.

e.g. :clj/tests for running, :test for extra paths and extra deps?

Alex Miller (Clojure team) 2020-09-25T20:48:26.036300Z

well I can change one of those two things real easily :)

The separation has always been "best practice" but it has never mattered really until now.

Alex Miller (Clojure team) 2020-09-25T20:48:48.037200Z

personally, I'd rather have a :repl or :dev or something

Alex Miller (Clojure team) 2020-09-25T20:49:30.038300Z

I'd be pretty happy to just remove the built-in :test alias too

I think this also highlights the lack of composability of aliases -- because if you split stuff into multiple aliases you either have to duplicate stuff in deps.edn under multiple aliases or you have to specify multiple aliases on the command-line to combine those separate things.

Alex Miller (Clojure team) 2020-09-25T20:50:31.039500Z

I'm ok with both of those answers :)

Alex Miller (Clojure team) 2020-09-25T20:51:05.040500Z

but I wouldn't rule out some other way to combine things later

I've been doing -A:test:runner for ages by this point so I "don't care" -- and I got to that point simply because of these "issues" -- but some folks have been very vocal about wanting to just have a single alias that combines other aliases so... ¯\(ツ)

an alias can also be an arbitrary piece of data now right? can that be used to avoid duplication?

Alex Miller (Clojure team) 2020-09-25T20:52:07.041900Z

not currently

"data" != "another alias that is resolved"

Alex Miller (Clojure team) 2020-09-25T20:52:30.042800Z

that is, the clj aliases do not do that work right now

Alex Miller (Clojure team) 2020-09-25T20:52:43.043200Z

but they possibly could so that is something I'm thinking about

:aliases {:test {:compose [:test-deps :run-tests]} :test-deps {...} :run-tests {...}}

Alex Miller (Clojure team) 2020-09-25T20:54:38.044700Z

that's a lot heavier weight than what I'm thinking about :)

Alex Miller (Clojure team) 2020-09-25T20:55:56.046100Z

:aliases {:test #{#alias :test-deps #alias :run-tests} ...} 

(I just noticed we're in #clj-on-windows and this probably should all be in #tools-deps 🙂 )

Alex Miller (Clojure team) 2020-09-25T20:56:34.047300Z

this is far from baked

hm, reader tags... doesn't that go against: other tools should know as little as possible?

Alex Miller (Clojure team) 2020-09-25T20:57:10.048700Z

"this is far from baked"

Nice. Glad to know it's under consideration at this point. But you'd want to combine aliases in a specific order, right? (and sets are unordered)

Alex Miller (Clojure team) 2020-09-25T20:57:35.049200Z

"this is far from baked"

Alex Miller (Clojure team) 2020-09-25T20:58:06.050300Z

my point is, there are options

Hahaha... be careful... someone will make an alexmiller bot that just responds with that for any question! 🤣

what's the use of having :run-tests standalone, since it will need the deps to run?

It would be the only alias that needs the test runner as a dependency.

Both "run a REPL with test code" and "run tests" need something that adds "test" to the path and any dependencies your tests themselves need (such as test.check, expectations...)

That's why I have :test (for the REPL stuff) and :runner (for the test runner dependency and :main-opts). But then I have to say -M:test:runner to run tests (which I'm OK with) but some people want to just say -M:run-tests have it combine the aliases under the hood, or at least have the :run-tests alias pull in the contents of the :test alias and then add the test runner stuff to it. Am I making sense @borkdude?

yeah, it makes sense what you said

Yeah, it's all about where the composition is: inside the tool or on the surface. Leiningen composed "everything" inside, CLI makes you compose "everything" on the surface.

I can't tell whether Paul's tweet is praising CLI or criticizing it (text can be a horrible medium for intent).

some people wrap all these clojure invocations into little bash or Makefiles anyway

so maybe it's not all that important from an ergonomic standpoint

We have a build shell script for that. But mostly it's for running a sequence of CLI commands across a sequence of directories (because: monorepo).

(it does have some composition shortcuts as well)

Anyways, I should stop shaving this yak and go back to working on HoneySQL 2.0...

Alex Miller (Clojure team) 2020-09-25T21:15:46.061Z

if only there was a snowflake maker

Alex Miller (Clojure team) 2020-09-25T21:16:00.061100Z

goes back to his snowflake maker machine

I'll have a stab at deps.clj this weekend. Thanks Alex for all the good work you do.

Alex Miller (Clojure team) 2020-09-25T21:17:55.061800Z

same to you all :)