Fork me on GitHub
Ory Band12:08:00

Hi. I'm currently using a Makefile in combination with Docker Compose to automate launching multiple applications for integration tests. Make allows launching apps in order while also running simple code between them, for example sleeping or polling if an app has already launched before proceeding to launch the next one in order. For example: Launch MongoDB and RabbitMQ in parallel, wait for both of them to initialize, then populate fixtures in both, then launch an application which depends on them. I think bb task runner can replace it and I'm looking for examples for something similar. Questions: 1. Is this a good idea? Specifically what I care to get out of this is to minimize code and make it more cross platform (Linux and OSX). Also make it a bit more readable as Makefils tend to become spaghetti targets with lots of switches e.g. .PHONY everywhere etc 2. Any examples that resemble Makefile as a task runner? (not for compiling deps)

Ory Band13:08:26

very handy! it's the primary thing i'm doing between targets

Ory Band13:08:38

thanks for the link

Ory Band13:08:11

can i get an honest objective-as-possible opinion if it is a good idea to migrate away from Make? It's either gonna be stay on Make, move to bb task runner, or just

Ory Band13:08:23

i know you're biased, but give it a shot 😉


Well, I wrote babashka tasks as the Clojure answer to Make :)


You get all the expressivity of Clojure , so you don't even have to use the features of the task runner, but can just write a couple of functions and call those from the task runner

Ory Band13:08:30

what about comparing this to just? it looks spot on to this kind of thing. only disadvantage is that it's on rust. not a really important reason since i'm only using it and not developing anything


I would say read the documentation at or watch my talk on it and then make your own judgements


Make and Just are fine, but I like Clojure

Ory Band13:08:19

(i've read that before coming here, was still contemplating)


Of course there's other people in this channel too, so I'll let them reply here for less biased opinions ;)


My 2c: yes, you can even use Make for that, but Compose has a couple of features that you won't get easily with just bb + Docker: health checks, dependent services, networking that actually semi-works on macOS. Nothing is stopping you to use bb tasks to call Compose, but you might find yourself reinventing half of what it does (speaking from my experience, I tried to do exactly that some time ago)


Hello! Is there a JSON validation library that is compatible with babashka? I tried out but unfortunately it depends on Java classes that are unavailable (e.g. org.json.JSONObject).


@pavlos Not that I know of but you could convert the JSON to EDN and then use malli or schema?


Or you can use #nbb (node.js) which can be used with any npm library


Oh, both are good ideas. I think I'll try nbb out, thanks a lot! 🙂


Would it be a lot of work bumping to the latest etaoin version? I had a look myself, would be willing to do a PR, but did not immediately understand what everything does in the pod code.


@ingesol There's a much better solution now: etaoin itself is compatible with #babashka now :)


I'd be happy to bump things in the pod, but I think it will be deprecated in favor of the source lib sooner than later


oh, I’m a babashka noob so I thought the pods were required to make things happen


so I suppose this is the things to use then?


@ingesol etaoin docs for bb: this is all very recent, so I'm not surprised you missed this at all


excellent, thanks! I actually already saw that, but still thought pods were required in addition 🙂

Ethan Miller21:08:40

I have a little data processing script that uses the tech stack ( & tablecloth). I am using a deps.edn so I added the bb.edn with {:deps {local/deps {:local/root "."}}}. When I then ran the file from the project root like bb src/main.clj, I got an “Unable to resolve classname” error for something within tech.v3.datatype, one of’s dependencies:

----- Error --------------------------------------------------------------------
Type:     java.lang.Exception
Message:  Unable to resolve classname: org.apache.commons.math3.exception.NotANumberException
Location: tech/v3/datatype/errors.clj:4:3

