Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

Disable cells -> docs (#120)

Akshay Agrawal0d4e56e5baa7
diff --git a/docs/_static/docs-disable-cell.gif b/docs/_static/docs-disable-cell.gif
new file mode 100644
index 0000000000..cd6a35944c
Binary files /dev/null and b/docs/_static/docs-disable-cell.gif differ
diff --git a/docs/_static/docs-enable-cell.gif b/docs/_static/docs-enable-cell.gif
new file mode 100644
index 0000000000..e3702db14a
Binary files /dev/null and b/docs/_static/docs-enable-cell.gif differ
diff --git a/docs/guides/reactivity.md b/docs/guides/reactivity.md
index 6e5a2639bf..cb4c7d16aa 100644
--- a/docs/guides/reactivity.md
+++ b/docs/guides/reactivity.md
@@ -122,9 +122,37 @@ understand, and encourages well-organized notebook code.
## Local variables
-Global variables prefixed with an underscore are "local" to a cell: they can't
-be read by other cells. Multiple cells can reuse the same local variables
-names.
+Global variables prefixed with an underscore (_e.g._, `_x`) are "local" to a
+cell: they can't be read by other cells. Multiple cells can reuse the same
+local variables names.
If you encapsulate your code using functions and classes when needed,
-you likely won't need to use many local variables, if any.
+you won't need to use many local variables, if any.
+
+## Disabling cells
+
+Sometimes, you may want to edit one part of a notebook without triggering
+automatic execution of its dependent cells. For example, the dependent cells
+may take a long time to execute, and you only want to iterate on the first part
+of a multi-cell computation.
+
+For cases like this, marimo lets you **disable** cells: when a cell is
+disabled, it and its dependents are blocked from running.
+
+<div align="center">
+<figure>
+<img src="/_static/docs-disable-cell.gif"/>
+<figcaption>Disabling a cell blocks it from running.</figcaption>
+</figure>
+</div>
+
+When you re-enable a cell, if any of the cell's ancestors ran while it was
+disabled, marimo will automatically run it.
+
+<div align="center">
+<figure>
+<img src="/_static/docs-enable-cell.gif"/>
+<figcaption>Enable a cell through the context menu. Stale cells run
+automatically.</figcaption>
+</figure>
+</div>
diff --git a/marimo/_tutorials/intro.py b/marimo/_tutorials/intro.py
index d7519d5a9b..73ce418792 100644
--- a/marimo/_tutorials/intro.py
+++ b/marimo/_tutorials/intro.py
@@ -1,7 +1,6 @@
-# Copyright 2023 Marimo. All rights reserved.
import marimo
-__generated_with = "0.1.5"
+__generated_with = "0.1.8"
app = marimo.App()
@@ -396,6 +395,15 @@ def __():
screen, or with `Ctrl/Cmd+Shift+z`.
"""
),
+ "Disabling Cells": (
+ """
+ You can disable a cell via the cell context menu (open it
+ by clicking the icon to the right of a cell). marimo will
+ never run a disabled cell or any cells that depend on it. This
+ can help prevent accidental execution of expensive computations
+ when editing a notebook.
+ """
+ ),
"Code Folding": (
"""
You can collapse or fold the code in a cell by clicking the arrow