This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-23
Channels
- # announcements (2)
- # atom-editor (3)
- # babashka (49)
- # beginners (100)
- # biff (9)
- # calva (78)
- # clj-kondo (18)
- # clojure (143)
- # clojure-europe (13)
- # clojure-germany (1)
- # clojure-nl (2)
- # clojure-spec (5)
- # clojure-sweden (2)
- # clojure-uk (4)
- # clojurescript (58)
- # conjure (1)
- # cursive (4)
- # datascript (11)
- # datomic (63)
- # docker (7)
- # emacs (18)
- # events (1)
- # fulcro (18)
- # graalvm (5)
- # helix (4)
- # improve-getting-started (13)
- # jobs (4)
- # jobs-discuss (3)
- # lsp (15)
- # malli (90)
- # membrane (14)
- # off-topic (12)
- # other-languages (5)
- # pedestal (7)
- # polylith (53)
- # re-frame (15)
- # reitit (23)
- # releases (4)
- # remote-jobs (9)
- # ring (11)
- # shadow-cljs (90)
- # specter (2)
- # testing (3)
- # tools-build (63)
- # vim (2)
- # xtdb (8)
I might have found an issue ?! Running this (as seen in example https://book.babashka.org/#tasks:clojure )
test {:doc "Runs backend tests"
:task (clojure {:dir "../bases/app"} "-J-Dclojure.main.report=stderr -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")
it works with (clojure {:dir "../../bases/app"} "-J-Dclojure.main.report=stderr -M:backend:test")
aa, here it was ๐ https://book.babashka.org/#_interacting_with_an_nrepl_server
I'm back to playing with https://github.com/babashka/nrepl-client 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.
@ all: I'm developing a zip
function for babashka.fs :
https://github.com/babashka/fs/commit/0222dba20f9babc032f79c2c0c008471f164ec28
It's largely based off the code in tools.build but it resembles unix zip
more:
zip /tmp/out2.zip src README.md
=>
(fs/zip "/tmp/out2.zip" ["src" "README.md"])
Also within the zip the src
dir is preserved whereas tools.build flattens the src-dirs into the zip. So src/babashka
will be babashka
in the zip in tools.build but with fs/zip
it remains src/babashka
. These are trade-offs to make. I'd like your input on this! ๐งตHm, it seems
shutil.make_archive(output_filename, 'zip', dir_name)
does flatten the directoryI made an issue here: https://github.com/babashka/fs/issues/41 Please discuss there.
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
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 java.util.zip
in bb before and how did you use this? This should inform the API of that new function. Issue here:ย https://github.com/babashka/fs/issues/41
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
(http://eradman.com/entrproject/ 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
/home/teodorlu/.local/bin/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/smallid.py
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 :)
$ bb -e '(str (fs/real-path (fs/which "clojure")))'
"/usr/local/Cellar/clojure/1.10.3.1058/bin/clojure"
Nice! More to learn ๐ I suspect I'll write some ugly shelling before catching onto idiomatic solutions.
@jayzawrotny No HTML parsers from source or built-in. Bootleg is one that's used a lot but that is a pod.
Thanks. A friend was asking in a discord, I recommended nbb to him but doesn't sound like it would fit either.
Just use bootleg, it's great. https://github.com/babashka/pod-registry/blob/master/examples/bootleg.clj
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: https://github.com/babashka/pod-registry
> 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?