This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-04-18
Channels
- # babashka (12)
- # beginners (35)
- # biff (6)
- # calva (23)
- # cider (7)
- # clj-kondo (10)
- # cljs-dev (15)
- # clojure (81)
- # clojure-dev (2)
- # clojure-europe (13)
- # clojure-germany (1)
- # clojure-korea (2)
- # clojure-nl (1)
- # clojure-norway (19)
- # clojure-uk (7)
- # clojurescript (23)
- # core-typed (33)
- # cursive (7)
- # data-science (7)
- # datalevin (9)
- # hyperfiddle (1)
- # introduce-yourself (2)
- # malli (1)
- # matrix (17)
- # missionary (24)
- # music (1)
- # off-topic (15)
- # polylith (6)
- # reagent (10)
- # releases (5)
- # remote-jobs (1)
- # shadow-cljs (3)
- # squint (7)
- # xtdb (11)
- # yamlscript (6)
I have a very simple script that uses tablecloth
. foo.clj
looks like this:
(require '[tablecloth.api :as tc])
(prn (tc/dataset {:A [1 2 3]}))
and bb.edn
looks like this:
{:deps {scicloj/tablecloth {:mvn/version "7.029.1"}}}
I've tried running this with Clojure (copying bb.edn
over as deps.edn
) and it seems to run okay. But when using Babashka I get the following error message:
quote
----- Error --------------------------------------------------------------------
Type: java.lang.Exception
Message: Unable to resolve classname: java.util.concurrent.locks.ReentrantLock
Location: tech/v3/datatype/export_symbols.clj:4:3
----- Context ------------------------------------------------------------------
1: (ns tech.v3.datatype.export-symbols
2: (:require [ :as io]
3: [clojure.tools.logging :as log])
4: (:import [ Writer]
^--- Unable to resolve classname: java.util.concurrent.locks.ReentrantLock
5: [java.util.concurrent.locks ReentrantLock]))
6:
7: (def ^ReentrantLock load-lib-lock (ReentrantLock.))
8:
9:
----- Stack trace --------------------------------------------------------------
tech.v3.datatype.export-symbols - tech/v3/datatype/export_symbols.clj:4:3
tablecloth.api.api-template - tablecloth/api/api_template.clj:4:3
tablecloth.api - tablecloth/api.clj:4:3
user - /Users/username/Desktop/babashka-test/foo.clj:1:1
I am new to Babashka, so it may well be a PEBKAC issue. Am I doing something daft here?The number of supported classes in bb is a hardcoded list. This class is currently not in it. I can look if adding this class would make this dependency work but I’d expect that tablecloth has some other issues with bb as well
The next thing when adding that missing class is:
$ clj -M:babashka/dev -Sdeps '{:deps {scicloj/tablecloth {:mvn/version "7.029.1"}}}' -e "(require '[tablecloth.api :as tc])"
----- Error --------------------------------------------------------------------
Type: java.lang.Exception
Message: Unable to resolve classname: org.apache.commons.math3.exception.NotANumberException
I don't think bb will have a dependency on this Java library, so I guess it won't work.
I have a little bb script that have subcomands and parses some args. The thing works fine as is, its mostly a hack. But I was thinking it would be nice to improve the quality using cli/dispatch and maybe cli/parse-opts. Is there any example doing this? Also it would be nice if there was some wrapper or something on dispatch so clojure functions could be called directly withouth having to parse the args themselves. Is there something like that available?
my biggest cli with subcommands is currently neil: https://github.com/babashka/neil/blob/9a795828e4c201a47c5851157868c06f2ca37448/src/babashka/neil.clj#L844
tnx! I'll have a look at neil