This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-30
Channels
- # babashka (44)
- # beginners (29)
- # calva (80)
- # cider (11)
- # clara (1)
- # clj-kondo (9)
- # clojure (80)
- # clojure-europe (21)
- # clojure-france (13)
- # clojure-nl (4)
- # clojure-spec (3)
- # clojure-uk (6)
- # clojurescript (72)
- # code-reviews (43)
- # cursive (11)
- # datomic (27)
- # events (13)
- # figwheel-main (12)
- # fulcro (27)
- # graalvm (1)
- # jackdaw (2)
- # kaocha (1)
- # malli (4)
- # meander (13)
- # nrepl (2)
- # pathom (8)
- # re-frame (4)
- # reagent (7)
- # reitit (9)
- # remote-jobs (1)
- # reveal (56)
- # ring-swagger (2)
- # sci (5)
- # shadow-cljs (20)
- # slack-help (2)
- # tools-deps (96)
- # vim (7)
- # xtdb (32)
Is it currently possible to use the reveal repl window in a program connecting to a remote nREPL server?
(similarly how the -m vlaaad.reveal remote-prepl
works, but for nREPL)
I was considering some breaking changes there to make it more clj -X:alias
compatible..
well, currently we have an app which is using the datomic peer api. it runs close to the transactor, on a machine with 80GB RAM. instead of exposing its functionality over some web or data api, i thought i would just expose that app over an nrepl server. however, i would like to use reveal as a UI for it, from other machines.
if you have remote process, it’s very easy to augment it to have prepl server, all you need is pass a java property on a startup, like -Dclojure.server.repl="{:port 8881 :accept clojure.core.server/io-prepl}"
since reveal is primarily the output side of the UI, i would still need to expose the process running reveal to an editor over some protocol, so i can send forms for evaluation to it
yes, i read the docs and that's why im asking how to do something similar but with nrepl (for example)
so assuming we have machines and processes arranged like on this diagram: https://excalidraw.com/#json=5642235093712896,jDMLGuoEuZIs2BqWlf0m5Q How can I make the result of a form sent from the IntelliJ Editor panel to be evaluated remotely in the Application process on the App server machine, appear in the Reveal window on the Workstation machine?
using the prepl client/server example from the reveal/README.md
works, but only allows input from a terminal REPL
i was expecting to be able to somehow start a stock nREPL client, but with a/the Reveal nREPL middleware, but doing the from the command-line didn't open the Reveal window:
clj -A:nREPL -A:reveal -m nrepl.cmdline --middleware '[vlaaad.reveal.nrepl/middleware]' --connect --port 5555
which kinds makes sense, i guess, because middlewares are meant for the nREPL server process, not the nREPL clients...u can probably tell that i still don't understand nREPL very well. i was trying to avoid understanding it deeper, but it seems it's unavoidable... 😕
so the benefit of creating this architecture would be that i don't have to convert my application logic to depend on the Datomic client API and I wouldn't need to bother with looking after Datomic peer-server processes. I have some Datomic transaction functions, which I must make available for the transactor, but I can test them locally a lot more directly if I can just stick to using the Datomic peer API.
I don’t understand nrepl well, and socket repls are very simple, so I’m trying to stick to those 🙂
Can’t help with nrepl, but I would setup this with socket repl like that:
1. Make app server run prepl socket server with this java option -Dclojure.server.prepl="{:port 5555 :accept clojure.core.server/io-prepl}"
2. In intellij: create local repl run configuration with clojure.main/run with deps, select aliases that put reveal on a classpath, and in Parameters section add -m vlaaad.reveal remote-prepl :port 5555 :host app-server-host
these new command-line options are very exciting, right? hopefully, they might allow quite some simplifications in the ways how one can integrate reveal.
And by the way, this is working, but a limited way to run reveal. Reveal shines when it runs in the process that is being developed, because it has references to all the values in the jvm process. When reveal has to cross process boundary, all it has are deserialized responses from the remote process, so it can’t watch the atoms, see the classes etc.
ah, and don't forget to fully qualify lib names, even in the examples!
for example, nrepl
is not fully qualified here:
clj \
-Sdeps '{:deps {vlaaad/reveal {:mvn/version "0.1.0-ea25"} nrepl {:mvn/version "0.7.0"}}}' \
-m nrepl.cmdline --middleware '[vlaaad.reveal.nrepl/middleware]'
ah, i see... well, what u just said, has already helped me a lot! i guess, in that case, i will have to transition to the datomic client api after all.
it’s nice — datomic client api adds datafy/nav metadata to its values, and reveal can use those to explore more data at the repl
what are you using in your tests to test datomic related code?
dev-local
?
https://github.com/ComputeSoftware/datomic-client-memdb ?
https://github.com/ComputeSoftware/dev-local-tu ?
u should do a quick screen-cast about that datafy/nav experience! that would quite revealing for many ppl! ;D
I don’t use datomic currently, but previously we created throwaway databases in prod for integration tests :D
here is a little gem for Datomic Peer API users:
(defmethod vlaaad.reveal.stream/emit datomic.db.Db [db]
(vlaaad.reveal.stream/emit
{:basis-t (d/basis-t db)
:db-id (:id db)}))
after this you don't have to worry about displaying a db value in the reveal window, because it will just look like this little hash-mapwatching the latest and all versions of an atom is very cool, is there a way to apply a transform (like a table of a subkey) and making that live too?
and is there a way of doing the same thing as watching an atom without using an atom? i.e. submitting new values to reveal and having them behave like it was an atom update (so I can see the latest or history)
1. regarding views over refs — I think it's a cool idea and I did it a couple of times. Don't remember why I haven't committed anything related to that to reveal, I think I wrote a buggy implementation 😄 But reveal ref watchers work on anything implementing clojure.lang.IRef
interface, so there might already be some cursor implementations out there that you can just use.
2. you can use reveal as "output panel" that you submit values to by yourself — see vlaaad.reveal/ui
function