Fork me on GitHub
#babashka
<
2020-05-31
>
plexus09:05:17

might be interesting for folks, this is a bb wrapper script that I've been dropping into projects as bin/bb https://github.com/lambdaisland/open-source/blob/master/bin/bb

plexus09:05:00

any babashka scripts in the project then use #!bin/bb

plexus09:05:48

@mkvlr came up with the first version of this, I added several extras like the version check bb_deps.edn, rlwrap

borkdude09:05:51

@plexus very cool. are you aware of deps.clj? with it, you can prevent doing this: https://github.com/lambdaisland/open-source/blob/336e30a529b7f50db2a998d1f9f43dfc7cc71b65/bin/bb#L95

borkdude09:05:23

since deps.clj accepts -Sdeps-file

plexus09:05:56

ah that's good to know. pretty annoying that clojure CLI won't let you ignore the local deps.edn

borkdude09:05:29

deps.clj is a port of the clojure bash script to babashka, with some extra options. it can be used as a drop in replacement to start normal JVM Clojure programs, but also babashka ones.

borkdude09:05:59

of course your current approach is fine too 🙂

plexus09:05:32

yeah I've seen that, will have a look at how best to integrate it. Would actually be great if this script didn't rely on clojure at all

borkdude09:05:14

deps.clj is self-installable: the only thing you need to do is download the script (or native executable) and have java installed. the rest will install itself. works cross-platform

borkdude09:05:00

clojure also supports CLJ_CONFIG, an alias might also work. some ideas to work with 🙂

borkdude10:05:35

Some feedback from a user comparing Python to babashka: https://github.com/borkdude/babashka/issues/457 Feel free to respond on it with your ideas of how things should be.

james42718:05:35

On the python batteries included comparison I do like this comparison of similar scripting languages by hyperpolyglot https://hyperpolyglot.org/scripting2 An extra column for bb would be a very useful resource for recruiting/orienting new users to babashka.

borkdude18:05:30

nice reference

didibus18:05:40

Am advantage of deps.clj's approach is that it works on windows. All bash script approach will struggle there otherwise.

dominicm20:05:47

bb is missing clojure.data

borkdude20:05:32

@dominicm wasn't succesful. reflection warnings in clojure.data. I'll have to make an inlined version of that:

user=> (load-file "/tmp/data.clj")
Reflection warning, /tmp/data.clj:85:39 - reference to field getClass can't be resolved.
Reflection warning, /tmp/data.clj:85:39 - reference to field isArray can't be resolved.
Reflection warning, /tmp/data.clj:87:42 - reference to field getClass can't be resolved.
Reflection warning, /tmp/data.clj:87:42 - reference to field isArray can't be resolved.
#'clojure.data/diff
and probably a patch for Clojure

dominicm20:05:06

Okay. Not a strong blocker for me. I can use set/difference for now :)

dominicm20:05:11

Just noticed it, it's a nice utility

borkdude21:05:58

@dominicm Success:

$ ./bb "(require '[clojure.data :as d]) (d/diff [1 1 2] [1 2 2])"
[[nil 1] [nil 2] [1 nil 2]]

dominicm21:05:39

Just used babashka to sync my Plex watch status to Jellyfin. Moving me from closed source media management to totally open source media :)

dominicm21:05:47

Hmm.. got most of the way through. I think we may be a little fast for the API. Thread/sleep to the rescue :)

dominicm21:05:21

How do you find the energy :)

borkdude21:05:09

I guess I'm addicted.

steveb8n21:05:07

Must be the vegan diet. The game changer

michael81921:05:45

Is turning on reflection standard at every ns level? I mean is that a standard for the clojure namespaces?

michael81921:05:40

Your patch turns on reflection warnings in that namespace but none of the clojure namespaces I looked at do that

borkdude21:05:59

Take a look at clojure.stacktrace. I did the same there. It got accepted.

michael81921:05:04

Oh nevermind clojure.datafy does

michael81921:05:25

I was just curious, that's awesome work