Fork me on GitHub
#babashka
<
2021-08-02
>
cfleming04:08:22

@borkdude Just checking how 0.5.1 is looking. On Wednesday I’m going away hiking for the rest of the week, and I have the Cursive bit in a state where I could release a beta build. Since it’ll require 0.5.1 for the deps output part, I’ll wait till that’s out before releasing. No pressure though, otherwise I can release when I’m back, no problem.

borkdude05:08:51

I can get 0.5.1 out with the deps output by then, no problem. But I was also planning to look into the vars without metadata and the dynamic vars. Not sure I can get those in before Wednesday. Do you prefer an earlier release without those?

cfleming09:08:50

Hmm, good question, I’d forgotten about that. The dynamic vars aren’t a problem since I’ve implemented the REPL over nREPL for now, and I can support the socket REPL later. The missing vars will only affect completion, currently I have a hack which uses clojure.core if the ns is missing, but I haven’t gone back to check if I can default that in a better way. I’ll look at that tomorrow and let you know.

cfleming09:08:34

Actually, I just checked - I can default that, no problem. So no, I don’t need either of those.

borkdude09:08:08

ok, there are two things for me to do: write a test for the print-deps and upgrade deps.clj to the newest clojure CLI stuff and then I can release a new bb for you

👍 2
borkdude15:08:53

Upgraded deps.clj, binary coming up.

borkdude15:08:04

I posted in the main channel. The last thing I'll have to do is write test for print-deps but I suspect there will be no other changes for 0.5.1.

borkdude22:08:20

Just wrote a test and found one little thing, but probably not important for you.

borkdude22:08:52

Just in case, here's the final binary: https://21433-201467090-gh.circle-artifacts.com/0/release/babashka-0.5.1-SNAPSHOT-macos-amd64.tar.gz Tomorrow morning I'll release 0.5.1 (in 10 hours from now or so)

cfleming23:08:19

Great, thanks! I’ll test out with the final version today.

borkdude08:08:40

@ericdallo @cfleming Released 0.5.1 now

🎉 3
donavan12:08:12

I’d like to use a glob in fs/modifield-sinceit would require another branch here: https://github.com/babashka/fs/blob/master/src/babashka/fs.cljc#L720 Is this worth a PR?

borkdude12:08:52

@donavan you can use it like this: (fs/modified-since ... (fs/glob ...))

donavan12:08:08

In the anchor?

borkdude12:08:17

should also work I think

donavan12:08:50

Don’t think so, it would mean at that line above you have a vector of file paths

donavan12:08:18

…which ends up being passed to fs/file

borkdude12:08:31

ah ok, so the anchor is expected to be one target file

donavan12:08:46

representing a file or directory, yeah

borkdude12:08:08

I guess for now you could use (mapcat #(fs/modified-since % ...) your-files) ?

borkdude12:08:49

but yeah, it would be nice if you could put a glob there

donavan12:08:58

Shall I take a stab at PR?

borkdude12:08:07

I'd have to think if this would still be the correct semantics, but since you can put a dir there too, I think it would

borkdude12:08:14

ok, please add tests :)

donavan12:08:22

will do 👍

borkdude15:08:31

I will publish a new bb tomorrow to support new efforts in #cursive and LSP to get better babashka script support (resolving of vars for static analysis + nREPL). I upgraded deps.clj to match the newest clojure CLI (so bb clojure should work with the new tools stuff as well). Please give it a spin. Linux: https://21422-201467090-gh.circle-artifacts.com/0/release/babashka-0.5.1-SNAPSHOT-linux-amd64-static.tar.gz macOS: https://21427-201467090-gh.circle-artifacts.com/0/release/babashka-0.5.1-SNAPSHOT-macos-amd64.tar.gz Windows: (build still going: https://ci.appveyor.com/project/borkdude/babashka/builds/40221161/artifacts) /cc @cfleming @ericdallo

🔥 4
borkdude15:08:41

@ericdallo Please wait publishing clojure-lsp until I also get the clj-kondo issue sorted, if you can :)

👍 2
practicalli-johnny16:08:45

This may be a bit out there,,, but has anyone an example of using babashka to convert a series of clojure hash maps into individual curl scripts ? I want to populate a dynamodb database via an API I have for staging and production environments, which I'm supposed to use a script (although will anyone know if I switch on an nREPL server...)

escherize16:08:59

How general are your maps? You may be able to use selmer to convert them into the text you want. The difficulty of that approach is correlated with how many curl features or flags you want to use

escherize16:08:44

an example of one of those maps would help us understand your problem

practicalli-johnny18:08:06

Its a completely flat map with keywords and mostly strings as values {:account-id "" :account-name "" :status true ,,,} and about 6 other key values pairs the same

borkdude18:08:56

@jr0cket do you mean, you would like to insert this as JSON with a POST request and you would like the curl command line format for this?

aengelberg18:08:06

Suppose I’ve written a babashka script with a couple of external project dependencies; what’s the best way of packaging that up into something a not-super-technical person without babashka installed could easily download and run?

aengelberg18:08:32

I was thinking applying uberscript and https://github.com/MnRA/nativity might be the solution, but nativity doesn’t seem to work for me at all when playing with it locally

borkdude18:08:51

@aengelberg actually, the upcoming 0.5.1 version has a new CLI option calls print-deps which prints a deps.edn map with all built-in deps + external deps

nice 2
borkdude18:08:20

you could then use that for making a native CLI. I've illustrated here how you could do that, once you have a deps.edn: https://github.com/borkdude/jayfu

borkdude18:08:35

it would be cool if you could test that new functionality

borkdude18:08:45

else wait until tomorrow

borkdude18:08:57

I can provide you a pre-release binary, just let me know

borkdude18:08:37

but to be honest, just letting the other person install babashka is maybe easier since you won't have to deal with all your consumer's OSes, etc.

borkdude18:08:49

you could package up the script + deps into an uberjar and let that person run that

practicalli-johnny18:08:01

I can have a hack around with something in the morning... I am exhausted now.. its been a long 12+ at work 😞

borkdude18:08:27

bb uberjar does that

aengelberg18:08:54

btw thanks for all the work on babashka, just started using it recently and really enjoying it!

❤️ 2
aengelberg18:08:34

I’m not really sure how binaries work, but do you think it’s possible (for each OS) to combine the existing bb binary and a script into a single binary that just feeds the script to bb?

aengelberg18:08:01

without really knowing the internals, it feels like that should be technically feasible without having to re-run GraalVM

borkdude18:08:40

this feature has been requested more often, but this is similar to packaging up a complete nodejs or python + scripts. Usually it's easier to just install node on the other side and them let them use the script

borkdude18:08:08

Perhaps it is possible to package some extra resources into a binary, but I don't know how

👍 2
aengelberg18:08:53

running a bb uberjar requires JVM installed, right?

borkdude18:08:41

only when you download / compute the classpath it uses a JVM

borkdude18:08:49

but once you have created the uberjar, no JVM needed

👍 2
borkdude18:08:02

also not for creating the uberjar itself when you already have the classpath

borkdude18:08:39

To be sure I asked the binary + resources question in the GraalVM slack (https://graalvm.slack.com/archives/CN9KSFB40/p1627930036001500)