Fork me on GitHub

I might have found an issue ?! Running this (as seen in example )

test {:doc  "Runs backend tests"
               :task (clojure {:dir "../bases/app"} " -M:backend:test")}
give me :
bb test 
----- Error --------------------------------------------------------------------
Type:     java.lang.IllegalArgumentException
Message:  'other' is different type of Path
Location: 20:11

----- Stack trace --------------------------------------------------------------
borkdude.deps/relativize    - <built-in>
borkdude.deps/-main         - <built-in>
clojure.core/apply          - <built-in>
babashka.deps/clojure       - <built-in>
babashka.impl.tasks/clojure - <built-in>


Can you post an issue about this? A workaround could be:

(shell {:dir "../bases/app"} "bb clojure -J-D.... -M:backend:test")


another workaround:

{:dir (fs/absolutize "../bases/app"}}


thanks, the issue was the path was wrong


I should have seen a file not found exception or something similar


it works with (clojure {:dir "../../bases/app"} " -M:backend:test")


should I still open an issue ?


aaah ok. issue still welcome for better error msg


I think so ...


using bb 0.7.4


mmmm, remember seeing somewhere a snippet in bb to run nrepl client


I'm back to playing with and using it for some slightly more advanced function calls from my tasks. I wonder if there's currently any way to avoid writing the expression as a string and instead working with code, and then stringifying that code. If I just do something like (str '(+ 1 2)) the quoted form isn't getting linted but at least there is syntax highlighting and code navigation is available. Is there some way to improve it more?


I'm not actively developing this at the moment, but feel free to post issues + PRs :)


Understood, thanks. It's been so far so good. I've been using it for running project tasks through bb tasks and there hasn't been much to complain about aside from the ergonomics of it.


Issues welcome :)

๐Ÿ‘ 1

@ all: I'm developing a zip function for babashka.fs : It's largely based off the code in but it resembles unix zip more:

zip /tmp/ src
(fs/zip "/tmp/" ["src" ""])
Also within the zip the src dir is preserved whereas flattens the src-dirs into the zip. So src/babashka will be babashka in the zip in but with fs/zip it remains src/babashka. These are trade-offs to make. I'd like your input on this! ๐Ÿงต


Also, please take that branch for a local spin


Hm, it seems

shutil.make_archive(output_filename, 'zip', dir_name)
does flatten the directory


I made an issue here: Please discuss there.

๐Ÿ‘ 1

can I use clojure.core.reducers in bb? I'm thinking if I have some easy ways to make my script faster in some transduction part


it's not included at the moment


clojure.core.reducers is 95% subsumed by transducers


the only thing c.c.reducers has that hasn't been replicated anywhere else is the Fork Join / fold stuff


ah that's interesting. Yea I was thinking about the fork join stuff. I guess there is some way to transduce parallel? - the use case is basically reduce xform coll .


Let me phrase the above question differently. Have you shelled out to zip or implemented your own zip function based on in bb before and how did you use this? This should inform the API of that new function. Issue here:ย


Wrote a tiny bb script, amazed at how good + easy it was to get going. Read the book, and had a tiny file watcher running while I developed:

find .local/bin | entr -rc which+ smallid
( is awesome). Good error messages, and totally weird not to have to worry about the REPL. The script essentially helps me find stuff I've symlinked, reducing two commands to one:
which+ smallid

$ which smallid

$ ls -l $(which smallid)
lrwxrwxrwx 1 teodorlu teodorlu 49 2022-02-14 17:04 /home/teodorlu/.local/bin/smallid -> /home/teodorlu/kb/setup/python-scripts/


Awesome :) Note that babashka.fs also has a which function and also has a function to detect if something is a symlink and to resolve the symlink. So there's in fact no need to shell out to bash :)

๐Ÿ’ฏ 2

$ bb -e '(fs/sym-link? (fs/which "clojure"))'


$ bb -e '(str (fs/real-path (fs/which "clojure")))'


Nice! More to learn ๐Ÿ™‚ I suspect I'll write some ugly shelling before catching onto idiomatic solutions.


That's totally fine

clojure-spin 1
eccentric J22:02:10

Any HTML parsing libs that are compatible with bb and don't require pods?


@jayzawrotny No HTML parsers from source or built-in. Bootleg is one that's used a lot but that is a pod.


You can also use #nbb for this obviously :)

eccentric J22:02:48

Thanks. A friend was asking in a discord, I recommended nbb to him but doesn't sound like it would fit either.

eccentric J22:02:19

Allegedly pods are off the table for them. Don't know much about their project: > rushsteve1 โ€” Today at 5:07 PM > Unfortunately I can't really use pods (I'm trying to use bb to fix my > whole cross-compiling issue) > nbb seems interesting, but I'm not sure if I can use Node either


you don't need to cross-compile yourself to use pods, they are already compiled and even download automatically


here's the registry of pods that are ready to be used:

eccentric J22:02:06

Sounds like they're looking for something more along the lines of jsoup

eccentric J22:02:44

> rushsteve1 โ€” Today at 5:21 PM > I have yet to find one that supports aarch64 OOTB. Looking at the Jsoup on in the link you sent it seems like you also need GraalVM to compile it too. > I have the same problem with the SQLite pod


Not all pods work on aarch64 because I usually only do that when people ask for it, but it can be done.


@U1QQJJK89 Perhaps bootleg (pod) can be exposed as aarch64 as well?


E.g. the aws pod does work on aarch64 out of the box.


But of course they could also just use the JVM. I'd also recommend Jsoup