reveal

Docs: https://vlaaad.github.io/reveal/ Source: https://github.com/vlaaad/reveal
onetom 2020-07-30T07:30:56.123700Z

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)

vlaaad 2020-07-30T07:32:10.124Z

no

vlaaad 2020-07-30T07:33:21.124400Z

are you using remote-prepl already? πŸ˜„

vlaaad 2020-07-30T07:33:56.125Z

I was considering some breaking changes there to make it more clj -X:alias compatible..

onetom 2020-07-30T07:36:39.127800Z

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.

vlaaad 2020-07-30T07:37:46.128800Z

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}"

onetom 2020-07-30T07:38:02.129200Z

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

onetom 2020-07-30T07:39:02.130300Z

yes, i read the docs and that's why im asking how to do something similar but with nrepl (for example)

onetom 2020-07-30T08:18:53.133800Z

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?

onetom 2020-07-30T08:21:16.134200Z

using the prepl client/server example from the reveal/README.md works, but only allows input from a terminal REPL

vlaaad 2020-07-30T08:25:12.134400Z

what a timing, I was experimenting with exactly this yesterday

vlaaad 2020-07-30T08:26:07.134600Z

hmm, not exactly this. but very similar

onetom 2020-07-30T08:28:31.134800Z

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...

onetom 2020-07-30T08:30:29.135Z

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... πŸ˜•

onetom 2020-07-30T08:32:52.135200Z

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.

vlaaad 2020-07-30T08:47:07.135400Z

I don’t understand nrepl well, and socket repls are very simple, so I’m trying to stick to those πŸ™‚

vlaaad 2020-07-30T08:49:47.135600Z

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

vlaaad 2020-07-30T08:51:54.136Z

I’m going to write all this in reveal docs for 1.0 release

πŸ‘ 1
vlaaad 2020-07-30T08:53:22.136300Z

I’m currently in the process of figuring out various ways to setup of reveal

onetom 2020-07-30T08:53:28.136500Z

i would be happy to proof read πŸ™‚

onetom 2020-07-30T08:55:12.136700Z

these new command-line options are very exciting, right? hopefully, they might allow quite some simplifications in the ways how one can integrate reveal.

vlaaad 2020-07-30T08:56:13.136900Z

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.

onetom 2020-07-30T08:56:20.137100Z

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]'

vlaaad 2020-07-30T08:56:27.137300Z

it’s all going to be in documentation πŸ˜„

vlaaad 2020-07-30T08:56:49.137500Z

oh right, I forgot about the examples πŸ˜„

onetom 2020-07-30T08:57:29.137700Z

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.

vlaaad 2020-07-30T08:57:56.137900Z

I used datomic client api with reveal!

vlaaad 2020-07-30T08:58:36.138100Z

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

onetom 2020-07-30T08:59:32.138300Z

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 ?

onetom 2020-07-30T09:00:30.138800Z

u should do a quick screen-cast about that datafy/nav experience! that would quite revealing for many ppl! ;D

onetom 2020-07-30T09:00:53.139Z

and thx for mentioning that; one more reason for transitioning to the client api then

vlaaad 2020-07-30T09:01:16.139200Z

I don’t use datomic currently, but previously we created throwaway databases in prod for integration tests :D

vlaaad 2020-07-30T09:02:09.139400Z

but now that they released dev-local I’d probably try to integrate that

vlaaad 2020-07-30T09:03:54.139600Z

> u should do a quick screen-cast about that datafy/nav experience

vlaaad 2020-07-30T09:04:52.140Z

> I’m planning to do all that for 1.0 πŸ˜„

vlaaad 2020-07-30T09:05:02.140200Z

god damn it slack

vlaaad 2020-07-30T09:05:53.140400Z

like feature use examples

πŸ‘ 1
onetom 2020-07-30T12:01:50.142200Z

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-map

nate 2020-07-30T17:23:47.143300Z

playing with reveal again (I tried it out very early on), and I had a couple questions

nate 2020-07-30T17:24:38.144300Z

watching 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?

nate 2020-07-30T17:25:48.145800Z

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)

vlaaad 2020-07-30T17:44:37.149800Z

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

nate 2020-07-30T17:46:58.150400Z

regarding #2, is there a way to clear the panel?

nate 2020-07-30T17:48:07.150800Z

programmatically, I mean

vlaaad 2020-07-30T17:49:01.151Z

nope

vlaaad 2020-07-30T17:49:08.151200Z

oh, wait, programmatically

vlaaad 2020-07-30T17:49:11.151400Z

yes πŸ˜„

vlaaad 2020-07-30T17:50:16.151800Z

but not when you have window created by vlaaad.reveal/ui

nate 2020-07-30T17:51:29.152500Z

ah

nate 2020-07-30T17:52:45.152800Z

is there another way to make a window?

nate 2020-07-30T17:54:03.154200Z

I was imagining for #2 above, writing code that made a window and then when new values came in that I want to display, clearing the window and then sending the new value, so that the window is always only the latest

vlaaad 2020-07-30T18:18:43.154600Z

well that's what built in watchers in reveal do

nate 2020-07-30T18:20:50.154800Z

the ref watchers?

vlaaad 2020-07-30T18:52:37.155300Z

watching the latest and all versions of refs

vlaaad 2020-07-30T18:52:48.155600Z

not only atoms, but also vars, agents etc

nate 2020-07-30T19:04:34.155900Z

great, I'll check it out later today