This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-15
Channels
- # adventofcode (2)
- # announcements (11)
- # babashka (48)
- # beginners (332)
- # calva (73)
- # cider (2)
- # clj-kondo (11)
- # cljfx (15)
- # clojure (23)
- # clojure-austin (1)
- # clojure-europe (42)
- # clojure-france (3)
- # clojure-nl (5)
- # clojure-taiwan (1)
- # clojure-uk (44)
- # clojurescript (25)
- # conjure (30)
- # cursive (3)
- # data-science (1)
- # fulcro (12)
- # jobs (3)
- # kaocha (1)
- # malli (2)
- # off-topic (49)
- # pathom (21)
- # pedestal (13)
- # re-frame (3)
- # reitit (1)
- # remote-jobs (1)
- # shadow-cljs (3)
- # sql (11)
- # startup-in-a-month (4)
- # tools-deps (113)
- # xtdb (16)
- # yada (6)
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 https://github.com/babashka/pods 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.: https://github.com/babashka/pod-registry The buddy pod may be the simplest one to look at, since it's just data back and forth, and no real state
FYI created doc ticket: https://github.com/babashka/pods/issues/28
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" ...]
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.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.
This is the issue for it: https://github.com/babashka/babashka/issues/680
@marco.pasopas That is very well possible. https://book.babashka.org/#_running_tests
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>
Environ added to projects.md: https://github.com/babashka/babashka/blob/master/doc/projects.md#environ
@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")
@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
yeah makes sense, if you are not so familiar with the Java APIs etc these libs can really help
@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")
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.pasopas No worries. Does it help when you rename (ns deps)
to (ns script.deps)
?
ah sorry, I got it..., script is added to the classpath, so everything inside that should be referred as deps.foo
without script