Fork me on GitHub
#babashka
<
2021-12-01
>
borkdude08:12:57

Will add it. There’s an #nbb channel too

borkdude08:12:03

@martinklepsch Added in 0.0.111

🎉 1
Cnly14:12:16

Hi, I found that bb won’t complain about the bad recur position here, and will continue execution as if it doesn’t exist. Is this a bug?

(loop [n 10]
  (when (> n 0)
    (when (= n 1)
      (println "one")
      (recur (- n 2)))  ;; <- This recur
    (println n)
    (recur (- n 1))))

borkdude14:12:50

both bb and clj-kondo could try harder to catch this

borkdude14:12:16

feel free to post issues at both. it's actually a SCI issue, so please post in the SCI repo

Cnly14:12:04

Thanks for the hint, will do

dabrazhe16:12:09

Just to verify, bb does not need java/jvm/jre to installed? eg to be used on a Gitlab runner or in AWS Codepipeline

borkdude16:12:28

It doesn't need it unless you use :deps in bb.edn or via babashka.deps/add-deps

dabrazhe16:12:32

by :deps you mean clj deps specifically?

borkdude16:12:13

what other deps?

dabrazhe16:12:05

Good question. There can be bb own deps as well, don't remember all the docs by heart : )

borkdude16:12:38

there is no distinction between bb deps or clj deps: they are both downloaded via the same tool

borkdude16:12:59

which invokes maven (JVM) or git basically

dabrazhe16:12:32

I am using :deps {medley/medley {:mvn/version "1.3.0"}} at the moment in the bb.edn. If it must have java i can probably get read of it

borkdude16:12:06

you can make an uberjar from your program

borkdude16:12:12

and then upload that

borkdude16:12:41

bb uberjar deps.jar and then use bb --classpath deps.jar ... instead

borkdude16:12:56

when you override the classpath, you won't need java anymore

borkdude16:12:22

BABASHKA_CLASSPATH=deps.jar also works

dabrazhe16:12:01

I could thanks. But ideally, no java so that I can 'sell' it to colleagues as a script : )

borkdude16:12:08

@dennisa for distribution you could also try bb uberscript script.clj

borkdude16:12:17

this will assemble a single script from your deps

borkdude16:12:17

you need to provide an entry point like bb uberscript script.clj -m foo.bar , then when executing script.clj it will execute the main function

borkdude16:12:40

but in this case, perhaps just copy pasting that function from medley keeps things a little smaller ;)

dabrazhe16:12:08

Great tip thank you!

cap10morgan20:12:28

working on writing my first pod and it made me curious if there is a "podify" clj wrapper library already out there. since it seems like you could basically examine a namespace to expose its public vars to a pod client in a fairly straightforward, generic manner (and indeed that's what I started writing)

Mno21:12:59

if you make something nice I'll make it a (mediocre) logo that looks like a bunch of peas in a pod. 🙂

❤️ 1
cap10morgan21:12:24

haha, yes!!! now I need to do it!

borkdude21:12:46

@cap10morgan The idea has come up before (I think @nate has mentioned this once) but so far nobody really implemented it I think :)

👍 1
nate21:12:28

@cap10morgan here is my in-progress library to make pod writing easier: https://github.com/justone/bb-pod-racer I use it in both of the pods I've made so far: • https://github.com/justone/tablhttps://github.com/justone/brisk Look in either main.clj for how to use the lib. Feel free to use the code as inspiration or if you'd like to add to it, let me know and we can talk about design.

👍 1
borkdude21:12:05

Thank you for looking into it

cap10morgan21:12:22

now that @hobosarefriends's logo offer is on the table the gauntlet has really been thrown down!

brazil-parrot 1
Mno21:12:40

I'll probably remake this in svg (because I shamelessly stole half of it from the internet)

💯 1
cap10morgan21:12:18

does a pod need a shutdown op if all it would do is call (System/exit 0)? i.e. will it hang the client if it doesn't do that? or is the shutdown op more for cleanup kinds of things before the client kills the pod?

borkdude21:12:40

the latter

👍 1
borkdude21:12:50

e.g. to release a database connection

borkdude21:12:03

and flush stuff to disk

cap10morgan22:12:53

what's the minimum amount of building I need to do before I can point a pod client at this thing? I assume I can't just call load-pod on a dir w/ a deps.edn and some clojure code?

borkdude22:12:17

@cap10morgan you can call load-pod like this: (load-pod ["clojure" "-M:pod"])

borkdude22:12:35

to run in development

borkdude22:12:41

If that wasn't obvious from the docs, please leave some feedback or PR an improvement to the docs

👍 1
cap10morgan22:12:13

hmm, having a hard time making that work. created an alias to run a repl that replaces all deps with just babashka.pods so I can consume the :pod alias like you showed above. but it errors out when trying to run (require '[babashka.pods :as pods]). that's most likely a problem w/ my editor / repl rather than any of your stuff though. just wanted to see if I was being dumb w/ my whole approach or not. 🙂

cap10morgan23:12:39

for some reason trying to use just babashka.pods in that alias wasn't working. :extra-deps worked, but I had to use a different ns for my code vs. the ns name I exposed to the pod client in describe. that's probably going to be a sanity-preserving thing anyway, so all good. just added -impl to the code ns.

cap10morgan23:12:31

the above makes sense b/c running (require '[code.ns]) was pulling in the actual code, not what load-pod had exposed

cap10morgan23:12:39

so having two separate namespaces helps

cap10morgan18:12:10

yeah, @U04V15CAJ whenever you have a moment, I could use a little more context on the (load-pod ["clojure" "-M:pod"]) approach. think I'm missing something simple... no rush