babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
kari 2020-09-02T03:54:44.055300Z

Thanks for the feedback! I will update the blog article regarding Babashka library support, I missed that page you are referring! I advertised the blog article in my LinkedIn account. I don't use Twitter. But if you feel the blog article is good enough for sharing, please feel free to share it!

kari 2020-09-02T05:08:56.055500Z

Changed the text regarding Babashka built-in namespaces. Thanks for the feedback!

borkdude 2020-09-02T07:20:37.058100Z

Thanks πŸ™ I shared the article on Twitter. On the libraries page there is also a library for psql. Also we have a pod so you can directly use jdbc.next and honeysql with Postgres

kari 2020-09-02T12:50:18.059100Z

Ok. Good to know. I'll use the library support for sql next time!

borkdude 2020-09-02T12:52:15.059300Z

At one point I had the JDBC driver for PostgreSQL included in babashka, so you could use next.jdbc directly from babashka, but I wasn't sure if this was the right approach, since I maybe would have also include drivers for other databases and this would maybe bloat babashka. But it is still possible to compile babashka with postgres support using a feature flag as well. So, several options. But your basic approach is also valid, whatever works :)

2020-09-02T13:11:25.059500Z

Sure. Happy to share the awesome stuff you and @djblue have made πŸ™‚

borkdude 2020-09-02T13:16:15.059700Z

To be honest I hadn't used clojure.datafy that much myself, but I'm mind blown now ;)

2020-09-02T13:40:23.060100Z

Related to datafy, do you know if the pod edn format preserves metadata? I tried some of the https://github.com/babashka/babashka-sql-pods examples but wasn’t seeing any of the metadata next-jdbc puts on its results for datafy

borkdude 2020-09-02T13:41:02.060400Z

Hmmmmm

borkdude 2020-09-02T13:41:40.060600Z

I wasn't aware of the metadata on that and I think you need to turn this on explicitly, it's probably not currently

2020-09-02T13:41:44.060800Z

Even if there is metadata support, not sure this would work because the metadata it puts on are protocol fns

borkdude 2020-09-02T13:41:59.061Z

yeah, I think this doesn't work with pods probably

borkdude 2020-09-02T13:42:28.061200Z

well maybe we could make it work

borkdude 2020-09-02T13:42:38.061400Z

a pod can also define client side functions

2020-09-02T13:42:40.061600Z

Example metadata:

#:clojure.core.protocols{datafy #object[next.jdbc.result_set$navize_row$fn__17145 0x4c1ea0ab "next.jdbc.result_set$navize_row$fn__17145@4c1ea0ab"]}

borkdude 2020-09-02T13:42:52.061800Z

oh functions

borkdude 2020-09-02T13:43:19.062Z

we could hack around that by representing the function using a name, but if it's a closure then that won't work

2020-09-02T13:43:43.062200Z

ah yep

borkdude 2020-09-02T13:44:42.062400Z

can you point me to the place where next.jdbc attaches that metadata?

borkdude 2020-09-02T13:45:34.062600Z

if everything was in babashka itself, it would work. I'm partial about including only postgres, but we could

borkdude 2020-09-02T13:48:44.062800Z

it's still available behind a feature flag

borkdude 2020-09-02T13:48:52.063Z

if you compile bb on your own system

2020-09-02T13:50:58.063500Z

Forgot about the feature flag. I’ll try that πŸ™‚ I’m definitely not advocating for bloating bb core. It is interesting to see where pod’s limitations are

borkdude 2020-09-02T13:59:40.063700Z

I'm very tempted to add postgres support, since it's so cool ;)

borkdude 2020-09-02T14:00:16.063900Z

ah yeah, so it's a closure over this

2020-09-02T14:25:20.064100Z

What am I missing? It is a library right? So I don't have to install a pod, correct? cat deps.edn | bb -cp clojure -Spath -Sdeps '{:deps {djblue/portal {:mvn/version "RELEASE"}}}'` -m portal.main edn` clojure.lang.ExceptionInfo: Could not resolve symbol: realized? [at portal/http_socket_server.clj, line 65, column 20]

borkdude 2020-09-02T14:26:04.064300Z

@mmz Are you using bb 0.2.0?

borkdude 2020-09-02T14:26:09.064500Z

That one is required

2020-09-02T14:26:20.064700Z

let me check ... bb -v ?

borkdude 2020-09-02T14:26:43.064900Z

$ bb --version
babashka v0.2.0

2020-09-02T14:30:26.065100Z

