I’m using Claude Code to work on a Pluto notebook – I like Pluto and Julia, but I never remember how to do all the widgets and things that I’d like to use. Claude does well at editing the .jl file on disk from the terminal – but the changes don’t show up in Pluto unless I stop and restart the entire notebook.
This could seem like a bad idea – I have the notebook open in Pluto, and you have two places editing the same underlying file – but the workflow seems like it’s going to be a common one, if it isn’t already.
Overall a “reload notebook from file” feature would be very useful.
Perhaps I’ve missed something though. Can I get this to work now? Would this be a new feature?
There is a kwarg auto_reload_from_file you can pass to Pluto.run, i.e. Pluto.run(; auto_reload_from_file = true). It’s not super well documented, but it’s mentioned in ⚙️ Configuring Pluto
facepalm there is a very reasonable way to do this manually that I just figured out, though the UI doesn’t make it so clear:
close your notebook: click the Pluto.jl header to return to the main screen
in the My Work section where your just-closed notebook is listed, click the “x” / stop session icon to, well, stop the session
open your notebook again. You have to start from scratch and re-run all the code, which can take a while – but (1) you did tell Pluto the stop the session; and (2) if you’re editing the .jl file outside of Pluto, the only way to be truly certain you have consistent state is to reload and re-run everything. One of the things I love about Pluto is the dependency tracking and consistent state of all the cells, so this seems like perfectly fine behavior.
Also, that allows me to use emacs to edit cells in the notebook, rather than directly in the notebook itself. That may sound super weird, but I don’t like editing in the browser. And I always have a browser window and emacs open – so this lets me have the notebook open where I can see the output and UI while editing cells (which might be hidden in the UI) with emacs. It’s actually really quite nice.