babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
borkdude 2020-08-30T09:42:01.000400Z

Extended poll about including clojure.spec in babashka here: https://twitter.com/borkdude/status/1300428421252747266

borkdude 2020-08-30T11:08:21.000700Z

And the issue: https://github.com/borkdude/babashka/issues/558

2020-08-31T15:19:10.033400Z

> I think it would be good to try it again, since there were several improvements concerning performance @borkdude The script is broken it seems (not sure if was working before). I’ve updated it so that the command generation will work. The spartan.spec version still adds quite some overhead 130ms vs 100ms.

time bb -f tasks.cljc
No task found for ''

Existing tasks
* options : Demonstrate the task options DSL.
bb -f tasks.cljc  0.09s user 0.04s system 89% cpu 0.140 total
vs
time QUICK=1 bb -f tasks.cljc
No task found for ''

Existing tasks
* options : Demonstrate the task options DSL.
QUICK=1 bb -f tasks.cljc  0.06s user 0.03s system 92% cpu 0.093 total
code is here https://gist.github.com/jeroenvandijk/c6cb6cdecfd5aa8e990c3765f3411c0f

2020-08-30T14:24:51.004Z

What is driving the inclusion of spec in either version?

borkdude 2020-08-30T14:29:09.004200Z

Excellent question. Some people like to validate their command line args with spec: https://github.com/l3nz/cli-matic/issues/113 Some people like to generate data from specs. Instrumenting functions during script development (may be far fetched). There's probably more command line applicability to spec, but maybe it's not really an urgent thing to have. @jeroenvandijk also had a need for it. Earlier requests resulted in a library which can be interpreted and is not built-in: https://github.com/borkdude/spartan.spec

borkdude 2020-08-30T14:32:24.006Z

If you have any thoughts on this, I'd like to hear them. Btw, the version with the uberscript fixes was released (0.2.0).

2020-08-30T14:33:18.006600Z

Thanks for the release

2020-08-30T14:35:28.009Z

I wonder how Clojure will incorporate spec alpha2. I suppose it could just include both versions so it doesn’t make a breaking change.

borkdude 2020-08-30T14:36:01.009200Z

Good question. I'll ask in #clojure-spec

2020-08-30T14:36:29.009400Z

Regarding my use case, I was working on a cli tool for launching cloudformation stacks. I wanted to validate these templates with Spec (and expound). At the time it was unclear (to me) how Spec could work with Graalvm. Now there are more examples of this option, but being able to use spec for things like this, without needing to set up a graalvm project makes things easier and cheaper

2020-08-30T14:38:35.010800Z

Can spec not be used with bb by adding it to the class path?

borkdude 2020-08-30T14:39:07.011Z

Right now it can't. That's why I have created spartan.spec

borkdude 2020-08-30T14:39:54.011200Z

At least at the time there were several limitations. And having spec built-in will make it run lots faster

borkdude 2020-08-30T14:40:24.011400Z

Malli might also be interesting to look at, since it's more data driven

2020-08-30T14:41:06.012100Z

Mali does indeed look very interesting

2020-08-30T14:41:41.012300Z

Ah yeah regarding speed, I had a cli parser with spartan.spec and it was indeed to slow https://gist.github.com/jeroenvandijk/c6cb6cdecfd5aa8e990c3765f3411c0f

borkdude 2020-08-30T14:42:25.012500Z

I think it would be good to try it again, since there were several improvements concerning performance

2020-08-30T14:42:41.013100Z

True, I’ll do that tomorrow probably

borkdude 2020-08-30T14:45:16.015100Z

$ time bb tasks.cljc options -a :foo
::foo
bb tasks.cljc options -a :foo   0.10s  user 0.03s system 93% cpu 0.135 total
Not sure how I should invoke the script

2020-08-30T14:46:00.015400Z

Would making it easier to build graalvm native images reduce the pressure to include more things in bb?

borkdude 2020-08-30T14:47:56.016400Z

There's one project that allows you to convert a babashka script into a Graal binary: https://github.com/MnRA/nativity

borkdude 2020-08-30T14:48:35.017400Z

I think having a compilation step in between is always going to be a barrier, no matter how "easy", it will still take time and memory

2020-08-30T14:49:05.018Z

There is also distribution. Is Brew a sufficient distribution mechanism for Linux and windows?

borkdude 2020-08-30T14:50:02.018200Z

For things that are not used by everyone there is https://github.com/babashka/babashka.pods. It lends itself well for libraries that receive data and return data. Spec is probably not so suited for that architecture.

borkdude 2020-08-30T14:50:35.018600Z

Brew doesn't work on Windows, but Windows has scoop, which is similar

borkdude 2020-08-30T14:50:48.018800Z

Babashka pods do have the same distribution problems as other graal binaries

borkdude 2020-08-30T14:53:18.019100Z

I think brew and scoop are nice solutions for distributing binaries

borkdude 2020-08-30T18:21:36.020700Z

I'd like to get an idea on core.async usage in babashka. If you are using it, please leave a note here: https://github.com/borkdude/babashka/issues/559