babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
dabrazhe 2021-06-09T08:36:16.483Z

It won’t work for me. I can see ‘bb’ in the ‘connect to repl’ prompt but the port is still empty after localhost: The .bb-nrepl-port is created fine with 1667 port in it. @pez

borkdude 2021-06-09T08:42:53.484600Z

Got slingshot working: https://github.com/babashka/babashka/blob/master/doc/projects.md#slingshot Also added its test suite to CI. Only one test is failing due to a difference how to records are implemented in bb, but it seems to be a corner case that is hopefully not used a lot (catching by record names). With some effort that may also be fixable. cc @scgilardi

pez 2021-06-09T08:44:32.485100Z

And you are selecting bb, not just seeing it?

pez 2021-06-09T08:45:47.485500Z

Also, which directory are you starting babashka in?

dabrazhe 2021-06-09T12:05:14.485800Z

Yes, selecting. BB starts in the root dir or the project, where the repl file is.

dabrazhe 2021-06-09T12:05:43.486Z

Restarted VSC just in case

pez 2021-06-09T13:03:56.486200Z

I now tried this on my Windows machine, and it just works there as well… Please file an issue about this using the Help menu in vscode. Attach the setting and the command line you are using.

borkdude 2021-06-09T13:48:35.486400Z

@suskeyhose I've got dosync etc working. I'm also looking into .wait and .notify: this does work if you use an ^Object type hint, so you could try that as a workaround meanwhile.

borkdude 2021-06-09T13:48:44.486600Z

I also made this GraalVM issue: https://github.com/oracle/graal/discussions/3456

borkdude 2021-06-09T13:49:06.486800Z

If you want to try a binary with dosync etc, let me know your OS

Ory Band 2021-06-09T14:11:30.487800Z

Hi. I'm trying to find an example on how to print UTC datetime strings in ISO-8601 format. I can't find any reference to Java datetime libraries in babashka book. Can some provide any reference please?

borkdude 2021-06-09T14:13:16.488200Z

@ory.band The java.time package is available in bb

borkdude 2021-06-09T14:15:22.488400Z

Here is an example: https://github.com/babashka/babashka/blob/master/examples/pst.clj

2021-06-09T15:16:09.491100Z

I'm trying out babashka tasks, and I'm looking to re-use a babashka script that I was arleady using before tasks. I'd like to create a task that calls this script, what's the preferred method for doing this? * (shell "bb script.clj") * (load-file "script.clj") * other? I've seen both of those approaches work. At first, I thought I should be require'ing this script but idk how I would go about that.

borkdude 2021-06-09T15:17:50.492500Z

@jvtrigueros load-file is somewhat cheaper than invoking bb another time, but both should work. You could also add your script to the classpath e.g. by moving it to script/script.clj and then adding "script" to :paths in your bb.edn. Beware of side effects in your scripts in that case

2021-06-09T15:21:09.492700Z

I'll give that a shot! I'm currently using load-file, but using it as a library is what I'd prefer. Thank you!

2021-06-09T16:02:09.492900Z

Worked beautifully!

danieroux 2021-06-09T16:44:47.493300Z

$ clojure -J-Dorg.eclipse.jetty.LEVEL=INFO    
Clojure 1.10.3
user=> (System/getProperty "org.eclipse.jetty.LEVEL")
"INFO"
user=>
$ bb clojure -J-Dorg.eclipse.jetty.LEVEL=INFO 
Unrecognized option: -
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

borkdude 2021-06-10T10:47:37.002600Z

@danie Released 0.4.5 with the fix now

danieroux 2021-06-10T11:04:06.002800Z

Thank you 😊

danieroux 2021-06-09T16:44:56.493600Z

Am I missing something obvious?

borkdude 2021-06-09T16:58:20.493700Z

Looks like a bug...

borkdude 2021-06-09T17:04:53.493900Z

Feel free to post an issue

borkdude 2021-06-09T17:09:08.494200Z

I found the issue

2021-06-09T17:41:41.494600Z

Awesome, I'll give it a try today.

Ory Band 2021-06-09T17:42:19.494800Z

thanks!

2021-06-09T17:52:21.495Z

I'm using nixos

borkdude 2021-06-09T17:58:03.495200Z

ok, then the static linux binary probably works for you: https://19891-201467090-gh.circle-artifacts.com/0/release/babashka-0.4.5-SNAPSHOT-linux-amd64-static.tar.gz

danieroux 2021-06-09T18:00:07.495400Z

Step away from keyboard, come back to answers, thanks @borkdude 😊

borkdude 2021-06-09T18:16:11.495600Z

Pushed a fix. https://github.com/borkdude/deps.clj/issues/46 Which OS are you using? I can provide you with a new binary until the new release

borkdude 2021-06-09T18:17:46.496Z

Or check yourself in #babashka-circleci-builds (should be there in a few minutes)

2021-06-09T20:30:32.496300Z

@borkdude the commute and alter functions would be great to have too. I know farolero uses at least alter. I'll get to actually testing it once my workday is done.

borkdude 2021-06-09T20:47:30.496500Z

I already added alter. Adding commute now as well.

2021-06-09T20:55:28.496800Z

Thanks

mathpunk 2021-06-09T23:09:08.497600Z

I'm wrapping up my first real project, and the only thing left is that I'm invoking my main function incorrectly. (Details in 🧵)

111🎉2✅
mathpunk 2021-06-09T23:09:16.497700Z

$ pwd
/Users/tomhenderson/lg/logicgate/docker-new/scripts/e2e/dd-junit

$ tree -L 3
.
├── bb.edn
├── repl
│   ├── individual_failures.clj
│   └── playground.clj
└── src
    └── dd-junit
        ├── core.clj
        ├── datafy.clj
        └── statsd_client.clj


$ cat bb.edn
{:paths ["src/dd-junit", "repl"]}

$ cat src/dd-junit/core.clj
(ns dd-junit.core
  (:require [dd-junit.statsd-client :as statsd]
            [dd-junit.datafy :as datafy]
            [<http://clojure.java.io|clojure.java.io> :as io]))


...

(defn -main [&amp; args]
  (let [junit-path (first args)
        user-tags (rest args)]
    (doseq [item (prepare-messages junit-path user-tags)]
      (println item)
      (statsd/send-msg item))))

$ bb -m dd-junit.core
----- Error --------------------------------------------------------------------
Type:     java.lang.Exception
Message:  Could not find namespace: dd-junit.core.
Location: 1:10

----- Stack trace --------------------------------------------------------------
 - &lt;expr&gt;:1:10

mathpunk 2021-06-09T23:11:10.497900Z

Individually, the 3 namespaces I'm using all evaluate w/o error

mathpunk 2021-06-09T23:11:46.498100Z

(earlier i had just "src", "repl" in :path, but the effect was the same)

2021-06-09T23:29:30.498300Z

perhaps the folder needs to be named src/dd_junit instead of src/dd-junit (underscore vs. dash)

2021-06-09T23:30:10.498500Z

and then :paths as "src" and "repl" like you had before

mathpunk 2021-06-09T23:38:38.498700Z

omg i bet that's it, it's always it

mathpunk 2021-06-09T23:38:44.498900Z

and i never remember why lol

mathpunk 2021-06-09T23:40:57.499100Z

YEP, thanks