Fork me on GitHub
#babashka
<
2022-09-24
>
fvides10:09:08

Hello folks. I'm using babashka by starting it with bb --start-nrepl and connecting from CIDER. Everything works fine except the inspector. When I try to inspect a var, issues an error "Inspector error for: [...]". Is this a know limitation or issue of babashka + CIDER or am I missing something? I've read the documentation but couldn't find anything. Thanks in advance.

borkdude10:09:40

What is "the inspector", can you tell more in detail what you are doing?

fvides10:09:29

Of course: 1. Start babaska with bb --nrepl-server 2. Open a babashka file in emacs 3. cider-connect-clj to localhost and port 4. connection stablishes ok 5. I can evaluate forms (ns, defs, defns) as I usually do in Clojure projects. The inline evaluation overlay works just fine (for example: "(+ 1 2) => 3" in the same buffer). Everything is just fine until here, same experience as normal clojure development. 6. When I call cider-inspect on that same sexp, (C-c M-i in my key mapping), pops a new cider-inspect buffer with the text "Inspector error for 3". Thanks for your interest and quick answer.

borkdude12:09:40

I'm not sure what cider-inspect does, I'd have to reverse engineer that using https://github.com/lambdaisland/nrepl-proxy to find out. Perhaps you could check what the messages are that are being sent back and forth between JVM Clojure vs bb? Then we'd know what to implement. Could be some special op. /cc @U051BLM8F @U02CV2P4J6S

borkdude12:09:11

With that info in hand, feel free to create an issue at babashka.nrepl

fvides14:09:30

Will look into it, thanks.

Benjamin15:09:58

@UM4CBJVLZ If you do not have a namespace and eval the ns form first, irrc currently it might throw somewhere because some nil namespace is passed nvm 1 I was wrong and 2 you where asking about "Inspector"

Benjamin15:09:24

the way it works is that cider makes a eval request with "inspect" "true". https://github.com/clojure-emacs/cider/blob/master/cider-inspector.el#L354 . The "value" response, then is an alist with inspect data. babashka currently has no concept of {:inspect true} , it returns a normal eval result value, then further in the code there is an error. Here is inspect.clj in cider-nrepl: https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl/middleware/inspect.clj . The golden fix might be e.g. a pod with the whole cider middleware

borkdude20:09:52

You can also use portal for inspecting deeply nested data structures. It works with bb

borkdude20:09:30

The bb nrepl doesn't support all CIDER specific things, but perhaps we can make some middleware pluggable in user space

fvides09:09:31

@U04V15CAJ Portal is a great alternative, works like a charm! Again, thanks.

👍 2
bozhidar07:09:19

Btw, cider-nrepl's inspect middleware is just a think wrapper around https://github.com/clojure-emacs/orchard/blob/master/doc/inspector.org

borkdude08:09:58

@U051BLM8F Thanks. Is the inspector also supported in other environments like Calva and neovim?

bozhidar08:09:46

Not sure. The functionality is certainly not CIDER-specific, but I have no idea of someone has implemented so far or not. @U0ETXRFEW mentioned today he's interested in adding this in Calva.

pez08:09:19

I've been interested in adding it to Calva for a long time. And lately I've spoken to several users who wish Calva had it. It's going to happen when I or someone else find a time slot large enough to allow some focus.

👍 1
Richie23:02:05

I just wanted to bump this. I love cider inspect and not having it is something that makes me trade babashka for clojure.

Benjamin06:02:30

I was looking into making cider middleware work on bb. Will make a discussion issue on github soon

😃 2
Adam Helins11:09:43

Is babashka.tasks available to the JVM akin to babashka.fs?

borkdude11:09:19

Not currently, but I think it could be

borkdude11:09:49

you can also use the babashka uberjar if you don't want to use the binary for some reason

Adam Helins11:09:07

It would help for writing code that reliably run on both the JVM and BB (often the case, but that would bring us closer to 100% 🙂 )

borkdude11:09:32

What are you specifically looking for, the task runner as a command line thing?

Adam Helins11:09:23

Mostly access to ...tasks/shell and ...tasks/clojure from the JVM

borkdude11:09:14

I see. I think we could just expose that namespace in the babashka project, would this be enough?

borkdude11:09:27

then you can depend on babashka as a dependency

Adam Helins11:09:33

I guess so yes, essentially renaming babashka.impl.tasks to babashka.tasks?

borkdude11:09:51

well, for starters, just exposing those two functions

👌 1
borkdude11:09:06

I'm careful to not expose any internal details, so I can still make changes to those

Adam Helins11:09:49

Sounds sensible 🙂

borkdude11:09:20

ok issue welcome

borkdude11:09:23

and / or pr

👍 1
jkrasnay12:09:46

I’m getting an error upgrading on my MacBook Air M2:

λ brew upgrade babashka
==> Upgrading 1 outdated package:
borkdude/brew/babashka 0.9.162 -> 0.10.163
==> Downloading 
==> Downloading from 
######################################################################## 100.0%
Error: SHA256 mismatch
Expected: 3ba11a506a98400913d72be2294adf2ff66a87a8dc1b791569e4368e39921165
  Actual: 21379368c0b9674a1656e9786191e6e496ab57b08242e621fa76b76e93056d1f
    File: /Users/john/Library/Caches/Homebrew/downloads/fb06d9f5a6347b7c18e37e1e83edc294811cb176c4c7c3b5f3b024080e6e2fd3--babashka-0.10.163-macos-aarch64.tar.gz
To retry an incomplete download, remove the file above.

borkdude12:09:44

Darn, again

jkrasnay12:09:29

Yep, works. Thanks!

borkdude12:09:21

I have no idea what went wrong there, but it keeps happening. If someone can find it out, please do. https://github.com/borkdude/homebrew-brew/blob/master/update-babashka

borkdude16:09:53

Btw, the newest bb now also supports -Sdeps like the clojure CLI. This can come in handy if you want to e.g. change the :mvn/local-repo during a CI build