
Pluto.jl – a reactive, lightweight, simple notebook - dunefox
https://github.com/fonsp/Pluto.jl
======
jakobnissen
I've switched from Jupyter to Pluto recently. Here's a few experiences with
it.

* The fact that I can actually use the source files later because they're just Julia files is incredibly useful. I often copy-paste from them into actual REPL-code, and sometimes I just polish the notebook until its source becomes usable as a command-line tool.

* I like the reactive notebook concept. It does really help with bugs

* Pluto is still rough around the edges. Too few keyboard shortcuts. Buttons and text are tiny, afloat in an ocean of useless whitespace. pushing to LOAD_PATH doesn't work properly. Pluto is a very young project and just now gaining attention in the Julia community, so I'm confident these usability issues will improve.

~~~
cpsempek
The inability to simply import jupyter notebooks as python files has always
been a point of friction for me, I’m glad to see this is a main feature for
Pluto.

~~~
eigenspace
I'm not sure if Python has something like this, but in julia we have
[https://github.com/stevengj/NBInclude.jl](https://github.com/stevengj/NBInclude.jl)
which allows us to import jupyter notebooks like regular files.

~~~
kkylin
I did not know about this. Nice. Thanks!

------
vanderZwan
Really happy to see that the good ideas from Observable notebooks are being
copied elsewhere. I don't use Julia myself at the moment (although I think
it's a beautiful language), but I know some people who will be very happy with
this! Also, the playful enthusiasm in the presentation video linked in the
description just makes me smile:

[https://www.youtube.com/watch?v=IAF8DjrQSSk](https://www.youtube.com/watch?v=IAF8DjrQSSk)

~~~
benhurmarcel
Very interesting, thanks.

I don't understand the point of the "reactive" cell order, instead of
conventionally doing top to bottom. It seems like it goes against the idea of
"the program state being completely described by the code you see".

~~~
vanderZwan
So in the context of these notebooks it is actually quite useful to not depend
on cell order, because the idea is that notebooks aren't simply programs or
scripts, they are (potentially interactive) _documents_. You can write an
article that presents the results of your script, with cells that contain
text, interactive widgets and plots at the top, and put the code and data that
generates these plots in "appendix" cells below that. Observable, a
"JavaScript ancestor" of Pluto.js, has plenty examples of these:

[https://observablehq.com](https://observablehq.com)

Also, I guess that you haven't used notebook environments like Jupyter before,
so a bit of historical context might help. In Jupyter, cells _aren 't_
necessarily executed top-to-bottom, they are executed when the user asks it
too. The result is then stored in the global state (well, assuming there is a
global variable that the data is assigned to). This means that cells that
depend on other cells _also_ depend on the order in which those cells were
executed. Worse still, if you write your notebook in a sloppy manner, you can
end up with a state that you cannot reproduce from the still-remaining code
(for example, you can have variables A and B, B is generated from the result
of A, then you remove A. Because Jupyter is not reactive this does not update
B, so your notebook keeps working just fine... until you decide to edit B). So
previously, notebook-like environments made it really easy to introduce bugs
like this.

With reactive cells you don't have to think of state. It's kind of like pure
functional programming: it removes global side-effects. And note how on a
technical level, making cells execute top-to-bottom is really just very a
simple way to enforce that cells must executed in order of dependency! So
either option insists that this global-state-that-does-not-respect-
dependencies is a big problem that should be avoided, they just present
different solutions for the problem.

~~~
benhurmarcel
Thanks a lot for the write-up.

------
yoavz
This looks excellent.

In my opinion, these kinds of apps are the future of data science / data
analyst work. Forget no-code, just enable these professionals to work in a
single programming language that they're familar with and give them
visualization superpowers. The Python ecosystem has
[https://www.streamlit.io/](https://www.streamlit.io/) and
[https://gradio.app/](https://gradio.app/) now. R has
[https://shiny.rstudio.com/](https://shiny.rstudio.com/). I think we'll see
more.

------
mark_l_watson
Looks good but I haven’t tried it yet.

Julia is a remarkable programming language, and pure Julia projects like this
show that it is also good for general purpose development.

I want to try this combined with the Flux DL library.

------
joshday
I've been using Pluto for several weeks and I absolutely love it for quickly
iterating on plots and making small UIs for interactively showing off results.
It's altogether a much better experience than Jupyter for me.

~~~
xiaodai
wonder if you have tried it on large datasets given ur background.

Does it work well with large-datasets given its reactive nature?

~~~
joshday
Everything is cached unless something upstream changes, so it should work just
fine with big datasets. I've only been using relatively small datasets so far,
though.

------
Tarq0n
Sounds like they fixed a bunch of things that are broken about Jupyter
notebooks. I still don't understand why anyone would want to do work in their
browser though.

~~~
WolfOliver
would be curious what Jupyter notebooks things are better with Pluto.jl, can
you name some concrete points?

~~~
celrod
1\. Dependency graph for cells, letting it automatically rerun what's needed
when you change one. This keeps everything up to date.

2\. git-friendly.

~~~
WolfOliver
I wonder how they are doing it? simply re-evaluating every cell?

~~~
ddragon
It's mentioned in the video [1], it does static analysis of the code to create
a graph of dependencies (for example which cell uses a variable defined by
another cell), so when you update any cell it will find what cells are
affected by the change (the downstream nodes on a directed acyclic graph) and
only evals the code on them (instead of running everything). Julia is
particularly good for those kind of code analysis since it's a very Lispy
language.

It also does a trick of creating new modules to manipulate scope to make
deleted variables/import/cells invisible (and therefore free to be garbage
collected).

[1] [https://youtu.be/IAF8DjrQSSk?t=596](https://youtu.be/IAF8DjrQSSk?t=596)

------
UncleOxidant
Just tried it. A couple of things.

Why are results displayed above the code cell instead of below it (as in
Jupyter/IPython)? Was a bit confusing at first.

I'm noticing it crashes a lot. Get messages like:

    
    
       Worker 2 terminated.
       Distributed.ProcessExitedException(2)
    

Really like the reactive aspect, though.

~~~
3JPLW
> Why are results displayed above the code cell instead of below it (as in
> Jupyter/IPython)? Was a bit confusing at first.

I also strongly agreed with this at first, but after working with it some more
I've found it compelling. The key mental model is to think of the code as
something akin to a "figure caption."

------
sradman
Pluto.jl appears to be a Julia centric notebook alternative to Jupyter and its
multi-language Kernels, including IJulia [1]. I imagine there are many trade-
offs between the two but the primary one I see is the runtime size/Python-
dependencies of Jupyter versus the reach of the platform.

There is also a great deal of overlap between IDEs and Notebook platforms.

[1]
[https://github.com/JuliaLang/IJulia.jl](https://github.com/JuliaLang/IJulia.jl)

Edit: "pure Julia" => "Julia centric" based on jakobnissen's comment

~~~
jakobnissen
Not quite. Pluto is also built on JavaScript (of course, since it's a browser
notebook).

The main advantages of Pluto is that

* The sources files are executable Julia files with minimal metadata, so it plays nice with Git. Also, the code of the source files is ordered to reflect the execution order of the cells, to keep the source code and the notebook in sync.

* It attempts to remove all global state. If you change a cell, and dependent cells will change as well (similar to Excel). This makes bugs less likely.

~~~
sradman
Git friendly native Julia files and clean cell reordering/refactoring are very
nice features. Julia seems like a compelling data science platform, especially
for greenfield projects.

------
ScottPJones
One thing that is pretty great about Pluto.jl, is how responsive the author is
(Fons van der Plas, or @fonsp on GitHub). I've been able to get great
suggestions from him (as well as the fast growing community of Pluto users) on
Zulip discussion group for Julia
([https://julialang.zulipchat.com](https://julialang.zulipchat.com))

------
abhayhegde
Seems really smooth. I would like to see how does this scale with larger
chunks of codes. Is there any benchmark comparisons?

~~~
vanderZwan
It just runs Julia under the hood, so I would expect it to be simply as fast
as Julia (assuming that the data processing is the more significant bottleneck
compared to the HTML output that is used to present the results). Performance
more likely affected by the _way_ the data is processed than the language's
speed.

From what I understand, results of cells are cached though, and they don't
update unless something upstream changes, so there is a form of memoization
happening. Which of course also has both implications for performance as well
as memory usage.

------
muska3
This would be better if there was VS Code integration with their notebook
system.

Personally, I will never code in a web browser and don't understand how people
can do so with large code bases.

~~~
fishmaster
Nobody has "a large codebase" in a notebook. They're for explorative
programming and visualisations and they're excellent for that. And VS Code is
technically a web browser, so...

------
uoaei
The thing that still frustrates me about Pluto is that I have to put a `begin
... end` block in each cell where I want multiple commands to run. It would be
nice if it ran more like Jupyter notebooks in this sense, where blocks can be
_blocks_ of code and not individual lines.

------
xvilka
Imagine now the same but without HTML/CSS/JS - using a native 2D and 3D
rendering, with acceleration. That would be blazingly fast.

------
uoaei
Pluto is hard to do R&D but great if you want to compose a report using
existing code.

