This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-08
Channels
- # announcements (1)
- # babashka (39)
- # beginners (44)
- # clj-kondo (10)
- # cljdoc (24)
- # clojure (49)
- # clojure-austin (2)
- # clojure-berlin (6)
- # clojure-europe (13)
- # clojure-nl (1)
- # clojure-norway (5)
- # clojure-uk (1)
- # core-async (11)
- # cursive (7)
- # datahike (3)
- # datalevin (2)
- # fulcro (1)
- # hyperfiddle (40)
- # jobs (12)
- # juxt (5)
- # lsp (9)
- # nyc (1)
- # off-topic (27)
- # re-frame (7)
- # releases (3)
- # shadow-cljs (9)
- # timbre (6)
- # xtdb (2)
- # yamlscript (1)
Nice blogpost about a script written in bb by @nate! https://endot.org/2023/08/07/highlight/
I'm trying to recursively list all :local/roots
deps using babashka and the https://github.com/babashka/tools-deps-native pod. However I can't work out how to resolve the deps all the way down the tree, which makes me feel like maybe I am using the terminology wrong. E.G when I do:
(require '[ :as io])
(require '[babashka.pods :as pods])
(pods/load-pod 'org.babashka/tools-deps-native "0.1.0")
(require '[clojure.tools.deps :as deps])
(prn (deps/resolve-deps (:deps (deps/slurp-deps (io/file "deps.edn"))) {}))
The printed out result does not have the recursive dependencies of the projects in those dependencies. Is there an easy way to get them?perhaps try to repro with tools.deps on the JVM first, if it behaves the same I think it's a #C6QH853H8 question, if not, then we can see why it behaves differently
i guess i'm a bit confused what the org.babashka/tools-deps-native
pod is doing — it doesn't seem to be providing all of tools.deps, right?
the tools-deps-native pod wraps tools.deps indeed. and it offers support for https://github.com/babashka/tools.bbuild which is tools.build made compatible with babashka, this uses the pod
I don't know if tools-deps-native offers ALL of tools.deps, but it does offer what is used by tools.bbuild
gotcha. I had tried (require '[clojure.tools.deps.tree :as deps.tree])
to find out it wasn't provided, so I assumed that somewhere there's a subset being defined — I just don't know how to read that code though
oh wow lol I updated to 0.1.1 and now deps/create-basis
works and I can see the subdeps
Is there a bb-compatible elisp parser?
I don't think so, but perhaps you can just use edamame? since elisp is basically just s-expressions without weird notation... right?
there is a clj 2 elisp compiler toy project here: https://github.com/borkdude/clj2el
This worked for parsing my home config at least:
(e/parse-string-all (slurp "/Users/borkdude/.emacs.d/personal/init.el") {:all true})
I’m looking to create a babashka script that: 1. Opens an ssh tunnel to a remote (jump) host 2. Establishes a mysql connection over that tunnel (essentially to 127.0.0.1:3306) 3. Do SQL stuff 4. Close everything down Searching a bit in this channel, it’s not quite clear to me what the preferred approach to to this would be for the SSH part?
Perhaps https://github.com/epiccastle/bbssh would help?
Aha, ok that does look like it’s what I want. Will confirm back.
@UCK2PHQ59 Confirmed. This works just fine and is easy to manage.
anybody using bb to drive k8s api? tried https://github.com/nubank/k8s-api/tree/master but failed on loading less-awful-ssl with unable to resolve classname java.security.Key
we could try to add this class, but it would be best to try with a local copy of babashka and run it through a JVM to see what other classes are missing
hmm, looking at https://github.com/aphyr/less-awful-ssl/blob/master/src/less/awful/ssl.clj they are using quite a few
FYI, I created a simple library to mimick Babashka in the Clojure repl https://github.com/jeroenvandijk/babashka-clj
If you are relying on people to use clojure 1.12 I'd recommend that you would shell out to babashka and call bb print-deps
which prints built-in dependencies AND dependencies from bb.edn
and add that dynamically to your REPL
hmmm yeah I’ll give that a try too. The deps are generated with bb print-deps
btw (https://github.com/jeroenvandijk/babashka-clj/blob/main/dev/src/generate.cljc#L23). One argument against shelling out is that the bb dependencies might change overnight. But depends of course, if you want to be in sync with Babashka this might be the better option
isn't the point that you would run the script with bb in the end? then it would be better to discover those dep changes sooner than later I guess
I would get a bit paranoid if it doesn’t work after an update and it’s not clear that it is because of an update of Babashka, but yeah maybe. I’m just getting this library out the door after a few times copy pasting the deps. Not sure what I’ll like better yet
user=> (require '[clojure.repl.deps :as repl-deps])
nil
user=> (require '[clojure.java.process :as proc])
nil
user=> (def bb-edn-deps (clojure.edn/read-string (proc/exec "bb" "print-deps")))
#'user/bb-edn-deps
user=> (repl-deps/add-libs (:deps bb-edn-deps))
...
user=> (require '[babashka.fs :as fs]) ;; works!
user=> (require '[clojure.repl.deps :as repl-deps])
nil
user=> (require '[clojure.java.process :as proc])
nil
user=> (def bb-edn-deps (clojure.edn/read-string (proc/exec "bb" "print-deps")))
#'user/bb-edn-deps
user=> (repl-deps/add-libs (:deps bb-edn-deps))
...
user=> (require '[babashka.fs :as fs]) ;; works!
I’m looking for a bcrypt solution for hashing a password that works in babashka. Any thoughts?
either use the builtin crypto Java classes or if they aren't available, try the buddy pod
Ok, thanks for the pointer.