Fork me on GitHub

noob-question: in the bb docs I only see a way to manually start a bb project, but nothing like lein's lein new app my-app. Is bb designed to not have such a feature on purpose, or just something that's in the roadmap?


bb and lein are different things conceptually and have different use cases, imo


well, the docs do say that babashka supports local edn files to setup and manage a project.


Yeah, you write or invoke tasks yourself in bb.edn. Pretty much the same as you would put your shell scripts in scripts/ free form. Nothing is prepackaged except the interpreter and the libraries


Perhaps you’re looking for #C03KCV7TM6F which has a new task


well my impression is that the clojure community is moving away from lein and towards clj with things like clj-new which is fine, but I was wondering why not use babashka for everything since it's so much faster than clj and lein?


well, bb isn't the same as JVM Clojure, it only supports a subset


is it possible to actually host full Clojure on GraalVM?


I have a couple of youtube talks on bb and the limitations of native-image (which you probably mean with GraalVM)

🙏 1

@U05V9JANJQK Re: clj-new -- that should be considered "legacy" at this point and deps-new should generally be used instead. clj-new supports legacy templates (lein, boot) but those templates generally produce projects based on Leiningen or Boot. So that doesn't help you with the Clojure CLI :) deps-new is more declarative and is focused on Clojure CLI projects. I think all deps-new templates produce CLI-based projects (but, hey, a template can produce whatever the author wants!). As for Babashka, that's more for "shell scripting" style programming rather than wholesale server-side applications. For long-running server-side processes, JVM Clojure makes more sense than Babashka because you'll have full access to the entire JVM ecosystem and arbitrary Clojure libraries instead of just a subset.


@U04V70XH6 interesting, I just noticed that Kit was using clj-new in the documentation and thought this was relatively new


I suspect that's because they already had a Leiningen-based template? (and didn't want to develop a deps-new template from scratch)

👍 1

did anybody had this issue before with babashka http-client

Inspector error for: {:status 500, :body "invalid upgrade response: status code 200\n", :version :http1.1, :headers {"content-length" "42", "content-type" "text/plain; charset=utf-8", "date" "Thu, 27 Jun 2024 07:22:52 GMT", "x-content-type-options" "nosniff"}, :uri #object[ 0x34c72c31 ""], :request {:headers {:accept "*/*", :accept-encoding ["gzip" "deflate"], :user-agent "babashka.http-client/0.4.17"}, :throw false, :uri #object[ 0x34c72c31 ""], :method :get}}


So @U03DKF57E0M, you have not provided any context which makes a bit tricky to try and help. But I see this type of thing from a bb nrepl session from cider. For example, if I start a nrepl server like so:

$ bb nrepl-server
Started nREPL server at
For more info visit: 
And then from emacs, if I cider connect to this repl server. And then if I evaluate for example:
{:a 1 :b 2}
And then I cider inspect the result, in the cider inspect window I see:
Inspector error for: {:a 1, :b 2}
Is that the kind of thing you are doing?


Seems like a CIDER issue to me then?


I don't know the source of the error, if I try the same from a Clojure nrepl session, the cider inspect window works without error.


my suspicion is that something in CIDER broke bb-compatibility because it's assumed something is present (in the JVM process) that's not there (in bb).


but of course an issue with CIDER with a repro would be the best


For whatever reason, I never expected this to work and just fire up a Clojure nrepl if I want to use the inspector. But I can help out by raising an issue. I think this would be the right repo?


oh sorry, you were using cider inspect. yeah, that doesn't work. sorry for the ping vemv!


So expected behaviour? No issue needed?


yes, at least, if cider-inspect is explicitly used

👍 1

I reckon that the inspect middleware is unimplemented in bb. Might be low-to-medium-hanging fruit 🍏


I think it would be better if nrepl + cider could more or less run as is with bb instead of being a bespoke built-in thing. I had a brief stab at this once but didn't go too far with it. maybe one day...

👍 1

So @U03DKF57E0M, if you want to inspect data during babashka development, you might instead try: • using a Clojure nrepl session, you can discover bb built-in deps classpath via bb print-deps --format classpath • using (I think it supports bb?)


yes, for portal see the discussion in this channel prior to this one, towards the end


but yeah, the Clojure JVM tooling moves faster than bb can keep up with and is of higher quality, so for non-fast startup/dev purposes it's probably better to just use that + write tests that can be run with bb


this is where bb print-deps comes in as @UE21H2HHD has noted


> I think it would be better if nrepl + cider could more or less run as is with bb instead of being a bespoke built-in thing. I had a brief stab at this once but didn't go too far with it. maybe one day... Most likely we'd be happy to receive :bb reader conditionals in the cider-nrepl codebase, and also alternative patterns supporting the distinct approach to middleware


maybe a nice summer project :)


wow so much text i have to get through it first. But wanted to let you know that i found the root cause i guess from the error. What i was doing was accessing the kubernetes api through a kubectl proxy. Somehow babashka http-client sets the connection upgrade header which leads in kubectl to an error. Not sure yet in detail why thats the case but it is related to proxing. You can have the same issue with kubctl proxy and nginx afaik. So what i did in the meanwhile is to use httpkit client which worked right from the start.


@U03DKF57E0M Could it be that you ran into a similar issue as bb.http-client uses http2 as default (this behavior is from while curl/httpkit etc use http1 as default.


@U03DKF57E0M I still find your question too vague. We guessed you were wondering why you got an Inspector error, but maybe you were wondering why you got a 500 response?

👍 1

The issue was really in that http2 upgrade. No clue yet why this happens with babashka.http-client but that was the issue. i switched to httpkit client and everything works as expected. Thanx @U04V15CAJ for the link.


"No clue why that happens with bb.http-client": because this is just the default of the client


@UE21H2HHD sorry for getting my question wrong but the issue wasn't about the inspector but by getting the 500 back from the kubernetes proxy which needs upgrades connections to http2.

👍 1

@U04V15CAJ got it now thanx


nice thanx