babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
borkdude 2021-01-27T10:12:10.176300Z

https://graalworkshop.github.io/2021/ ^ babashka talk at this conference

👍 3
Marco Pas 2021-01-27T11:25:27.177400Z

I came across https://practicalli.github.io/clojure/clojure-tools/data-browsers/ using data browsers inside a clojure project. I was wondering if this also would be possible when using BB?

borkdude 2021-01-27T12:01:46.178700Z

@marco.pasopas Try portal:

(require '[babashka.deps :as deps])

(deps/add-deps '{:deps {djblue/portal {:mvn/version "0.9.0"}}})

(require '[portal.api :as p])

(.addShutdownHook (Runtime/getRuntime)
                  (Thread. (fn [] (p/close))))


(p/open)
(p/tap)

(tap> [1 2 3])

@(promise)

borkdude 2021-01-27T12:02:19.178900Z

https://github.com/djblue/portal

borkdude 2021-01-27T12:03:18.179700Z

The (tap> [1 2 3]) call is where you send data to portal and it will display it

borkdude 2021-01-27T12:09:01.180200Z

@djblue Is the shutdown hook still needed or is this included by portal itself now? ^

borkdude 2021-01-27T12:14:30.180600Z

You can also do this "one-liner" to view e.g. an EDN file:

$ cat deps.edn | bb -e "(babashka.deps/add-deps '{:deps {djblue/portal {:mvn/version \"0.9.0\"}}})" \
                    -e "(require 'portal.main)" \
                    -e "(portal.main/-main \"edn\")" 

djblue 2021-01-27T16:32:31.182800Z

Not if you call portal.main 😄

borkdude 2021-01-27T16:34:23.183Z

ah

borkdude 2021-01-27T16:34:42.183200Z

it seemed portal shut down correctly when I pressed ctrl-c in the above snippet

borkdude 2021-01-27T16:34:52.183400Z

oh yeah, I get your point now

💯 1
borkdude 2021-01-27T18:02:31.183900Z

@jayzawrotny Now release 0.0.2 with static linux versions: https://github.com/babashka/babashka-sql-pods/releases/tag/v0.0.2

🎉 2
2021-01-27T18:03:14.184300Z

Awesome! Testing it now with my cgi script

2021-01-27T18:08:38.184600Z

… and it worked! 🚀

🎉 2
2021-01-27T18:12:55.185400Z

Out of curiosity would it have been possible to uberjar the jdbc + postgresql driver? When should a pod be chosen over creating an uberjar?

borkdude 2021-01-27T18:13:46.186Z

@jayzawrotny babashka doesn't run a JVM so just a postgres driver doesn't work.

2021-01-27T18:14:57.187Z

I see so the pod is a specific package written for babashka where as an uberjar is suited for cross-platform or already babashka friendly code?

borkdude 2021-01-27T18:15:10.187200Z

right

borkdude 2021-01-27T18:15:36.187800Z

a pod can be written in any language, as long as it offers the API in a certain format. a pod is basically another CLI that acts as a service

borkdude 2021-01-27T18:16:53.189Z

Messages go back and forth in EDN, JSON or transit. So all the function args you use have to be either pure data, or there has to be some magic to represent objects as data. E.g. we represent db connections or transactions by an id that is sent back and forth.

👍 2
2021-01-27T18:19:21.189700Z

Ahh good to know, and sounds like a pretty powerful\flexible system.

✅ 2