Fork me on GitHub
#babashka
<
2024-02-26
>
Shantanu Kumar14:02:11

Hi, I have a noob question. Is it possible to load arbitrary JAR files in Babashka classpath? Specifically, I am trying to use https://github.com/pgvector/pgvector-java

borkdude14:02:24

bb only supports using built-in Java classes, so no

Ingy döt Net14:02:26

I've been wondering how to package yamlscript for nixos. A few people have been asking for it. I don't use nix or know much about it. This weekend I talked to a friend who loves nix. I had the idea, let's see is babashka has a "flake". Of course it did. I saw that it builds from a released babashka jar file. I got feedback that it would be better if built from sources. I said that was likely hard to do but that I would ask here. Can you talk a bit about the experience of creating this flake and why it's done this way?

borkdude14:02:47

Can we please move this to #C02S1GEKU4C?

borkdude14:02:05

I don't maintain anything around nix, it's done by external maintainers

Ingy döt Net18:02:33

If bb pods were fully developed early on in the bb lifetime, would you have built-in less libs? (I just found out about pods this morning (very exciting) so forgive me if the question doesn't make sense)

borkdude18:02:10

I'm not sure if I would have left out any. Perhaps clojure.data.csv since that works from source as well. tools.cli works from source also, maybe some others. I had my doubts about transit and YAML since you can do that with a pod as well, but pods do have their downsizes as well (it's another binary to download and to maintain)

mathpunk19:02:50

This might be folly: I have this annoying workflow where I have to run a script then do one thing in a browser. Is it reasonable to try to open a browser from a command line invocation of a babashka script?

respatialized19:02:17

https://github.com/clj-commons/etaoin is bb-compatible, so I don’t see why not

🆒 1
Ingy döt Net21:02:28

re Pods. I'd like to add support for using pods from my project. Looking at https://github.com/babashka/babashka/blob/master/src/babashka/impl/pods.clj#L1-L8 Noob question but can I dep on babashka.impl.pods babashka.impl.common and babashka.pods.sci? Would I just dep on babashka/babashka "1.3.189" ?

borkdude21:02:09

don't depend on .impl namespaces. the pod docs should be what you should look at

borkdude21:02:46

.impl namespaces are not a public API and subject to change. it's fine to look at those for example and copying though

borkdude21:02:01

so in short: do not depend on babashka to use those .impl namespaces, please don't. just use babashka.pods(.sci) (public)

Ingy döt Net21:02:25

That's why I asked. 🙂 I actually started by adding the babashka.pods ns to my SCI context, I get this:

$ YS --clj -e '(println babashka.pods/load-pod)'
#object[babashka.pods$load_pod 0x4c51077d babashka.pods$load_pod@4c51077d]
$ YS --clj -e "(require '[babashka.pods :as pods])" -e "(pods/load-pod 'org.babashka/go-sqlite3 \"0.1.0\")" -c
(require '[babashka.pods :as pods])
(pods/load-pod 'org.babashka/go-sqlite3 "0.1.0")

$ YS --clj -e "(require '[babashka.pods :as pods])" -p
nil
$ YS --clj -e "(require '[babashka.pods :as pods])" -e "(pods/load-pod 'org.babashka/go-sqlite3 \"0.1.0\")"
--- hangs for at least 30 seconds before I kill it ---

Ingy döt Net21:02:58

Any idea why it hangs?

Ingy döt Net21:02:12

--clj means just use Clojure code. I ran the above code in bb without problems

borkdude21:02:24

Hard to say what's happening unless you can make (the tiniest possible) repro. Might also be helpful to look at the test suite of babashka.pods

Ingy döt Net21:02:30

can you tell me the url for the test suite?

Ingy döt Net21:02:51

I can try to make a tiny repro

borkdude21:02:34

check the pods repo, test directory

borkdude21:02:44

gotta go catch some 💤 now

Ingy döt Net02:02:01

@U04V15CAJ Here you go https://github.com/babashka/pods/issues/70 Links to a minimal repro of the problems I encountered...