Fork me on GitHub

hello!, is there a guide on how to create a Pod? for example, it’s not clear to me why some pods are written in other languages and how to get one simple “hello-pod” program up and running with Babashka


@sdmoralesma The docs are available at A hello world pod would be nice to add to the docs. Feel free to create an issue about this. But there are already many clojure examples available, see.: The buddy pod may be the simplest one to look at, since it's just data back and forth, and no real state

❤️ 3

Some pods are written in other languages, because low level stuff like file system events are better done in golang or Rust. Some things simply didn't work with GraalVM, like sqlite, so that's why its in golang.


One dev tip: you can test the pod first on the JVM using the pod library and/or starting it via ["clojure" "-M" "-m" ...]


and if it works, then you can try compiling it to native


great!, thank you @borkdude

Marco Pas11:01:05

Being fairly new to Clojure and Babashka i was wondering how to manage external dependencies. For example if i want to use the environ package i now have this line in my script.

(babashka.deps/add-deps '{:deps {environ/environ {:mvn/version "1.2.0"}}})
(require '[environ.core :refer [env]])
I have another script that also needs this dependency then i need to copy and paste these lines. I read something about a deps.edn file but i am not sure how i can use this to download and use dependencies in my scripts and also being able to use them in my nrepl-server from babashka. Any pointers would be helpfull!!


Oh wow, environ works with bb :)

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

(babashka.deps/add-deps '{:deps {environ/environ {:mvn/version "1.2.0"}}})

(require '[environ.core :refer [env]])

(prn (:path env))
Nice find @marco.pasopas :)

Marco Pas11:01:10

Not making fun of me 🙂 🙂


No, I am serious


haven't tried that lib with bb before :)

Marco Pas11:01:52

Just added it yesterday and sofar no problems..


@marco.pasopas So what you can do is add some namespaces to the classpath:

(babashka.deps/add-classpath "script")
(require 'script.deps)
and then move your common deps to script/deps.clj


There is no deps.edn or config.edn like file for bb yet. This is something I'm considering, but not there yet.

Marco Pas11:01:42

Thanks for the pointer! Will try it out..

Marco Pas11:01:10

Next thing on my things i want to do with Babashka is unit testing 🙂


I am not sure if bb should use deps.edn itself (or maybe an alias :org.babashka) or that it should have a separate config file, or maybe even a __bb_setup__.clj script that's always run. Feel free to provide feedback in issue 680.




It could be nice to have a .clj file for flexibility and not couple it with deps.edn too much. </hammock>


@marco.pasopas Btw, I don't think environ adds much for bb except that it reads all envs vars in a nice clojure map. Usually I just use (System/getenv "FOO_BAR")

Marco Pas12:01:28

@borkdude I agree! In my way to search for a lib that would enable me to set properties using envrionment variables and files i came across this one

Marco Pas12:01:06

Just am trying to wrap my head around the clojure world and also babashka


yeah makes sense, if you are not so familiar with the Java APIs etc these libs can really help

Marco Pas13:01:59

@borkdude The code

(babashka.deps/add-classpath "script")
(require 'script.deps)
Does the .deps package has a add-classpath?


@marco.pasopas no, this is in (babashka.classpath/add-classpath "script")


sorry, I made a typo earlier

Marco Pas13:01:40

No problem 🙂 thought it was my mistake 🙂

Marco Pas13:01:47

Newbie question 🙂


but you can also do this in one go with add-deps: {:paths ["script"]} :deps ...}


it just takes the contents of a deps.edn file basically


If you scroll back to January 12th there is a discussion about this

Marco Pas13:01:35

So i have created a file called script/deps.clj

(ns deps)

(require '[babashka.deps :as deps])
(babashka.deps/add-deps '{:deps {environ/environ {:mvn/version "1.2.0"}}})
(require '[environ.core :refer [env]])
In my main script…
(babashka.classpath/add-classpath "script")
(require 'script.deps)
Get an error: :message "Could not find namespace: script.deps.

Marco Pas13:01:20

My problem i guess with not getting clojure that good:)


@marco.pasopas No worries. Does it help when you rename (ns deps) to (ns script.deps) ?


I will try locally

Marco Pas13:01:09

I am trying to execute it against a repl


ah sorry, I got it..., script is added to the classpath, so everything inside that should be referred as without script


(require '[babashka.classpath :as cp])
(cp/add-classpath "script")
(require 'deps)


and (ns deps) should stay that way


you can also add the current dir "." to the classpath, and then you could require it as (require 'script.deps) with (ns script.deps)

Marco Pas14:01:46

Gonna give a try! Thanksfor the help!!!!!!!