When using marimo.App.run to run a notebook, allow specifying which cell outputs you need
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 65/100
Research direction
Look at the marimo.App.run function in the codebase to understand its current behavior. The change involves modifying this function to accept a targets parameter and implementing logic to compute and execute only the transitive dependency closure of those targets. Start by examining how the notebook's cell dependencies are tracked and executed. The existing return type must be preserved, and an error should be raised for unknown targets.
Written by the indexing model from the issue text.
Description
Description
Currently the marimo.App.run function just takes which variables you want to override. But the notebook being called might have a bunch of charts or other output cells that don't need to run.
I propose adding an optional targets: Sequence[str] | None = None argument to marimo.App.run(). When supplied, each target is an existing notebook definition name. Run setup cells and only the transitive dependency closure needed to compute those definitions; leave targets=None behavior unchanged. Preserve the existing return type and raise an informative error for unknown targets.
Are you willing to submit a PR? (You must receive approval from the team before submitting a PR.)
- Yes (I don't have a PR started or anything, but I could take a crack at it if it came to that)
Alternatives
Alternatives would include:
- Extract the analysis being performed entirely into reusable functions. The problem is that there are various constants and calculated values that end up getting pulled into the functions as available variables, and then the functions aren't reusable any more.
- Show the charts in a separate notebook. This is possible, but showing tables and charts right next to the algorithm being developed really helps, and breaking that up would hurt the usability of Marimo notebooks.
Additional context
targets selects existing definition names, not cell IDs or display-only cell outputs. To target a chart or other displayed value, bind it to a definition in the notebook.
targets=None must preserve the current behavior. When targets is provided, marimo executes setup cells and the selected definitions' transitive dependencies; unrelated cells do not execute.
This is an execution-selection option, not a second output-selection API. The existing return type is preserved. Side effects in cells outside the selected dependency closure are not run.
- Dominant language
- Python
- Stars
- 22.9k
- Forks
- 1.3k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 380
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from marimo-team/marimo
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
marimo-team/marimo#12027 ·
Maintainers usually reply within 1 day
-
"Clamp all outputs" leaves cells without output marked `expand_output: true`Possibly taken @marthacryan claimed this 12 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
marimo-team/marimo#11768 · 1 assignee ·
Maintainers usually reply within 1 day
-
Cell referencing a variable from a "cancelled" cell runs and raises NameError instead of being blockedMay be free again @dmadisetti claimed this 33 days ago, and no pull request is open. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
marimo-team/marimo#11307 · 1 assignee ·
Maintainers usually reply within 1 day
-
molab
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
marimo-team/marimo#11298 · 1 comment ·
Maintainers usually reply within 1 day
-
Theme change does not affect terminal colorsMay be free again @CloudCorpRecords claimed this 36 days ago, and no pull request is open. Openneeds discussion
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
marimo-team/marimo#11244 · 4 comments ·
Maintainers usually reply within 1 day
All issues in marimo-team/marimo
Similar issues
-
run_gate loads a custom tasks file from outside the working directoryPossibly taken @Ru0k3 claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
MakazhanAlpamys/Soup#3189 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
nautechsystems/nautilus_trader#5741 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
huggingface/datasets#9128 ·
Maintainers usually reply within 1 day