Fork me on GitHub

Hi anyone know of a way to read and write to excel with babashka?


@kbosompem you could possibly shell out to some other CLI which can read excel. e.g.:


Other options: Excel is XML right...., manually read the XML? I honestly don't know how hard this is. The other option would be to make an excel pod.


If you rename the excel to .zip you can unzip it and there you will see a bunch of XML files. Maybe it's not too hard :) :/ :-s

Duck Nebuchadnezzar14:04:07

Is there a good way to get a repl with all of the namespaces in my `:requires` key processed? (also the default commands)


@duck What kind of repl, just the command line REPL?

Duck Nebuchadnezzar14:04:41

yeah. I found myself wishing that I had the same environment setup as I do in my task definitions. Figured there might be some easy way to acheive that


@duck This is for debugging only but when you run with BABASHKA_DEV=true bb run foo it will run foo but also print the program needed to run. Maybe that can form the basis for such a REPL experience... worth experimenting.


The program isn't pretty to look at btw


It's probably better to write a tiny script that parses your :init and :requires and makes a starter script


you can invoke (clojure.main/repl) at the end of that script

Duck Nebuchadnezzar14:04:08

worth looking into

Duck Nebuchadnezzar14:04:38

just a simple repl (clojure.main/repl) task seems to be enough to drop me into user1 with my global requires available.


this is worth documenting, I'll put it in the issue

Karol Wójcik15:04:04

Does babashka tasks support grouping subtasks?

Karol Wójcik15:04:27

Something like: bb :build <subtasks>


Not yet. I think just using a prefix like build-foo, build-bar could be the current way of grouping


I do want to add something around this, but it's not yet clear at this point

Karol Wójcik15:04:23

Ok thanks. May I specify the url to script file which is available on github?


I am now adding some logging around tasks: 1) By default the task names are printed before execution 2) It can be suppressed globally using :log-level :error 3) or on individual task level 4) in private tasks the log-level is :error automatically 5) shell and clojure also print their command, they can be suppressed similarly 6) shell and clojure print a when their exit code is non-zero (with :log-level :info and :error) A binary to test this will be available shortly on #babashka-circleci-builds...


example output from clj-kondo.lsp:

$ bb lsp-jar
> java1.8
> recent-clj-kondo
> update-project-clj
> build-server
> lein with-profiles -user do clean, run -m clj-kondo.lsp-server.impl.version
Generation version file: 2021.04.23 > ../vscode-extension/CLJ_KONDO_VERSION
> lein with-profiles -user do clean, uberjar
Compiling clj-kondo.lsp-server.impl.server
Compiling clj-kondo.lsp-server.impl.version
Compiling clj-kondo.lsp-server.main
Created /Users/borkdude/Dropbox/dev/clojure/clj-kondo.lsp/server/target/lsp-server-2021.04.23.jar
Created /Users/borkdude/Dropbox/dev/clojure/clj-kondo.lsp/server/target/lsp-server-2021.04.23-standalone.jar
> lsp-jar
#object[sun.nio.fs.UnixPath 0x157d3c8d "server/target/clj-kondo-lsp-server-2021.04.23-standalone.jar"]

Karol Wójcik15:04:16

@borkdude where can I find some bb.edn file specification?

Karol Wójcik15:04:44

Hmm. I got the same structure as antq When I type bb tasks babashka says that there are no tasks


I can't really diagnose anything if you link to something that is already working :)

😆 3
👍 3

which bb version are you using and which branch of antq are we looking at

Karol Wójcik15:04:40

We're looking at bb.edn branch

Karol Wójcik15:04:56

Babashka v0.3.5


try the bb-run branch

Karol Wójcik15:04:27

But tasks from script folder are not included


I am not sure what you mean by this

Karol Wójcik16:04:35

Isn’t it that paths for bb.edn specify where tasks are located?

Karol Wójcik16:04:31

Therefore bb tasks should return list of tasks which are in script folder?


@karol.wojcik That's not how it works. :paths is the classpath for bb, you can also have :deps, similar to deps.edn. The tasks are the symbols in the :tasks map


I think in the antq bb.edn :paths isn't really used


Oh the requirement sections is a great idea!

Karol Wójcik18:04:07

@borkdude Thank you so much. Last question though. Is it possible to provide doc for babashka task from source script? I would rather not provide doc inline. Here is what I'm trying to build

{:paths ["script"
         ;; ""
 :tasks {:requires ([holy-lambda.tasks :as t])
         doctor t/doctor} ;; when runing `bb tasks` I would love babashka to take doc of task `doctor` from source code. 



@karol.wojcik Ah yeah, that's not yet supported yet, but I think that could work...


One potential "danger" there could be that requiring a script to get the docstring takes time and could cause side effects (although if you use it like this, it should not have any)

👍 3
Karol Wójcik20:04:39

Is there an issue for it?


Not yet, please create one


I will probably do a release tomorrow or so with that one in


Can I ask you for a favor? What OS do you use?

Karol Wójcik20:04:14

Btw I'm experimenting with babashka tasks and I like it's design so far. Found also one bug which I will report as well.

Karol Wójcik20:04:35

Sure. Go ahead!


Could you try out this binary: (latest from #babashka-circleci-builds) I has additional "logging": it prints the task names (also of dependent tasks that are running) and I want to know if this is useful/obtrusive

Karol Wójcik20:04:55

what is subcommand?

Karol Wójcik20:04:40

Imho it looks fine, but still I would like to have an option to disable it or provide my own decoration fn.


@karol.wojcik You can disable it with :log-level :error


or :log-level :none


but maybe a pluggable function is nicer



[bb] clean
is a nicer logging format :)



[babashka] clean

👍 2

I'll try that


Example from antq:

$ clojure -M:babashka/dev lint
[babashka] Running: lint
[babashka] Shell: echo cljstyle
[babashka] Shell: clj-kondo --lint src:test
linting took 309ms, errors: 0, warnings: 0


I could include the task name in the logging during the task, e.g.:

[babashka lint] Shell: clj-kondo --lint src:test


$ bb lint
[bb lint] Starting
[bb lint] echo cljstyle
[bb lint] clj-kondo --lint src:test
linting took 304ms, errors: 0, warnings: 0


I think that makes sense since bb lint is the exact same command you can invoke in the command line


This might be a little bit annoying too btw:

$ bb lsp-jar
[bb java1.8] Starting
[bb recent-clj-kondo] Starting
[bb update-project-clj] Starting
[bb build-server] Starting
[bb lsp-jar] Starting


Maybe I'll just remove this logging idea


or put the default to :error logging


I'll do that so we can start testing without annoying people with it


ok it's now:

$ bb lint
linting took 357ms, errors: 0, warnings: 0
$ bb run --log-level info lint
[bb lint]
[bb lint] echo cljstyle
[bb lint] clj-kondo --lint src:test
linting took 306ms, errors: 0, warnings: 0