Open mossr opened 4 years ago
Unfortunately this is far from trivial: https://github.com/fonsp/Pluto.jl/issues/476
That was my fear.
I'm also curious (and maybe spin out to a separate issue) about running something to mark a document as globally running with_terminal()
around every cell (or something similar).
Something like:
global_with_terminal(true)
Then other cells would just proceed as normal:
println("Hello world!")
Instead of
with_terminal() do
println("Hello world!")
end
No, Pluto will probably never support side effects like the one you suggested
We'll never support it buuuutttt... If https://github.com/fonsp/Pluto.jl/issues/476 gets implemented you could make something yourself that uses https://docs.julialang.org/en/v1/base/io-network/#Base.redirect_stdout and sends the output to the client.
This wouldnt wrap every cell in a with_terminal(), rather it would make one terminal with all the output.
When you say
make one terminal with all the output
you mean one Pluto cell (i.e. the "with_terminal" terminal), right? That'd be really cool!
Since we are discussing the global_with_terminal
thing, can a UI element be added to the right, above the live docs, which emulates the terminal? Then, each cell need not be wrapped around a with_terminal
?
I do not get why this would have side effects though. Isn't the output to repl stdout the same as putting it into a UI element instead? This UI element is not stored in the NB, just like LiveDocs isn't.
Ok, I see how the global_with_terminal
thing is problematic. But how about this?
A new UI element is added(called Terminal?), which @binds
with an IOStream(or io) object, and displays asynchronously everything that is in the stream in real time. with_realtime_terminal
can then be added to also take in a Terminal object, and it will redirect all stdout to the stream of the Terminal object.
Yep, we should make with_terminal
asynchronous, but this https://github.com/fonsp/PlutoUI.jl/labels/needs%20Pluto.jl%20feature
I should say that I am not very interested in this feature, but what I am excited about is https://github.com/fonsp/Pluto.jl/pull/437 which should solve roughly the same use case in a less vintage way. It's coming in about 2 months
fonsp/Pluto.jl#437 seems to solve only minimalistic printing needs. For more serious printing we need vertical space.
Not sure if this is being discussed elsewhere, but I would be important to have
with_terminal
(or a macro version) that could print out in real-time (instead of all at once after execution).E.g.
We'd want this to print
1
2
etc. every 10th of a second and not all at once.