Get help from the marimo community

Updated last month

update cells "simulatenously" to avoid errors due to bad state?

At a glance

The community member is facing a minor issue where they have two interdependent cells, and making changes to the upstream cell can break the downstream cell. They are looking for a way to avoid this issue without having to disable and re-enable the cells. The community members suggest two options: changing the runtime to be lazy, or disabling reactive execution for the second cell before editing the first one. Another community member suggests editing both cells without running them, and then using the global run button to run them simultaneously. However, the original poster is hesitant about this approach. The community members also discuss the difference between running and updating cells, and mention that the global run button runs all stale cells, but there may be a way to run only the specific cells needed.

<answer>The community members suggest using the global run button to run the two cells simultaneously, without having to disable and re-enable them.</answer>
Useful resources
i keep facing a very minor predicament

let's say i have two cells that depend on each other, and i'm making edits to an upstream cell in a way that's guaranteed to break the downtream cell (say, a simple change of variable).

if i execute the first cell first after my edits, when the second cell "reacts" it will be out of date and throw an error.

however, if i edit the second cell first, it will cause an error because the upstream cell has not been updated accordingly yet.

This is a very minor inconvenience as it's usually quite temporary, but since it can sometimes majorly affect the layout of the cells (due to now-missing outputs, etc) it can be quite disorienting.

any way to avoid this? any way to temporarily store the state of the code without executing it?
Marked as solution
Can you edit both without running, and use the global run button to run them at the same time?
View full solution
A
s
M
23 comments
Yea two ways. Either change the runtime to be lazy, or disable reactive execution for the second cell before editing the first one (this can be done in the cell settings).
When a cell is disabled, you can edit its code and register it with the graph without running it
hmmm i'm aware of disabling cells but that still seems a bit more tedious than the solution i was hoping for. maybe there's a way to map this to a keybinding?
Can you edit both without running, and use the global run button to run them at the same time?
well, i could, but i wouldn't want to
unfortunately i dont see an option for this in the Hotkeys section in the docs
maybe there's a way to leverage composite elements here?
I’m confused, why wouldn’t you want to?
Is running different than updating in your wording?
I thought that was the original question
no, but avoiding global run all is one reason why i run marimo instead of jupyter....
That button runs all stale cells
i would just want to run the 2 cells out of N cells
marimo is amazing
Global run does not mean global run all
i had no idea! maybe i skipped that part in the intro docs haha
Should be a hot key too but I forget. Hovering might tell you
command shift R (from the command pallet)
Add a reply
Sign up and join the conversation on Discord