Fork me on GitHub
#babashka
<
2022-11-25
>
Ferdinand Beyer08:11:58

I have a bb.edn with:

{:deps {local/build {:local/root "build"}}
 :tasks {,,,}}
When I try to run tasks from a different directory using the -f switch, this will fail as it cannot resolve the :local/root:
bb -f ../bb.edn tasks
----- Error --------------------------------------------------------------------
Type:     clojure.lang.ExceptionInfo
Message:  Could not resolve symbol: local/build
Phase:    analysis
It seems the :local/root is resolved from the current working directory, instead of the directory containing bb.edn. Is this a bug? Is there another way to specify :local/root to resolve relative to bb.edn?

lispyclouds09:11:39

hey hey @U922FGW59! you could try with --deps-root <dir>

lispyclouds09:11:31

also it should be --config /path/to/bb.,edn, not -f

gratitude-thank-you 1
lispyclouds09:11:12

bb --config /path/to/bb.edn --deps-root /path/to/src

borkdude09:11:18

only --config should be sufficient

1
gratitude-thank-you 1
borkdude09:11:52

dependencies are resolved relative to the --config

borkdude09:11:59

unless you use --deps-root

Ferdinand Beyer09:11:55

Oh man, so I just confused --config with -f. Thanks and sorry for not reading properly ☀️

borkdude09:11:25

No worries :)

lispyclouds09:11:58

someone here using kubernetes recently is it? 😉

Ferdinand Beyer09:11:45

Actually no 😄

Ferdinand Beyer09:11:22

But somehow it seemed most natural to use -f when I want to tell “use that file”

lispyclouds09:11:08

yeah coming from my muscle memory, that's totally relatable

😉 1
Tomas Brejla08:11:07

Hello, is there any preferred babashka-compatible library that would offer similar functions as cp/with-shutdown, cp/threadpool and cp/upmap from clj-commons/claypoole ? Basically just some pmap alternative where one could easily plug a custom-sized threadpool.. Thanks.

lispyclouds09:11:27

I'm not aware of one but if youre willing to create an fixed size java.util.concurrent.Executor and submit tasks to it, should work the same and on bb too

borkdude09:11:56

The

{lambdaisland/clj-diff {:mvn/version "1.4.78"}}
library is now compatible with #CLX41ASCS - thanks @plexus

lispyclouds09:11:52

Is bb -e '(load-string (slurp ""))' the best way to run a remote script?

borkdude09:11:47

slurp only works if you don't have any redirections, so maybe babashka.curl is better

1
borkdude09:11:41

I plan on working on babashka.http-server based on java.net.http in the coming quarter or so, so we have one canonical http client that is compatible with babashka.curl and clj-http-ish things

lispyclouds09:11:29

yep, the standard interface to all of this would be awesome

borkdude11:11:07

{lambdaisland/deep-diff2 {:mvn/version "2.6.166"}} is now #babashka compatible as well - thanks @plexus Demo: https://twitter.com/borkdude/status/1596115043611205633

borkdude16:11:20

I'm writing a blog post for the GraalVM medium blog about babashka. Does anyone want to help with proof-reading?

lispyclouds16:11:21

I can give it a shot!

borkdude16:11:41

ok, I will DM you :)

caumond08:11:47

If I can help I may try

borkdude08:11:23

sure, what is your github handle @U018QDQGZ9Q?

caumond08:11:22

Just caumond: https://github.com/caumond. the joy to have a quite rare name.😁

borkdude08:11:28

Added you to the repo

borkdude17:11:32

Just added a ddiff tool to my bbin-installable scripts:

$ bbin install 
$ ddiff <(echo '[1 2 3]') <(echo '[1 2 4]')
[1 2 -3 +4]

skylize19:11:56

With a script wrapping pod.babashka.filewatcher that bottoms out to calling (tasks/run 'test:bb args) on change, which (in short, as we discussed a few days ago) runs (exec 'cognitect.test-runner.api/test): If a test is failing, and changed to pass, the passing state will update correctly on the next run. But editing a test to make it fail still reports as passing on every run until quitting the watcher script and starting it over. Same for any new tests. Have to restart the script to pick up any new tests. Any ideas?

borkdude19:11:15

You will probably need to reload the namespaces then right?

skylize19:11:45

Umm. Yeah, I guess so. How would I do that?

borkdude19:11:45

you can try:

(require '[your-namespace] :reload-all)

borkdude19:11:00

or use tools namespace which is now compatible with babashka

borkdude19:11:13

at least, all of their unit tests

skylize19:11:53

The first example would require knowing what namespaces need reloading. Would tools.namespace offer any ways around that?

borkdude19:11:09

:reload-all reloads all transitive namespaces

borkdude19:11:19

or at least, it should

borkdude19:11:37

but perhaps it's easier to just spawn a new bb instance for every test run

borkdude19:11:48

(shell "bb test-whatever")

skylize19:11:44

Actually tried that already. 🙂 It triggers Exit on a failed test. 😞

borkdude19:11:18

what about just using a REPL, evaluating forms and then running a test?

borkdude19:11:44

it triggers exit on a failed test?

skylize19:11:08

I am evaling forms in repl, but in Clojure. The point is to be able to keep an eye on BB compatibility

skylize19:11:28

Yes. On failed test, the script just quits.

borkdude19:11:03

I'm not exactly sure what you mean. If you can make any kind of repro that I can run locally, that would be easier to say something about

skylize19:11:16

I'll get back to you when I can get that done. Thanks.

skylize21:11:51

details in the readme

borkdude21:11:02

going to check tomorrow

🙏 1
skylize15:12:47

Tried using your fork of tools.namespace to reload changed namespaces, but it throws on requiring clojure.tools.namespace.repl (which holds the refresh function).

Could not resolve symbol: clojure.core/*loaded-libs*

borkdude15:12:25

@U90R0EPHA this is currently not something in SCI, but I could take a look at that

skylize15:12:55

Not sure I understand what "this" refers to in that statement. I think you are saying SCI lacks *loaded-libs*? That was what i gathered already from the error. Brought it up because: 1. It's another data point on attempts to solve ^above. 2. Point it out to you regarding tools.namespace fork. Since you bothered to fork it Babashka, it seems like it would be nice if the primary user-facing API function refresh was actually usable there.

borkdude15:12:12

I think we could try to have this in SCI itself

👍 1
borkdude15:12:35

the rest of tools namespace is now compatible with bb (newest)