Option to run cells with only with mo.md()
on startup?
#603
Replies: 3 comments
-
This is a bit tricky since there are some edge-cases.
We could probably solve 1 (only run when the dependency is just |
Beta Was this translation helpful? Give feedback.
-
I'd be very keen on this - and to avoid edge-case 2 I would be happy for it to be gated behind the cell that contains My use case is that I want the Outline view to work on a notebook that has not fully executed. My most common use case is to have quite large notebooks with various sections, each of which has been used to perform some ad-hoc or prototyped data analysis, much of which will be expensive/slow. So I want to be able to open an old notebook and use the Outline view to jump to the right section or remind myself what's in the notebook, without having to recompute everything. FWIW marimo has come on so far in the last few months that not only have I entirely replaced Jupyter with it, but this niggle is just about the only thing I miss from Jupyter any more, great work. |
Beta Was this translation helpful? Give feedback.
-
I have gotten into the habit of putting expensive or non-idempotent code behind a run button. It's a couple of lines of boilerplate, but it ends up being a nicer experience overall. Couple that with some accordions to spit out results, and you get an outline and run log in one downloadable file. Set up a run button # Set up run button
run_button = mo.ui.run_button(label="Do expensive thing") Gate the expensive calculations behind # optionally, annotate w/ mo.cache
def do_expensive():
if run_button.value: # Key line
# ...do the thing
pass
run_result = do_expensive() Embed the run button and results in the markdown outline # This is a Markdown Outline
Lorem ipsum etc.
Click here to run the calculation:
{run_button}
And here are the results!
{mo.accordion({"Run Result": run_result})}
Isn't that nice? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In the settings I have set
autorun on startup
in the settings as unchecked, which is good as expensive cells that I forgotten to disable and it ended up real world money (OpenAI api) but I wonder if there could be another option to run cells with only withmo.md()
on startup?Beta Was this translation helpful? Give feedback.
All reactions