This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-07-06
Channels
- # announcements (4)
- # aws (1)
- # babashka (18)
- # beginners (28)
- # calva (5)
- # cider (3)
- # clerk (10)
- # clojure (49)
- # clojure-czech (3)
- # clojure-europe (19)
- # clojure-norway (6)
- # clojurescript (10)
- # cursive (44)
- # datalevin (18)
- # datomic (29)
- # dev-tooling (29)
- # emacs (1)
- # hyperfiddle (53)
- # juxt (1)
- # kaocha (2)
- # malli (5)
- # nyc (1)
- # polylith (84)
- # re-frame (1)
- # releases (2)
- # shadow-cljs (33)
- # specter (2)
hey fellow babashka folks, quick question that came up today:
image I have a folder lib
in my repo that bundles a lot of general use stuff like git.clj
, docker.clj
etc.
If I was to write a script in another folder somewhere, what would be the smartest way to include that? deps.edn
with {:local/root "../lib/git.clj}
, or if i just had a script with a shebang it would be babashka.deps/add-deps
and then require?
You can put your shared code in a folder with a deps.edn
and use it as a library with another deps.edn
or add-deps
. Same approach as a regular Clojure library
So it would be {:local/root "../lib"}
without the .clj
in the script or project that needs it. And you can use a Git dep if you want to share the code more broadly
I’m using VSCode + calva and using babashka in the jack-in sequence. How do i specify the default name space? it currently goes to clj.user
This may be related. I had the same question, though not for babashka: https://clojurians.slack.com/archives/C6QH853H8/p1688079148764219
Calva defaults to user
. Maybe the prompts looks like clj.user
? When in user
the prompt is rendered as clj:user:>
, where clj
indicates that it is a Clojure repl. Calva actually think it is a Clojure repl. There is no concept of anything else than Clojure or ClojureScript repl in Calva. We should probably fix that. But at least Babashka is very Clojure-y 😃
To make it start in some particular namespace you can use a https://calva.io/connect-sequences/ and configure afterCLJReplJackInCode
, alternatively customJackInCommandLine
. In both cases the thread that @U08JKUHA9 pointed at contains clues. I’m not sure if Babashka kan be started such that it both evaluates some expression and starts an nREPL server, but it probably can. If it can’t, then afterCLJReplJackInCode
is the way to go.
use
does not switch to that namespace, it only refers all vers into the current namespace. To switch, you write: (do (require 'mynamespace) (in-ns 'mynamespace))
Yep noticed it after i posted. My script launches a small web app and i got excited when just jacking in brought it up immediately. Next question for you is when i do bb script.clj the app starts and dies immediately unless i have @(promise) at the end. when i add the babashka.file check both modes work without issue but building an uberjar and running bb uberjar ends immediately as the babashka.file property is not available. any other property i can use that would handle those 2 scenarios? This question is not very clear :rolling_on_the_floor_laughing:
My recommendation is to write a -main
function and launch using bb -m main-ns/main-func