Suggested way of decoupling large Pluto notebooks in smaller "pieces" ? #1455
Replies: 3 comments 3 replies
-
I stumbled upon a similar problem not long ago where I was generating a notebook that had both descriptive parts in markdown and a lot of computations based on functions defined within the notebook itself. Things were starting to become quite laggy with the notebook (I had >1500 lines of code including all the comments and markdown, but still a significant portion of it was functions). I decided to move all the function definitions into a separate notebook where I could still use pluo reactivity to add and debug functions and then simply include this file in the other descriptive notebook where I was just basically creating a report with the help of the functions defined in the other file. The straight use of For this reason, when macro analysis capabilities were brought into Pluto, I created a new If you end up going the separate notebook for functions, you might also want to have some internal testing for your functions in the function definition notebook which might be time consuming (I often use For this reason I also added a functionality to my Pluto fork to tag some cells as notebook exclusive so that they are only executed directly from the notebook they are defined in, and they are commented out in the actual notebook file so they are skipped when including it from other places. |
Beta Was this translation helpful? Give feedback.
-
I have also been hoping for a feature like this. In my case, I end up using cumbersome parameter definitions to ensure that a simulation I run in one part of the notebook is decoupled from a simulation run previously. This is necessary not only for runtime, but also to allow me to demonstrate different effects in different sections of the notebook (e.g. I want some variable Δ to be a constant in one section and be defined on a slider in another section. I end up naming them Δ1, Δ2, etc., but it is cumbersome.) One feature I would love to see implemented in Pluto is the ability to define and decouple sections of the notebook. Essentially, to be able to have an intermediate scope between |
Beta Was this translation helpful? Give feedback.
-
@disberd Thank you. I like your |
Beta Was this translation helpful? Give feedback.
-
Once Pluto notebook start becoming too large to be managed comfortably, what would be the best way to split/decouple pieces of code?
For example move function definitions to separate file, into modules, and the including the files in a Pluto cell and importing the module?
How does Pluto react to a changes in the "external" modules. Would reloading the cell with the "include" and "import" work? How would you re-trigger evaluation of the entire notebook? Would one have to turn the notebook off and re-start it? That could be very slow. Can we add a button for it that can re-trigger the evaluation of all the cells leaving to Julia to figure out what needs to be re-compiled? Would that be possible and/or faster?
Partly related to: #1344
Beta Was this translation helpful? Give feedback.
All reactions