Fork me on GitHub
#babashka
<
2023-05-27
>
pesterhazy09:05:29

Hi! We talked about this before, but I don't remember what the resolution was. Should babashka.process/shell respect *defaults*?

user=> (binding [babashka.process/*defaults* (assoc-in babashka.process/*defaults* [:env "ENVVAR"] "a")] (:out @(babashka.process/process {:out :string} "bash" "-c" "echo $ENVVAR")))
"a\n"
user=> (binding [babashka.process/*defaults* (assoc-in babashka.process/*defaults* [:env "ENVVAR"] "a")] (:out @(babashka.process/shell {:out :string} "bash" "-c" "echo $ENVVAR")))
"\n"
I was expecting the same result bb v1.3.179

borkdude09:05:19

Yes it’s fixed on master. I’ll probably release this week a new bb

pesterhazy09:05:38

Cool cool cool!

pesterhazy09:05:16

This would be useful for $SECRET_BB_PROJECT

fjsousa09:05:32

I'm installing a pod in a docker image: RUN /usr/home/codecan/bin/bb "(babashka.pods/load-pod 'tzzh/mail \"0.0.2\")" and it's ending up in /root/.babashka/... do I have any level of control over where the .babashka folder is created automatically?

borkdude09:05:56

Yes there is an env var for this, I think it’s in the README of the pods project, I can look it up later for you if I’m back at the kbd

👍 2
fjsousa10:05:00

I'll look it up

fjsousa10:05:00

In https://github.com/babashka/pods/blob/master/README.md couldn't find anything to setup up the path that load-pods is using do download pods

borkdude10:05:43

sorry that it's not documented, PR welcome I guess

fjsousa14:05:35

that did the trick

Kent Bull17:05:26

Is Babashka limited in which libraries it supports? I’m getting a Unable to resolve classname: com.moandjiezana.toml.Toml while trying to use a TOML parser library https://github.com/ilevd/toml with bb.edn: {:deps {toml/toml {:mvn/version "0.1.4"}}} and my toml library usage of :

(require '[toml.core :as toml])

(defn get-pyproject-toml-version []
  (toml/read (slurp "pyproject.toml")))

borkdude17:05:26

Yes, bb does not support using non-standard Java classes

👍 2
borkdude17:05:16

Perhaps it's possible to make a babashka pod around toml https://github.com/babashka/pod-registry

borkdude17:05:32

Or write the thing from scratch

borkdude17:05:06

You might also be able to use the BNF grammar (https://github.com/toml-lang/toml/pull/236) and instaparse-bb

Kent Bull18:05:54

That would be really cool.

Kent Bull18:05:08

This guy wrote a 30 line TOML parser I’m using:

Kent Bull18:05:00

It doesn’t work for arrays split over multiple lines yet, so I’d have to fix it. I haven’t tried loading a grammar into instaparse-bb yet. Sounds like a fun challenge.

Kent Bull18:05:57

I barely took my first compilers class this January so I didn’t understand what a grammar is good for until then.

👍 2