babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
mkvlr 2021-03-11T14:22:11.128600Z

Any preferences between the two competing babashka file watchers? https://github.com/babashka/pod-babashka-fswatcher or https://github.com/babashka/pod-babashka-filewatcher?

borkdude 2021-03-11T14:23:15.129100Z

@mkvlr They should both work.

mkvlr 2021-03-11T14:23:45.129400Z

ok, so just a preference between rust & go?

mkvlr 2021-03-11T14:23:49.129600Z

(rust)

borkdude 2021-03-11T14:24:10.130200Z

yeah

mkvlr 2021-03-11T14:25:36.131100Z

@borkdude cool, thanks. Now I’m stuck trying to figure out what the latest https://github.com/babashka/pods version is. I want to use it from the JVM

borkdude 2021-03-11T14:25:58.131800Z

I'm using the Rust one in the babashka book for watching changes: https://github.com/babashka/book/blob/master/script/watch.clj Together with etaoin to show the changes in a browser 😎

mkvlr 2021-03-11T14:26:36.132600Z

yeah, I want to do a similar thing

borkdude 2021-03-11T14:26:39.132800Z

@mkvlr I would use the pods lib as a deps.edn git dep if possible

mkvlr 2021-03-11T14:27:03.133Z

ah, makes sense

borkdude 2021-03-11T14:27:17.133300Z

if you want to do something similar, fwiw, the above is done using bb

mkvlr 2021-03-11T14:45:32.133600Z

but it should work in the jvm the same way?

mkvlr 2021-03-11T14:45:57.133900Z

not getting anything back from fw/watch

borkdude 2021-03-11T14:47:09.134100Z

should work yes, let me try

mkvlr 2021-03-11T14:50:01.134500Z

looking for a way to stop the watch again

mkvlr 2021-03-11T14:51:00.134900Z

I’m watching a file, not a while dir (in case that makes a difference)

mkvlr 2021-03-11T14:51:18.135100Z

still getting nil back with a dir

borkdude 2021-03-11T14:53:06.135300Z

@mkvlr

