babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
adam-james 2021-02-23T00:12:29.041500Z

Thanks for this example. I am able to get your code working, however, it doesn't work when I also pull in my svg library. As soon as I require svg-clj (where the real use of spec occurs), uberscript will pull in clojure spec's code.

adam-james 2021-02-23T00:16:08.041700Z

If I modify my ns

(ns svg-clj.main
  (:require [clojure.string :as st]
            #_[clojure.spec.alpha :as s] ;; eliminate spec requirement here
            [clojure.pprint :as pp]
            [clojure.data.xml :as xml]
            #?(:clj
               [hiccup.core :refer [html]])
            #?(:cljs
               [cljs.reader :refer [read-string]])))
Then your approach works. I was thinking of spartan as a complete 'drop in' replacement, but I may have to use a reader conditional in my library to get it to work with an uberscript

adam-james 2021-02-23T00:17:21.041900Z

These are good suggestions. The uberscript approach was the first one I tried and succeeded with. I still plan to try uberjars as well. It's the next on the list. I'm still very much in the 'exploratory' phase of scripting :)

grazfather 2021-02-23T02:33:45.042400Z

😄

steveb8n 2021-02-23T08:46:23.043300Z

when I click the link below I get a 404. Just a heads up… bb --nrepl-server 1667 Started nREPL server at 127.0.0.1:1667 For more info visit https://github.com/babashka/babashka/blob/master/doc/repl.md#nrepl.

borkdude 2021-02-23T08:47:14.043600Z

Ah right, that link moved to the http://book.babashka.org. I will change it, thanks

steveb8n 2021-02-23T08:48:28.044800Z

@borkdude @cfleming what’s the state of play for using bb --nrepl-server in Cursive? It seems to work for me but for each eval I also get a Cursive exception clojure.lang.ExceptionInfo: Could not resolve symbol: cursive.repl.runtime/completions

steveb8n 2021-02-23T08:48:50.044900Z

I can ignore/tolerate this but it would be cool if it could be silenced

borkdude 2021-02-23T08:53:00.045100Z

Is this an nREPL middleware?

borkdude 2021-02-23T08:55:16.046100Z

@adam.james Thanks for becoming a sponsor on Github. Would you like to have access to the private sponsors channel?

steveb8n 2021-02-23T09:15:53.046800Z

No, vanilla cursive. I’d guess it’s Cursive assuming a CLJ or CLJS env. prob best if we wait for comment from Colin

steveb8n 2021-02-23T09:16:16.047Z

I’m not blocked and have pods working already so I’m good. I just ignore it

steveb8n 2021-02-23T09:16:31.047200Z

if it becomes too painful, I’ll switch to Calva

steveb8n 2021-02-23T09:30:35.047400Z

I might try creating an nrepl middleware that throws away that specific exception. that would make life a little nicer

borkdude 2021-02-23T09:39:59.047600Z

Yeah, the thing is with babashka nREPL is that you (at the moment) can't have middleware, since the nREPL server is pretty much a monolithic thing that supports only the basic nREPL features + the pprint middleware

borkdude 2021-02-23T09:40:19.047800Z

We could support defining middleware in a babashka script possibly, but that's not there at the moment

steveb8n 2021-02-23T09:48:57.048Z

Ok. That's definitely my knowledge limit. Let's see what Colin says in (our downunder) morning

adam-james 2021-02-23T12:19:22.048300Z

Sure, that sounds nice

borkdude 2021-02-23T16:36:39.049Z

@heow Thanks for sponsoring! Would you like to have access to the private sponsors channel?

👍 1
2021-02-23T16:59:57.050200Z

does anybody store config info in an environment var, like a hash?

2021-02-23T17:00:04.050400Z

export FOO_OPTS='{:name "Alice" :score 10}'

❤️ 1
🤓 1
rwstauner 2021-02-23T17:01:57.050600Z

i have at least one project that does that

👍 1
Dig 2021-02-23T17:02:57.052200Z

i've noticed that clojure.instant is not included. is it an oversite or there is a reason for it?

2021-02-23T17:03:17.052400Z

great, I was wondering if there is a good reason I don't see it more often

borkdude 2021-02-23T17:03:37.052900Z

How are you using clojure.instant? bb generally advices to use java.time

Dig 2021-02-23T17:04:54.053600Z

some old code that i cut and pated, i guess i can port it to java.time

cfleming 2021-02-23T19:32:05.053900Z

Ugh, I’ve been meaning to look at this, sorry. Cursive should probably either interrogate the REPL at startup to get an idea of the env available, or allow the user to configure it and assume they know what they’re doing.

cfleming 2021-02-23T19:32:37.054100Z

Cursive doesn’t use middleware, so it’s not that. I suspect the code it sends over for completion uses features that bb doesn’t offer.

borkdude 2021-02-23T19:35:04.054300Z

@cfleming Can Cursive connect to an already started nREPL that hasn't been started by Cursive itself? I would expect the same problem to manifest there

cfleming 2021-02-23T19:35:22.054500Z

Yes, it can.

Dig 2021-02-23T20:22:33.055500Z

pst.clj example helped a lot, that zone stuff in java.time is tricky 🙂

borkdude 2021-02-23T20:26:36.055800Z

you don't have to use the Zoned stuff if you use the Local stuff right?

borkdude 2021-02-23T20:27:23.056Z

btw this lib also works with babashka: https://github.com/henryw374/cljc.java-time

👍 2
2021-02-23T20:58:59.056900Z

cljc.java-time can vouch for it!

steveb8n 2021-02-23T22:18:08.057300Z

I thought this might be the case. I’ll ignore the exceptions for now. It’s worth it because using a REPL for bb is much faster than testing using bb cli

steveb8n 2021-02-23T22:18:51.057500Z

fwiw: I am starting the nrepl server in a terminal window and connecting to that. It was trivial to get started, this is a really good DX

steveb8n 2021-02-23T23:34:55.058600Z

@borkdude following up from an earlier thread, I can confirm that bb works with aws-vault i.e. aws-vault exec cloudwatch-readonly -- bb --nrepl-server 1667 where cloudwatch-readonly is one of my iam roles

👍 2
steveb8n 2021-02-23T23:35:55.058700Z

probably not a big surprise but still good to know as vault is a best practice for AWS access on dev machines