Works now! (did a brew update before testing ... should have done a brew upgrade babashka :face_palm::skin-tone-3: )

2020-09-02T14:31:36.065300Z

This is indeed pretty awesome! :thumbsup::skin-tone-3:

Michael W 2020-09-02T16:43:51.066200Z

I just got a new mac from work and I cannot run bb, it tells me it’s an unknown developer. Any work around?

Michael W 2020-09-02T16:55:07.066400Z

Got this working by turning off gatekeeper, (sudo spctl --master-disable) then running bb, and turning gatekeeper back on (sudo spctl --master-enable).

borkdude 2020-09-02T17:02:31.066600Z

Cool. Maybe this should be documented in the README?

2020-09-02T17:22:53.066800Z

I think you can alternatively use sudo xattr -d com.apple.quarantine path-to-bb

Michael W 2020-09-02T17:24:08.067Z

I actually downloaded it manually I did not realize there was a brew for it. Testing brew now to see if I have the same issue. New to mac so I just did what I do on linux.

Michael W 2020-09-02T17:26:24.067200Z

Yeah my manual download is what caused the problem. I think the readme is good, it does not happen using brew which is your recommended way to install it. I should have read the readme

borkdude 2020-09-02T17:31:55.067400Z

ok!

borkdude 2020-09-02T17:48:17.068Z

@kari.marttila Your blog post is now featured on the front page of HN :)

1🦜
kari 2020-09-02T17:50:58.068500Z

Heh, I'm a dinosaur, what's HN? πŸ™‚

borkdude 2020-09-02T17:51:36.068800Z

Hacker News

kari 2020-09-02T17:52:05.069200Z

Aah... I try to find it. πŸ™‚

borkdude 2020-09-02T17:52:16.069600Z

https://news.ycombinator.com/

kari 2020-09-02T17:53:36.070600Z

At Metosin they didn't believe that I don't play video games. πŸ™‚ (Actually I started playing video games last spring.) I don't use Twitter. I guess I'm a bit of a dinosaur. πŸ™‚

2πŸ‘
borkdude 2020-09-02T17:53:59.070700Z

I also don't play video games, I like playing with Clojure better ;)

kari 2020-09-02T17:55:02.070900Z

Heh, me too! πŸ™‚ My kids are already adults and I have a lot of free time - nice to study Clojure, do these exercises and write blogs in my study room.

kari 2020-09-02T17:55:34.071100Z

I see it! The news is at #10.

kari 2020-09-02T17:56:02.071300Z

Thanks for telling me, you made my day. πŸ™‚

solf 2020-09-02T18:02:10.071600Z

Kind of off topic, but after 55 years of not playing video games, a few hours ago my mum became addicted to Beat Saber, a VR (virtual reality) game

2020-09-02T21:21:36.074400Z

Hi BB team! After reading this article https://dev.to/prasannagnanaraj/i-just-created-a-todo-cli-with-clojure-1133, when I saw the code, I couldn't help but think it was perfect for an Babashka usage. So here is the gist: https://gist.github.com/PrestanceDesign/d2f6ba223e418298618966937062dda0

2020-09-02T21:22:04.074800Z

#!/usr/bin/env bb

(require '[clojure.string :refer [split]])
(require '[<http://clojure.java.io|clojure.java.io> :refer [writer reader]])
(require '[clojure.pprint :refer [print-table]])

(def file-location (System/getenv "TODO_LOCATION"))

(defn now [] (new java.util.Date))

(defn add-content
  "appends content to todo file"
  [file-location text-content]
  (with-open [file (writer file-location :append true)]
    (.write file (str text-content "\t" (now) "\n"))))

(defn print-helper
  "Converts line content to a row obj"
  [line-content]
  (let [[todo created_at] (split line-content #"\t")]
    {:todo todo :created_at (or created_at "UNKNOWN")}))

(defn read-content
  "reads content from todo file"
  [file-location]
  (with-open [file (reader file-location)]
    (let [file-content (slurp file)]
      (print-table
       (map print-helper
            (split file-content #"\n"))))))

(let [args *command-line-args*]
  (when (nil? file-location)
    (throw (AssertionError. "empty $TODO_LOCATION")))
  (case (first args)
    "a" (do
          (add-content file-location (second args))
          (read-content file-location))
    "ls" (read-content file-location)
    (println "Choose either a or ls")))

1
borkdude 2020-09-02T21:26:49.075200Z

Excellent :) Maybe I should also open source my own TODO app at some point

8