Fork me on GitHub
#babashka
<
2021-04-24
>
vlad_poh06:04:08

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

borkdude09:04:43

@kbosompem you could possibly shell out to some other CLI which can read excel. e.g.: https://csvkit.readthedocs.io/en/latest/scripts/in2csv.html

borkdude09:04:27

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.

borkdude09:04:04

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)

borkdude14:04:43

@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

borkdude14:04:40

@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.

borkdude14:04:18

The program isn't pretty to look at btw

borkdude14:04:29

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

borkdude14:04:45

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.

borkdude14:04:22

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>

borkdude15:04:10

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

borkdude15:04:59

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?

borkdude15:04:46

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...

borkdude15:04:03

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 https://github.com/borkdude/antq/blob/bb.edn/bb.edn. When I type bb tasks babashka says that there are no tasks

borkdude15:04:07

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

😆 1
👍 1
borkdude15:04:26

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

borkdude15:04:47

try the bb-run branch

Karol Wójcik15:04:27

But tasks from script folder are not included

borkdude15:04:59

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?

borkdude16:04:20

@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

borkdude16:04:33

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

richiardiandrea17:04:09

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. 

 }

borkdude19:04:01

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

borkdude20:04:10

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)

👍 1
Karol Wójcik20:04:39

Is there an issue for it?

borkdude20:04:28

Not yet, please create one

borkdude20:04:01

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

borkdude20:04:23

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!

borkdude20:04:15

Could you try out this binary: https://17698-201467090-gh.circle-artifacts.com/0/release/babashka-0.3.6-SNAPSHOT-linux-amd64.tar.gz (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.