This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-28
Channels
- # anglican (2)
- # announcements (2)
- # babashka (41)
- # babashka-circleci-builds (1)
- # beginners (45)
- # brompton (2)
- # calva (13)
- # cider (13)
- # clj-kondo (14)
- # cljsrn (6)
- # clojure (60)
- # clojure-europe (4)
- # clojure-nl (3)
- # clojurescript (1)
- # code-reviews (3)
- # conjure (2)
- # cryogen (5)
- # datomic (22)
- # fulcro (13)
- # graalvm (19)
- # introduce-yourself (1)
- # kaocha (2)
- # leiningen (2)
- # lsp (1)
- # malli (4)
- # meander (1)
- # music (1)
- # news-and-articles (2)
- # off-topic (17)
- # polylith (6)
- # practicalli (2)
- # react (15)
- # reactive (1)
- # reagent (8)
- # reitit (2)
- # releases (1)
- # rum (10)
- # shadow-cljs (6)
- # spacemacs (4)
- # sql (2)
- # tools-deps (4)
- # xtdb (21)
@grzm and I are working on adding java 11 http client support to bb. In short that will enable you to do requests like:
(ns net
(:import [java.net.http HttpClient HttpRequest HttpResponse$BodyHandlers]
[ URI]))
(def req
(-> (HttpRequest/newBuilder (URI. ""))
(.GET)
(.build)))
(def client
(-> (HttpClient/newBuilder)
(.build)))
(def resp (.send client req (HttpResponse$BodyHandlers/ofString)))
[(.statusCode resp) (.response resp)]
and offers async, websocket, etc. support.
The only trade-off there is: it does add size to the image. Currently about 4.8mb. The question is: is this worth adding compared to the increase in size? We could consider dropping the httpkit client in the future to get some size back (but that one is only about 1mb or so). It will be a breaking change, we will notify users for at least 6 month or so before doing so.
After adding support via interop, we could start building some convenience in a babashka.http-client namespace.
Please respond in a 🧵 . I might also make a Github discussions topic about it after gathering some feedback here.$ bb -cp src -e "(require '[java-http-clj.core :as http]) (:status (http/get \"\"))"
200
This is with bb from the jdk-11-http-client branch and with your lib with specs commented outI think the specs will work with spartan.spec but it'd be nice if those can be moved to an optional namespace anyway as this will improve loading time in bb
$ time bb -cp src -e "(require '[java-http-clj.core :as http]) (:status (http/get \"\"))"
200
bb -cp src -e 0.04s user 0.02s system 65% cpu 0.085 total
Pretty fast too@U3L6TFEJF Well, don't remove the specs but move them to, say, java-http-clj.specs
one thing that your lib has over telex is that it's more minimal so supported in bb more easily. the telex one has more deps on other exoscale deps
excellent, that was one of the goals with the lib and I’m happy to see that it helps facilitate things like use in Babashka 😄
@U04V15CAJ does this branch solve the problem? https://github.com/schmee/java-http-clj/tree/separate-spec-ns
It does. Would you mind some clj-kondo inspired cleanup? E.g. the Executor class (and some others) aren't really used (and not in bb yet). Commenting out Executor makes it work.
Haven't tested it at runtime though (because I don't know an example of the top of my head)
yep, both work now:
borkdude@MBP2019 /tmp/java-http-clj (separate-spec-ns) $ bb -cp src -e "(require '[java-http-clj.websocket])"
borkdude@MBP2019 /tmp/java-http-clj (separate-spec-ns) $ bb -cp src -e "(require '[java-http-clj.core])"
@U3L6TFEJF what editor are you using? I can give you some help with that if you want
Ah then you're in for a treat with clojure-lsp probably as neovim (0.5.1 or so?) has an lsp client built in
and clojure-lsp provides nice features like navigation, etc. but also comes with clj-kondo
nice! I have it on my backlog to look into all the nice Neovim 0.5 features but haven’t gotten around to it yet 🙂
great that the lib works now! I’ll do some housekeeping and then push a new release during the day tomorrow :thumbsup:
awesome thanks. and when the new bb comes out, we could add a note to the readme of your iib: compatible
@U3L6TFEJF you can try out my neovim 0.5+ config, all setup for clojure+lsp+conjure and lua powered! 😄 https://github.com/lispyclouds/dotfiles
@U04V15CAJ @U3L6TFEJF here is a https://img.shields.io/badge/babashka-compatible-green?style=flat-square&logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHZpZXdCb3g9IjAgMCAxNDcyIDE0NzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNOTk1LjkxMSAxMTkzLjg5QzExMTAuOTMgMTExMi4zOC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WQ9InBhaW50MF9saW5lYXIiIHgxPSI3NTIiIHkxPSIxMTMiIHgyPSI3NTIiIHkyPSIxMzU5LjUyIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CjxzdG9wIHN0b3AtY29sb3I9IiNFNDFGMjYiLz4KPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjQjcwMDAwIi8+CjwvbGluZWFyR3JhZGllbnQ+CjwvZGVmcz4KPC9zdmc+Cg== i put together, hope its a starting point!
is clojure.tools.logging.readable something you'd be interested in including in babashka? https://github.com/clojure/tools.logging/blob/master/src/main/clojure/clojure/tools/logging/readable.clj