----- Context ------------------------------------------------------------------
1: (ns tech.v3.datatype.errors
2:   "Generic, basic error handling.  No dependencies aside from apache commons math
3:   for NAN exception."
4:   (:import [org.apache.commons.math3.exception NotANumberException]
     ^--- Unable to resolve classname: org.apache.commons.math3.exception.NotANumberException
5:            [java.util NoSuchElementException]))
8: (defmacro throwf
9:   "Throw an exception and format a message"

----- Stack trace --------------------------------------------------------------
tech.v3.datatype.errors   - tech/v3/datatype/errors.clj:4:3
tech.v3.datatype.dispatch - tech/v3/datatype/dispatch.clj:2:3
tech.v3.datatype-api      - tech/v3/datatype_api.clj:3:3
tech.v3.datatype          - tech/v3/datatype.clj:4:3
tablecloth.api            - tablecloth/api.clj:4:3
main                      - /Users/emiller/Projects/cts-tagging/src/main.clj:4:3
Any one have any insight as to whether this is because I’ve done something wrong?

Ethan Miller21:08:07

My deps.edn looks like:

{:paths ["src" "resources"]
 :deps {org.clojure/clojure {:mvn/version "1.10.3"}
        scicloj/tablecloth {:mvn/version "6.090"}
        io.github.nextjournal/clerk {:mvn/version "0.9.513"}}}


@U3RGL6XNF bb only supports a preselection of Java classes and can't run any other Java classes - so it's more limited than Clojure JVM

Ethan Miller21:08:27

Ahhh that explains it. Thanks.


Hi 🙂 What's your motivation for using bb? Faster startup? Something else? Lots (all? most?) of babashka's nicities (babashka fs, babashka tasks, babashka cli) can be used from JVM Clojure. For example, it's possible to use babashka/cli for CLI argument parsing in a JVM application. bb tasks can easily dispatch to JVM Clojure functions, utilizing babashka/cli to turn bb mytask :message hello into (com.myns/myfunc {:message "hello"})

👀 1
Ethan Miller15:08:21

@U3X7174KS Hi! And thanks for asking. Actually, I had just written a tiny script to do a simple data task for work and since my team doesn’t use Clojure I was trying to sneak it in and make it very easy to run. I’m so inexperienced with actually making Clojure usable ’cause I never get to use it for work so I wasn’t sure what to do. I was hoping to just be able to allow them to run a single command without doing much install and without modifying the code to use a main function.

👍 1
Ethan Miller16:08:47

So basically I have a directory with a deps.edn and then a script src/main.clj . main.clj loads a csv from disk and then processes it. I just want to make it runnable in the easiest possible way.

👍 1
Ethan Miller16:08:00

I guess I may just be able to use clj -X src/main.clj

👍 1

In that case, clj -X seems like a good option :) It's also possible to have a single clojure file that uses dependencies. Here's an example:


Is it unrealistic for to be loadable and usable via babashka? Currently I run into:

Unable to resolve classname: java.util.TimeZone
which had me looking around in: Does TimeZone require reflection or somesuch, or is it just missing?


A bit more context:

----- Error --------------------------------------------------------------------
Type:     java.lang.Exception
Message:  Unable to resolve classname: java.util.TimeZone
Location: cognitect/aws/util.clj:11:3

----- Context ------------------------------------------------------------------
 7:             [ :as xml]
 8:             [ :as json]
 9:             [ :as io]
10:             [clojure.core.async :as a])
11:   (:import [java.text SimpleDateFormat]
      ^--- Unable to resolve classname: java.util.TimeZone
12:            [java.util Date TimeZone]
13:            [java.util UUID]
14:            [ InputStream]
15:            [java.nio.charset Charset]
16:            [ MessageDigest]

----- Stack trace --------------------------------------------------------------    - cognitect/aws/util.clj:11:3  - cognitect/aws/client.clj:6:3
aws-api-util.core     - aws_api_util/core.clj:3:3
aws-api-util.redshift - aws_api_util/redshift.clj:2:3
user                  - /private/tmp/./redshift:7:1


@U0E2268BY Check out which is a re-make of cognitect aws-api for bb


or should I say …. awyeah

😎 5