$ clj
Clojure 1.10.1
user=> (require '[babashka.pods :as pods])
nil
user=> (pods/load-pod 'org.babashka/filewatcher "0.0.1")
#:pod{:id "pod.babashka.filewatcher"}
user=> (require '[pod.babashka.filewatcher :as fw])
nil
user=> (fw/watch "/tmp" prn)
nil
user=> (spit "/tmp/foo.txt" "hello")
nil
user=> {:path "/private/tmp/foo.txt", :type :create}

mkvlr 2021-03-11T14:54:18.136200Z

@borkdude sorry I wasn’t clear: I am getting notifications, but no return value from fw/watch (like you) to stop the watch again

mkvlr 2021-03-11T14:54:30.136500Z

I guess that only works in the go version? https://github.com/babashka/pod-babashka-fswatcher#usage

borkdude 2021-03-11T14:55:28.137300Z

ah yes, that's true. this was an issue with the Rust version: I couldn't figure out how to keep a global list of watchers, etc. This is supported in the go one

borkdude 2021-03-11T14:55:46.137700Z

but in Rust I now figured it out as well, so might be supported there too one day.

borkdude 2021-03-11T14:56:24.138100Z

The go pod's API might still change, so use with caution when upgrading: https://github.com/babashka/pod-babashka-fswatcher/issues/10

borkdude 2021-03-11T14:56:47.138600Z

The name of unwatch will probably changed to stop in the future

👍 1
mkvlr 2021-03-11T14:57:42.139100Z

and the brew install is optional, right?

borkdude 2021-03-11T14:57:53.139500Z

yeah

mkvlr 2021-03-11T14:57:55.139600Z

I mean loading the pod is enough

borkdude 2021-03-11T14:57:59.139900Z

correct

mkvlr 2021-03-11T14:58:14.140200Z

alright, all working with the go version, thank you!

borkdude 2021-03-11T15:00:49.140900Z

btw, there is also pods/unload-pod which will accept the return value from load-pod, to tear down the pod itself. this might have worked with the Rust one as well

borkdude 2021-03-11T15:01:26.141500Z

you will need to call load-pod again and also reload the namespaces associated with it, if you want to use it again (I think)

👍 1
borkdude 2021-03-11T18:48:14.143Z

CircleCI has granted me linux arm64 access, so I guess we'll have raspberry binaries hopefully soon :)

🚀 7
🎉 7
grazfather 2021-03-11T19:25:44.148600Z

raspberry pi still runs on 32 bit mode by default 🙂

borkdude 2021-03-11T19:26:20.149300Z

yeah, only 64bit will and can be supported for now

grazfather 2021-03-11T19:26:46.149900Z

I just happen to freshly be aware of it since I wanted BB for my pi already

pavlosmelissinos 2021-03-11T19:35:49.152600Z

FYI, I just tried to install babashka on a Synology NAS but the official install script doesn't work... DSM, Synology's OS, doesn't have a proper package manager and so unfortunately unzip can't be installed without going through hoops. For some peculiar reason it does have 7z though, so changing https://github.com/babashka/babashka/blob/39284ae707451d59bf7eedc46bbd42a948511d14/install#L75 to 7z x "babashka-$version-$platform-amd64.zip" seems to fix the problem. I understand I'm in a niche minority but is there a chance this could somehow be added to the README?

borkdude 2021-03-11T19:36:26.153100Z

@pavlos is tar.gz better for this platform?

pavlosmelissinos 2021-03-11T19:36:53.153500Z

Ah, not sure, let me check

borkdude 2021-03-11T19:37:11.154Z

but if you do have 7z then sure, let's add it to the README

pavlosmelissinos 2021-03-11T19:38:11.154800Z

tar is installed as well and it's more ubiquitous, so maybe it's a better choice indeed

borkdude 2021-03-11T19:38:11.154900Z

@pavlos Even better, we can make the script detect unzip or 7z and handle it that way ;)

borkdude 2021-03-11T19:38:58.155400Z

I think it might be breaking if we switch to targz now

grazfather 2021-03-11T19:39:20.155800Z

I actually hit the unzip error

grazfather 2021-03-11T19:39:40.156300Z

I was trying to install bb into a docker container and the ubuntu base image doesn’t start with unzip, but does have targz

grazfather 2021-03-11T19:40:00.157Z

might be better to detect tar vs unzip and download the appropriate file AFTER that’s determined?

borkdude 2021-03-11T19:40:10.157300Z

ok, let's use tar gz then, for Windows I think zip is more used

🙏 2
grazfather 2021-03-11T19:40:19.157600Z

certainly

borkdude 2021-03-11T19:40:23.157900Z

feel free to post an issue and fix the circleci stuff

borkdude 2021-03-11T19:41:12.158700Z

and also change the installer script (for next release). I think it would be best if the bash script does unzip or tar gz based on the extension, so it can still install older versions

grazfather 2021-03-11T19:41:36.158900Z

I will show a PR with my idea

grazfather 2021-03-11T19:52:33.159400Z

oh, you don’t release as tgz 😞

borkdude 2021-03-11T19:53:50.159900Z

my proposal is that we can switch to tgz but the script also needs to support installing older versions

grazfather 2021-03-11T19:53:58.160200Z

yep, I understand now

grazfather 2021-03-11T19:56:24.160500Z

nice trick: tar works on .zip

borkdude 2021-03-11T19:56:55.160700Z

huh...?

grazfather 2021-03-11T19:57:19.161Z

[g ~/xx] $ tar xvf babashka-0.2.13-macos-amd64.zip
x bb
[g ~/xx] $ file *.zip
babashka-0.2.13-macos-amd64.zip: Zip archive data, at least v2.0 to extract

1
borkdude 2021-03-11T19:58:00.161200Z

but does it work ?

borkdude 2021-03-11T19:58:08.161500Z

bb after extraction?

grazfather 2021-03-11T19:58:16.161800Z

of course

grazfather 2021-03-11T19:58:38.162300Z

of course maybe not all versions of tar can do this

borkdude 2021-03-11T19:58:49.162600Z

is there a minimum tar version which supports this?

grazfather 2021-03-11T19:58:55.162900Z

that part I Don’t know

pavlosmelissinos 2021-03-11T20:04:59.165700Z

doesn't work on DSM (tar v1.28):

$ tar xvf babashka-0.2.13-linux-amd64.zip
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Exiting with failure status due to previous errors
nor fedora 33 (tar v1.32, same error as above)

2021-03-11T22:07:52.169600Z

I’m trying to import a package from a jar that I have locally. I used add-classpath to add the jar to class-path, but on import I get Unable to resolve classname. I have verified that the classes I’m importing are in the jar and I’ve printed get-classpath and verified that the jar is there. What can I be missing?

2021-03-11T22:08:56.170Z

The jar was made from a java project if that matters

borkdude 2021-03-11T22:23:05.170600Z

@hkjels Babashka isn't able to load arbitrary Java classes. It can only execute (a subset of) Clojure source code and classes that are already in the native-image.

borkdude 2021-03-11T22:23:21.171Z

Unless we add those classes to the babashka native image

2021-03-11T22:24:19.171800Z

Ahh, OK. Thanks