Pluto + REPL

I love Pluto. But I also love REPL and sometimes some things still feels better off to be done there.
These mostly include fast evaluations and IO operations.
Do you have any setup/ideas how to synchronize a Pluto notebook with a REPL ?

My attempts

First I tried using Revise.jl to actually reproduce the notebook kernel to a REPL.
I activated the environment of the specific Pluto notebook.
Then I configured the Revise mode to track also data using :evalassign and I includet the Pluto notebook.
This works quite well but soon you fall into pitfalls like changing the following cells

### Pluto notebook
# ╔═║ dbfda0d4-8be5-4858-b682-0b43d2464c36
x = 1

# ╔═║ e63564a4-9727-4cf8-8523-5bc9ee5122af
y = x + 10

to

### Pluto notebook
# ╔═║ dbfda0d4-8be5-4858-b682-0b43d2464c36
x = 5 # changed

# ╔═║ e63564a4-9727-4cf8-8523-5bc9ee5122af
y = x + 10

will only update x to REPL kernel and will leave y to the previous value (11).
In other words the expression dependencies are not evaluated.
To bring your REPL in tune with the notebook you need to include the notebook again, or manually evaluate all needed expressions.

Do you have any other ideas how can this state be more closely tracked and evaluated ?
(this starts getting very similar to what the reactiveness of Pluto is meant to do)

I also tried using RemoteREPL.jl.
This way I do not create another kernel that I try to keep synchronized but I really use the kernel of the notebook. As such you don’t have to worry about dependent evaluations and synchronization.
You will need to evaluate commands inside the module of the Pluto notebook.
It might sounds better, but in the end I got more implications, mostly because I realized everytime I modify a cell in Pluto a new module is created. As a result it is hard to follow with the remote REPL.

This thread is meant to initiate a discussion among the people seeking the same thing: a harmonic interplay between Pluto and REPL. Do you have any other ideas for such a venture or maybe some improvements to suggest ?

PS I don’t mean to externally modify the state of a Pluto notebook, but rather just being able to quickly and conveniently evaluate it from a REPL. I still see the fact that Pluto notebook generates a consistent state as an advantage.

4 Likes

I usually interact with the REPL through my editor, nvim (also works with classic vim). All the code is in the editor, and (using a choice of many available plugins) I can select code and send it to the REPL for evaluation, all with a few keystrokes. The code in the editor can be the Pluto file, which is a Julia program like any other. Information about the cell presentation is kept in specially formatted comments.

1 Like