This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-15
Channels
- # announcements (2)
- # babashka (137)
- # beginners (96)
- # calva (3)
- # cider (11)
- # clj-kondo (8)
- # cljs-dev (161)
- # cljsrn (21)
- # clojure (78)
- # clojure-europe (47)
- # clojure-france (1)
- # clojure-losangeles (1)
- # clojure-nl (4)
- # clojure-spec (24)
- # clojure-uk (9)
- # clojuredesign-podcast (4)
- # clojurescript (39)
- # conjure (2)
- # core-async (27)
- # cursive (36)
- # datomic (54)
- # emacs (6)
- # figwheel (9)
- # figwheel-main (46)
- # fulcro (25)
- # graalvm (8)
- # helix (30)
- # hoplon (6)
- # hugsql (3)
- # jobs (5)
- # leiningen (7)
- # luminus (12)
- # nrepl (20)
- # off-topic (20)
- # pedestal (16)
- # re-frame (14)
- # reagent (3)
- # reitit (3)
- # remote-jobs (5)
- # rum (25)
- # shadow-cljs (60)
- # spacemacs (10)
- # vim (2)
- # xtdb (36)
free idea: websocket pod. https://github.com/borkdude/babashka/issues/120#issuecomment-629075281
Just wanted to echo how amazing an expericene and UX babashka is. Recently had to work in a simple rest api in python. Created a simple bb for quick integration-testing (utilizing babashka.curl) and modified it on the go implementing each endpoint & subsystem. Worke like a charm. The system still needed some python-native test-cases on top, but for "live testing" they would have never been as efficient and fast in development/runtime as my lil bb helper. Thanks for the amazing work!
Was thinking about tooling that facilitates bb and pods to create new dev infrastructure. The gist of the idea is having tooling on top of bb/pods that allows for easily pushing & running bb scripts on dedicated cloud infrastructure. I always wanted to be able to simply push some small function somewhere and serve it as a, e.g. http endpoint. Think ease of php deployment. Have some thoughts around how to handle dependencies & version control in a (hopefully) painless way as well in such infrastructure. So, are there already any projects working in that direction that I should look into before starting from scratch?
@web20 pods are brand new shiny things, there's no dependency management for it, but maybe we can just piggie back on something existing like brew
do you think it would be feasible to think in terms of data-defined dependencies/versions? The most intrinsic would likely be to version pods by some hash of a cleaned up version of its code. Or maybe based on its provided namespaces
?
optimally i'd like to get away from thinking in terms of versions as much as possible. hence the idea of making versioning implicit based on some properties of the code, instead of explicitly chosen by the maintainer. As a user you would of course still want to be able to pin a certain revision of a dependency for it to remain consistent if re-run/-deployed elsewhere later.
to be more specific how i'd use the versions: Say I develop some simple http endpoind handler that depends on a pod locally. when I'm finished, I want to push that script off into the magical new babashka-cloud to run there. How do I ensure, that the pod dependency I used locally is also used remotely
@web20 the pod protocol isn't versioned itself right now. pods are asked if they implement certain ops or not and will be called conformably
without depending on things like commit hashes or other things that are not really a representation of the actual API the pod provides
if the pod has some history and its API changed over the course of time, how'd the script know how to get the revision of the pod with the correct API that was depended on during development?
I guess you would encode that in the pod install function? like: curl this or that release from github releases.
I'd love to see if there's some way to remove the need for the maintainer to version it's library/pod with all the shortcomings (following some thoughts from the spec-ulation talk), but have the tooling be able to implicitly version the actual API of the pod, not the code itself
e.g. if I decide to add documentation to all my functions, or refactor some code, but don't touch the API itself (i.e. any user wouln't notice a difference) I'd still need to bump the version in a pip-like ecosystem
if you follow the spec-ulation talk you should never make any breaking changes. but if you add a new pod function and come to depend on that in your script, then you'd want to have a way to know if you can call that function, right?
exactly, but that's an API dependency in my opinion, not a "code dependency", do you agree?
yes, but how would you handle that? (resolve 'pod.foobar.sqlite/can-i-call-this-one)
?
like what property of a function/ns/pod can be used to define its revision, that works (well enough) in such a system
maybe just a version number works. never break, but at least you know that something is there if you use x version
The describe
op expects a map back. You could use a hash of that for versioning. If you add functions, the version will change.
true, yet they are created with such a discipline for accretion only, and no backwards changes, that its version numbers are (in my little experience) never something of concern when upgrading. I like to imagine an ecosystem that somehow enables/enforces a workflow that provides the same result in terms of no-breaking changes
well, you could add extra information to the describe output about your arities, then the version will change
i really like that! also, that way (if it's handled by tooling) it could even be at the granularity level of each function
e.g.:
$ bb -e '(bencode/write-bencode System/out {"namespaces" [{"name" "ns1" "vars" [{"name" "var1"}]}]})'
d10:namespacesld4:name3:ns14:varsld4:name4:var1eeeee%
$ bb -e '(bencode/write-bencode System/out {"namespaces" [{"name" "ns1" "vars" [{"name" "var1" "version" "1"}]}]})'
d10:namespacesld4:name3:ns14:varsld4:name4:var17:version1:1eeeee%
the describe output can also be propagated to the output of load-pod
so the script can do whatever it wants with it
thanks a lot, that all really helped greatly. Will dive a little more into the bb codebase and work on some pods to get a grip of the developer UX. 🙂
Note that pods can be developed and tested outside of babashka using the JVM as well: https://github.com/babashka/babashka.pods
About pods: pods use the same tech as nREPL. If you can build an nREPL server or client in a language, you can also build a pod in it. Using this page you could find the necessary ingredients (e.g. bencode libraries) for the language: https://nrepl.org/nrepl/beyond_clojure.html cc @jeroenvandijk @sogaiu
@borkdude Yeah would be cool. Maybe in the browser Pods can interact more directly since it’s all js objects in the end and not random bytes. I’ll do some experimentation
I see Pods more as a concept here, but i guess the bencode approach gives guarantees that there is a possibility
Is your idea of letting compiled libraries talk to each other using EDN in a browser?
Ideally plain clojure objects, but then I need to make sure I control the order of compilation and fields associated are in sync with the multiple libraries. Maybe one core library should act as a middleman. I have a feeling there is something possible here. Otherwise edn or transit could work I guess
maybe that’s easier to start with
for performance reasons the other approach could be tried later
so you're not actually going to use the pod protocol, but more something that is inspired by pods?
I’m not sure yet. I think the Pods protocol like on the JVM might cause unnecessary overhead plus it requires more control over execution time. In the browser it would be nice if you would*n’t* have to add a layer of callbacks
What I like about your Pods implementation for the JVM is that it doesn’t require anything different. It feels like the original library. But under water it relies on asynchronous operations, right?
In a javascript runtime asynchronous means callbacks. So you can’t use that library anymore like you are used too
if we can keep the synchronous nature of a library that would have my preference
But i think the api you have created with the command etc can be used
it would only have to return directly
but the message exchange is async, because you want to be able to call multiple functions at the same time
yeah exactly
so the message exchange would have to be slightly different
it’s gonna be awesome 🙂
can you load a normal library on any webpage?
without compiling it beforehand
think observablehq, where i loaded Sci
i mean you write cljs in Sci in a normal webpage
so anything that is pushed to npm can be dynamically loaded on a webpage on demand
how would you implement observablehq with normal cljs libraries?
it’s not possible
but it would not interact in a clojure way. You would have to do the serialization yourself
a clojure map from one advanced compiled library to another gives problems
no the library author is doing it 🙂
not the library user
big difference
ok let me show you later 🙂
@borkdude regarding pods - I'm working on clj-kondo engine for CodeClimate, so I can either use bb + shell out to clj-kondo or use the clj-kondo pod. Which one is preferable/recommended?
@lukaszkorecki Up to you. Pods integrate a little bit nicer, but since clj-kondo can already spit out EDN the difference isn't that big.
If you use pods you can use more "core" functions, like merge-configs
and print-findings!
@borkdude Pods should also have less latency for sequential commands, right?
yeah. the pod is left running during the script. so if you need to consult clj-kondo multiple times then pods are better
@lukaszkorecki Pods are also available on the JVM, if that adds anything useful
Oh, merge-configs is actually useful, as I will have to hook into user-supplied config via codeclimate's yml file
Hi. When I open bb repl I can't do much with the input because it displays the codes for the arrow keys (^[[D etc). If there a way to fix this?
@U96LS78UV Or connect from your favorite editor to a socket REPL or nREPL
rlwrap works, thank you! I do use calva but it's repl is a bit clunky compared to plain cli.
Hello all, is it possible to consume a json string on the command line and parse it into edn from *input*
ahh that helps thanks!!
This is really cool: http://agdr.org/2020/05/14/Polyglot-Makefiles.html It means that this works, and I can write a bit more maintainable makefiles: https://gist.github.com/lukaszkorecki/4283f110cb423b25c297b9b349f98563 ;-)
Something like this should work, but it doesn't for me:
bb: .SHELLFLAGS := -e
bb: SHELL := bb
bb:
(+ 1 2 3)
$ make
(+ 1 2 3)
java.lang.Exception: File does not exist: -c
make: *** [bb] Error 1
$ rlwrap ./bb
user=> (def f (io/file "/Users/borkdude/.m2/repository/org/clojure/clojure/1.10.2-alpha1/clojure-1.10.2-alpha1.jar"))
#'user/f
user=> (def jf (java.util.jar.JarFile. f))
#'user/jf
user=> (def e (.getEntry jf "clojure/core.clj"))
#'user/e
user=> (subs (slurp (.getInputStream jf e)) 0 30)
"; Copyright (c) Rich Hickey."