babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
2020-12-08T09:38:01.148500Z

Hi @borkdude! I have a question. I saw in your script version that you required explictily babashka.curl and clojure.string. I thought that alias are already present in some of last bb versions, right? Do you recommanded to always manually required?

borkdude 2020-12-08T09:38:45.148700Z

Are you using clj-kondo?

borkdude 2020-12-08T09:39:10.148900Z

Clj-kondo will give warnings if you use a namespace alias without a prior require.

borkdude 2020-12-08T09:39:39.149100Z

This is why I advice to always use explicit requires. I think it is also more readable. The built-in aliases are for command line one-liners. See https://book.babashka.org/#style

2020-12-08T09:40:58.149400Z

Yes I use clj-kindo with Flycheck in my Spacemacs conf

2020-12-08T09:41:04.149600Z

borkdude 2020-12-08T09:41:23.150Z

Right, so when adding explicit requires these warnings go away

borkdude 2020-12-08T09:41:49.150200Z

The script will work either way, it's just a style thing

2020-12-08T09:43:26.150400Z

OK, I understand, thanks! I also prefer when my linting is clean so now I go for the explicit requires 👍

2020-12-08T09:43:38.150600Z

Perfect!

cmdrdats 2020-12-08T09:56:35.152700Z

Good morning - I'm trying to figure out how to use https://github.com/AdGoji/aws-api with babashka, but I'm afraid I can't figure out how to actually reference the code? Do I need to checkout the project and provide a classpath a la -cp somehow?

2020-12-08T10:07:32.152900Z

@cmdrdats I’ve only tested it with leiningen . No with babashka

2020-12-08T10:07:49.153100Z

I’m doing some quick tests now with babashka but I see it goes wrong with loading the dependencies

cmdrdats 2020-12-08T10:08:35.153400Z

ah, ok - for interest sake, how does one load dependencies in babashka?

cmdrdats 2020-12-08T10:09:07.153600Z

thanks for testing this for me 🙂

2020-12-08T10:11:15.153800Z

Ah wait, I forgot an important detail.. You need the jvm to generate the requests maps. Once you have that you can probably call it from babashka (never tested that). So not ideal

2020-12-08T10:12:40.154Z

So it uses the com.cognitect.aws library (currently only works on jvm) to generate the template request maps and with those templates you can call it in a GraalVM project and maybe babashka

cmdrdats 2020-12-08T10:12:53.154200Z

ah, ye - not ideal :rolling_on_the_floor_laughing: I'll just handle it in plain old clj for now then - would have liked to run this in babashka, but no trainsmash

2020-12-08T10:13:05.154400Z

I understand 🙂

2020-12-08T10:13:16.154600Z

sorry for the disappointment

cmdrdats 2020-12-08T10:13:34.154800Z

not at all! thanks for the effort, I appreciate it

borkdude 2020-12-08T10:35:51.155Z

@cmdrdats Many people just shell out to the aws CLI from babashka. Also there is an AWS pod: https://github.com/tzzh/pod-tzzh-aws

cmdrdats 2020-12-08T10:37:02.155400Z

@borkdude ah, I see - makes sense - thank you 🙂

borkdude 2020-12-08T10:38:15.155600Z

That aws pod is Go code generated from a specification (I believe) using Clojure (babashka itself). Pretty nifty :)

borkdude 2020-12-08T10:39:11.155800Z

@thomas.ormezzano can maybe tell you more about it if you're interested. Right now you can't send blobs to s3 with it, this needs some special attention.

borkdude 2020-12-08T11:17:49.156800Z

A WIP under consideration thing:

(require '[babashka.deps :as deps])

(deps/add-deps '{medley/medley {:mvn/version "1.3.0"}})
;; or should we support passing in `{:deps ...}` so we can also have :paths ["src" "test"]?
;; and what about aliases?

(require '[medley.core :as m])

(m/index-by :id [{:id 1} {:id 2}]) ;; works
This now works in the branch babashka-deps (see #babashka_circleci_builds). It shells out to java for resolving deps but just like clojure it is fast once the classpath is cached.

1👍1🎉
borkdude 2020-12-08T11:22:18.157200Z

Feel free to discuss here: https://github.com/borkdude/babashka/issues/473#issuecomment-740559228

borkdude 2020-12-08T21:56:19.158100Z

Awesome, the babashka repo now has a place for discussions, Q/A, etc. https://github.com/borkdude/babashka/discussions

borkdude 2020-12-08T21:57:51.158500Z

I assume it's possible to open a new topic there for others than me?

lukasz 2020-12-08T21:58:07.158800Z

Yep, I can see a big green "New discussion" button