Fork me on GitHub
borkdude10:01:10 ^ babashka talk at this conference

👍 12
Marco Pas11:01:27

I came across using data browsers inside a clojure project. I was wondering if this also would be possible when using BB?


@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))))


(tap> [1 2 3])



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


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


Not if you call portal.main 😄


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


oh yeah, I get your point now

💯 4

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\")" 

eccentric J18:01:14

Awesome! Testing it now with my cgi script

eccentric J18:01:38

… and it worked! 🚀

🎉 6
eccentric J18:01:55

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


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

eccentric J18:01:57

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?


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


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.

👍 6
eccentric J18:01:21

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