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.

Editing pass over our guides (#1965)

Akshay Agrawal19b00c61f30f
diff --git a/docs/_static/docs-panel-icons.png b/docs/_static/docs-panel-icons.png
index 3ac3acc5da..398ed14945 100644
Binary files a/docs/_static/docs-panel-icons.png and b/docs/_static/docs-panel-icons.png differ
diff --git a/docs/_static/docs-user-config.png b/docs/_static/docs-user-config.png
index 8da69c176a..ec438968ae 100644
Binary files a/docs/_static/docs-user-config.png and b/docs/_static/docs-user-config.png differ
diff --git a/docs/api/inputs/anywidget.md b/docs/api/inputs/anywidget.md
index 3799442a7d..df6d558948 100644
--- a/docs/api/inputs/anywidget.md
+++ b/docs/api/inputs/anywidget.md
@@ -1,4 +1,4 @@
-# anywidget
+# Custom UI elements
Build custom UI plugins that hook into marimo's reactive
execution engine by using [anywidget](https://anywidget.dev/).
diff --git a/docs/guides/best_practices.md b/docs/guides/best_practices/index.md
similarity index 93%
rename from docs/guides/best_practices.md
rename to docs/guides/best_practices/index.md
index 23d794708b..79bf03db0e 100644
--- a/docs/guides/best_practices.md
+++ b/docs/guides/best_practices/index.md
@@ -1,5 +1,14 @@
+
# Best practices
+```{eval-rst}
+.. toctree::
+ :maxdepth: 2
+ :hidden:
+
+ performance
+```
+
Here are best practices for writing marimo notebooks.
**Use global variables sparingly.** Keep the number of global variables in your
@@ -66,5 +75,5 @@ will help you avoid bugs and cache expensive intermediate computations.
For tips on writing
performant notebooks (e.g., how to cache intermediate outputs), see the
-[performance guide](/guides/performance.md).
+[performance guide](/guides/best_practices/performance.md).
```
diff --git a/docs/guides/performance.md b/docs/guides/best_practices/performance.md
similarity index 94%
rename from docs/guides/performance.md
rename to docs/guides/best_practices/performance.md
index c671ccd007..66c0b6b781 100644
--- a/docs/guides/performance.md
+++ b/docs/guides/best_practices/performance.md
@@ -26,6 +26,10 @@ helpful when you want to edit one part of a notebook without triggering
execution of other parts. See the
[reactivity guide](/guides/reactivity.md#disabling-cells) for more info.
+## Disable notebook autorun
+
+For expensive notebooks, you can [disable autorun](/guides/reactivity.md#runtime-configuration).
+
## Lazy-load expensive elements or computations
You can lazily render UI elements that are expensive to compute using `marimo.lazy`.
diff --git a/docs/guides/authentication.md b/docs/guides/deploying/authentication.md
similarity index 100%
rename from docs/guides/authentication.md
rename to docs/guides/deploying/authentication.md
diff --git a/docs/guides/deploying/index.md b/docs/guides/deploying/index.md
index 6bda6ddd30..fdccbea5a8 100644
--- a/docs/guides/deploying/index.md
+++ b/docs/guides/deploying/index.md
@@ -15,10 +15,11 @@ These guides help you deploy marimo notebooks.
| | |
| :------------------------------ | :-------------------------------------------------------- |
| {doc}`programmatically` | Programmatically run the marimo backend for customization |
-| {doc}`deploying_docker` | Deploy with Docker |
-| {doc}`deploying_public_gallery` | Deploy our public gallery |
-| {doc}`deploying_marimo_cloud` | Deploy to Marimo Cloud |
-| {doc}`deploying_ploomber` | Deploy to Ploomber Cloud |
+| {doc}`deploying_docker` | Deploy with Docker |
+| {doc}`deploying_public_gallery` | Deploy our public gallery |
+| {doc}`deploying_marimo_cloud` | Deploy to Marimo Cloud |
+| {doc}`deploying_ploomber` | Deploy to Ploomber Cloud |
+| {doc}`authentication` | Authentication and security |
```{admonition} Sharing notebooks on the public web
:class: tip
diff --git a/docs/guides/ai_completion.md b/docs/guides/editor_features/ai_completion.md
similarity index 94%
rename from docs/guides/ai_completion.md
rename to docs/guides/editor_features/ai_completion.md
index 47afc157c4..e788399656 100644
--- a/docs/guides/ai_completion.md
+++ b/docs/guides/editor_features/ai_completion.md
@@ -24,15 +24,9 @@ marimo using `pip` if you need Copilot.
1. Go to the Codeium website and sign up for an account: <https://codeium.com/>
2. Install the browser extension: <https://codeium.com/chrome_tutorial>
3. Open the settings for the Chrome extension and click on "Get Token"
-
-<img src="https://github.com/Exafunction/codeium.jupyter/raw/main/img/1-extension-token.png">
-
4. Right-click on the extension window and select "Inspect" to open the developer tools for the extension. Then click on "Network"
5. Copy the token and paste it into the input area, and then press "Enter Token"
6. This action will log a new API request in the **Network** tab. Click on "Preview" to get the API key.
-
-<img src="https://github.com/Exafunction/codeium.jupyter/raw/main/img/2-api-key.png">
-
7. Paste the API key in the marimo settings in the UI, or add it to your `~/.marimo.toml` file as follows:
```toml
diff --git a/docs/guides/editor_features/configuration.md b/docs/guides/editor_features/configuration.md
new file mode 100644
index 0000000000..a025a48b1b
--- /dev/null
+++ b/docs/guides/editor_features/configuration.md
@@ -0,0 +1 @@
+# Configuration
diff --git a/docs/guides/hotkeys.md b/docs/guides/editor_features/hotkeys.md
similarity index 100%
rename from docs/guides/hotkeys.md
rename to docs/guides/editor_features/hotkeys.md
diff --git a/docs/guides/editor_features/index.md b/docs/guides/editor_features/index.md
new file mode 100644
index 0000000000..21974eaddf
--- /dev/null
+++ b/docs/guides/editor_features/index.md
@@ -0,0 +1,35 @@
+# Editor features
+
+```{eval-rst}
+.. toctree::
+ :maxdepth: 2
+ :hidden:
+
+ overview
+ ai_completion
+ hotkeys
+```
+
+The **marimo editor** is the browser-based IDE in which you write marimo
+notebooks. We've taken a batteries-included approach to designing the editor:
+it comes _packed_ with features to make you productive when working
+with code and data.
+
+| Guide | Description |
+| :------------------- | :---------------------------------------------- |
+| {doc}`overview` | An overview of editor features and configuration |
+| {doc}`ai_completion` | Code with the help of a language model |
+| {doc}`hotkeys` | Our hotkeys |
+
+Highlights include:
+
+- a variables panel that lets you explore variable values and see where they are defined
+- a data explorer that lets you inspect dataframes and tables at a glance
+- smart module autoreloading that tells you which cells need to be rerun
+- code completion
+- GitHub Copilot
+- language-model assisted coding
+- vim keybindings
+- live documentation preiews as you type
+
+and much more.
diff --git a/docs/guides/editor_features.md b/docs/guides/editor_features/overview.md
similarity index 59%
rename from docs/guides/editor_features.md
rename to docs/guides/editor_features/overview.md
index b4eddb96f0..85e0f487c6 100644
--- a/docs/guides/editor_features.md
+++ b/docs/guides/editor_features/overview.md
@@ -1,12 +1,10 @@
-# Editor features
+# Editor overview
This guide introduces some of marimo editor's features, including
a variables panel, dependency graph viewer, table of contents, HTML export,
GitHub copilot, code formatting, a feedback form, and more.
-This guide introduces some of these features.
-
-## Settings
+## Configuration
The editor exposes of a number of settings for the current notebook,
as well as user-wide configuration that will apply to all your notebooks.
@@ -15,6 +13,36 @@ full width, to use vim keybindings, to enable GitHub copilot, and more.
To access these settings, click the gear icon in the top-right of the editor.
+<div align="left">
+<figure>
+<img src="/_static/docs-user-config.png"/ style="height:80px">
+<figcaption>Configure settings.</figcaption>
+</figure>
+</div>
+
+A non-exhaustive list of settings:
+
+- Outputs above or below code cells
+- [Disable/enable autorun](/guides/reactivity.md#runtime-configuration)
+- Vim keybindings
+- Dark mode
+- Auto-save
+- Auto-complete
+- Editor font-size
+- Code formatting with ruff/black
+- [GitHub Copilot](/guides/editor_features/ai_completion.md)
+- [LLM coding assistant](/guides/editor_features/ai_completion.md)
+- [Module autoreloading](/guides/reactivity.md#module-change)
+
+### Vim keybindings
+
+marimo supports vim keybindings.
+
+**Additional bindings/features:**
+
+- `gd` - go to definition
+- `dd` - when a cell is empty, delete it
+
<div align="center">
<figure>
<img src="/_static/docs-settings.png"/>
@@ -24,30 +52,39 @@ To access these settings, click the gear icon in the top-right of the editor.
## Overview panels
-marimo ships with the following IDE-like panels that help provide an overview
-of your notebook:
+marimo ships with the IDE panels that provide an overview of your notebook:
-1. **errors**: view errors in each cell;
-2. **variables**: explore variable values, see where they are defined and used, with go-to-definition;
-3. **dependency graph**: view dependencies between cells, drill-down on nodes and edges;
-4. **table of contents**: corresponding to your markdown;
-5. **logs**: a continuous stream of stdout and stderr.
-6. **snippets** - searchable snippets to copy directly into your notebook
-7. **documentation** - move your text cursor over a symbol to see its documentation
+::::{grid} 1 1 2 2
+
+:::{card}
-<div align="center">
<figure>
-<img src="/_static/docs-panel-icons.png"/>
-<figcaption>Click these buttons to access the editor panels.</figcaption>
+<img src="/_static/docs-panel-icons.png" style="height: 400px"/>
</figure>
-</div>
+:::
+
+:::{card}
+
+1. **file explorer**: view the file tree, open other notebooks
+2. **variables**: explore variable values, see where they are defined and used, with go-to-definition
+2. **data explorer**: see dataframe and table schemas at a glance
+3. **dependency graph**: view dependencies between cells, drill-down on nodes and edges
+4. **table of contents**: corresponding to your markdown
+5. **documentation** - move your text cursor over a symbol to see its documentation
+6. **logs**: a continuous stream of stdout and stderr
+7. **scratchpad**: a scratchpad cell where you can execute throwaway code
+8. **snippets** - searchable snippets to copy directly into your notebook
+9. **feedback** - share feedback!
+:::
-These panels can be toggled via the buttons in the lower left of the editor.
+::::
+
+These panels can be toggled via the buttons in the left of the editor.
## Cell actions
-Click the dot array to the right of a cell to pull up a context menu (or hold
-and drag to move the cell):
+Click the dot array to the right of a cell to pull up a context menu, or hold
+and drag to move the cell:
<div align="center">
<figure>
@@ -57,6 +94,13 @@ through the cell context menu.</figcaption>
</figure>
</div>
+## Right-click menus
+
+marimo supports context-sensitive right-click menus in various locations of
+the editor. Right-click on a cell to open a context-sensitive menu; right click
+on the create-cell button (the plus icon) to get options for the cell type to
+create.
+
## Go-to-definition
- Click on a variable in the editor to see where it's defined and used
@@ -65,12 +109,13 @@ through the cell context menu.</figcaption>
## Keyboard shortcuts
-We've kept some well-known keyboard shortcuts for notebooks (`Ctrl-Enter`,
+We've kept some well-known [keyboard
+shortcuts](/guides/editor_features/hotkeys.md) for notebooks (`Ctrl-Enter`,
`Shift-Enter`), dropped others, and added a few of our own. Hit
`Ctrl/Cmd-Shift-H` to pull up the shortcuts.
-We know keyboard shortcuts are very personal; we'll let you remap them in the
-future.
+We know keyboard shortcuts are very personal; you can remap them in the
+configuration.
_Missing a shortcut? File a
[GitHub issue](https://github.com/marimo-team/marimo/issues)._
@@ -89,10 +134,18 @@ Hit `Cmd/Ctrl+K` to open the command palette.
_Missing a command? File a
[GitHub issue](https://github.com/marimo-team/marimo/issues)._
-## Module autoreloading
+## Share on our online playground
-Enable module autoreloading via the settings icon (top right). Learn more
-in the [runtime configuration guide](/guides/runtime_configuration.md#on-module-change).
+Get a link to share your notebook via our [online playground](/guides/wasm.md):
+
+<div align="center">
+<figure>
+<img src="/_static/share-wasm-link.gif"/>
+</figure>
+</div>
+
+_Our online playground uses WebAssembly. Most but not all packages on PyPI
+are supported. Local files are not synchronized to our playground._
## Export to static HTML
@@ -112,45 +165,11 @@ You can also export to HTML at the command-line:
marimo export html notebook.py -o notebook.html
```
-## Configuration
-
-Click the settings icon in the top right to access important configuration
-settings. For example, you can configure marimo to not autorun on startup.
-You can also enable GitHub Copilot from this menu.
-
-<div align="center">
-<figure>
-<img src="/_static/docs-user-config.png"/>
-<figcaption>Configure settings.</figcaption>
-</figure>
-</div>
-
-A non-exhausted list of settings:
-
-- Vim keymaps
-- Dark mode
-- Auto-save
-- Auto-complete
-- Editor font-size
-- Formatting rules
-- GitHub Copilot
-- Autoreloading/Hot-reloading
-- Outputs above or below code cells
-
-## Vim Support
-
-marimo supports vim keybindings. Enable them in the settings menu.
-
-**Additional bindings/features:**
-
-- `gd` - go to definition
-- `dd` - when a cell is empty, delete it
-
## Send feedback
-The question mark icon in the panels tray (lower left of the editor) opens a
+The question mark icon in the panel tray opens a
dialog to send anonymous feedback. We welcome any and all feedback, from the
-tiniest quibbles to the biggest blue sky dreams.
+tiniest quibbles to the biggest blue-sky dreams.
<div align="center">
<figure>
diff --git a/docs/guides/exporting.md b/docs/guides/exporting.md
index 364ac7ca3c..1adb598226 100644
--- a/docs/guides/exporting.md
+++ b/docs/guides/exporting.md
@@ -72,3 +72,76 @@ their dependency graph.
```bash
marimo export ipynb notebook.py -o notebook.ipynb
```
+
+## 🏝️ Embed marimo outputs in HTML using Islands
+
+```{admonition} Preview
+:class: note
+
+Islands are an early feature. While the API likely won't change, there are some improvements we'd like to make before we consider them stable.
+Please let us know on [GitHub](https://github.com/marimo-team/marimo/issues) if you run into any issues or have any feedback!
+```
+
+marimo islands are a way to embed marimo outputs and/or python code in your HTML that will become interactive when the page is loaded. This is useful for creating interactive blog posts, tutorials, and educational materials, all powered by marimo's reactive runtime.
+
+Check out an [example island-powered document](./island_example.md).
+
+### Islands in action
+
+```{admonition} Advanced topic!
+:class: warning
+
+Islands are an advanced concept that is meant to be a building block for creating integrations with existing tools such as static site generators or documentation tools.
+```
+
+In order to use marimo islands, you need to import the necessary JS/CSS headers in your HTML file, and use our custom HTML tags to define the islands.
+
+```html
+<head>
+ <!-- marimo js/ccs -->
+ <script
+ type="module"
+ src="https://cdn.jsdelivr.net/npm/@marimo-team/islands@<version>/dist/main.js"
+ ></script>
+ <link
+ href="https://cdn.jsdelivr.net/npm/@marimo-team/islands@<version>/dist/style.css"
+ rel="stylesheet"
+ crossorigin="anonymous"
+ />
+ <!-- fonts -->
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
+ <link
+ href="https://fonts.googleapis.com/css2?family=Fira+Mono:wght@400;500;700&amp;family=Lora&amp;family=PT+Sans:wght@400;700&amp;display=swap"
+ rel="stylesheet"
+ />
+ <link
+ rel="stylesheet"
+ href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css"
+ integrity="sha384-wcIxkf4k558AjM3Yz3BBFQUbk/zgIYC2R0QpeeYb+TwlBVMrlgLqwRjRtGZiK7ww"
+ crossorigin="anonymous"
+ />
+</head>
+
+<body>
+ <marimo-island data-app-id="main" data-cell-id="MJUe" data-reactive="true">
+ <marimo-cell-output>
+ <span class="markdown">
+ <span class="paragraph">Hello, islands!</span>
+ </span>
+ </marimo-cell-output>
+ <marimo-cell-code hidden>mo.md('Hello islands 🏝️!')</marimo-cell-code>
+ </marimo-island>
+</body>
+```
+
+### Generating islands
+
+While you can generate the HTML code for islands yourself, it it recommend to use our `MarimoIslandGenerator` class to generate the HTML code for you.
+
+```{eval-rst}
+.. autoclass:: marimo.MarimoIslandGenerator
+ :members:
+
+ .. autoclasstoc::
+```
diff --git a/docs/guides/index.md b/docs/guides/index.md
index 1fa1e88cde..40190fb0ee 100644
--- a/docs/guides/index.md
+++ b/docs/guides/index.md
@@ -9,52 +9,42 @@
reactivity
interactivity
sql
- runtime_configuration
- coming_from_jupyter
+ apps
+ scripts
outputs
- editor_features
- hotkeys
dataframes
plotting
+ editor_features/index
+ best_practices/index
+ coming_from_jupyter
state
integrating_with_marimo/index
- apps
- scripts
wasm
- ai_completion
- best_practices
- performance
- authentication
exporting
deploying/index
```
These guides cover marimo's core concepts.
-| | |
-| :----------------------------------- | :------------------------------------------------------ |
-| {doc}`overview` | An overview of basic concepts |
-| {doc}`reactivity` | How reactive execution works |
-| {doc}`interactivity` | Using interactive UI elements |
-| {doc}`sql` | Use SQL to query dataframes, databases, CSVs, etc. |
-| {doc}`coming_from_jupyter` | marimo for Jupyter users |
-| {doc}`runtime_configuration` | Configure how and when cells are run |
-| {doc}`outputs` | Markdown, plots, and other visual outputs |
-| {doc}`editor_features` | View variables, cell dependencies, errors, and more |
-| {doc}`hotkeys` | Keyboard shortcuts |
-| {doc}`dataframes` | Working with dataframes |
-| {doc}`plotting` | Interactive and reactive plots |
-| {doc}`state` | Mutable, reactive state |
-| {doc}`integrating_with_marimo/index` | Rich displays of objects, custom UI plugins |
-| {doc}`apps` | Running notebooks as apps |
-| {doc}`scripts` | Running notebooks as scripts |
-| {doc}`best_practices` | Best practices when working with marimo |
-| {doc}`performance` | Writing performant notebooks |
-| {doc}`wasm` | Running notebooks in the browser (no backend required!) |
-| {doc}`ai_completion` | Using AI to speed up your coding |
-| {doc}`exporting` | Exporting notebooks to HTML and flat scripts |
-| {doc}`authentication` | Authentication and security |
-| {doc}`deploying/index` | Deploying marimo notebooks and apps |
+| Guide | Description |
+| :----------------------------------- | :-------------------------------------------------- |
+| {doc}`overview` | An overview of basic concepts |
+| {doc}`reactivity` | How reactive execution works |
+| {doc}`interactivity` | Using interactive UI elements |
+| {doc}`sql` | Use SQL to query dataframes, databases, CSVs, etc. |
+| {doc}`apps` | Running notebooks as apps |
+| {doc}`scripts` | Running notebooks as scripts |
+| {doc}`outputs` | Markdown, plots, and other visual outputs |
+| {doc}`dataframes` | Working with dataframes |
+| {doc}`plotting` | Interactive and reactive plots |
+| {doc}`editor_features/index` | View variables, cell dependencies, errors, and more |
+| {doc}`best_practices/index` | Notebook best practices |
+| {doc}`coming_from_jupyter` | marimo for Jupyter users |
+| {doc}`state` | Mutable, reactive state |
+| {doc}`integrating_with_marimo/index` | Rich displays of objects, custom UI plugins |
+| {doc}`wasm` | Create notebooks in our online playground! |
+| {doc}`exporting` | Exporting notebooks to HTML and flat scripts |
+| {doc}`deploying/index` | Deploying marimo notebooks and apps |
```{admonition} Learn by doing!
:class: tip
diff --git a/docs/guides/interactivity.md b/docs/guides/interactivity.md
index 9c837eddf9..4ec7a90077 100644
--- a/docs/guides/interactivity.md
+++ b/docs/guides/interactivity.md
@@ -1,7 +1,7 @@
# Interactivity
One of marimo's most powerful features is its first-class support for
-interactive, stateful user interface (UI) elements: create them using
+interactive, stateful user interface (UI) elements, or "widgets": create them using
[`marimo.ui`](/api/inputs/index/). **Interacting with a UI element bound to a
global variable automatically runs all cells that reference it.**
@@ -83,3 +83,9 @@ value on form submission.
<figcaption>Use an array to group together elements or create a collection of elements that is determined at runtime</figcaption>
</figure>
</div>
+
+## Building custom UI elements using our plugin API
+
+You can build your own reactive and interactive UI elements using
+[anywidget](https://github.com/manzt/anywidget)! See [our docs on
+building custom UI elements](/guides/integrating_with_marimo/custom_ui_plugins.md) to learn more.
diff --git a/docs/guides/outputs.md b/docs/guides/outputs.md
index f62f1e7f4f..3ab873286e 100644
--- a/docs/guides/outputs.md
+++ b/docs/guides/outputs.md
@@ -61,6 +61,13 @@ mo.md(
)
```
+```{admonition} Markdown editor
+:class: tip
+
+marimo can render cells that only use `mo.md()`, without an `f`-string, in a
+markdown editor that supports common hotkeys.
+```
+
## Layout
The marimo library also comes with elements for laying out outputs, including
diff --git a/docs/guides/overview.md b/docs/guides/overview.md
index 9f755a4196..0552e42039 100644
--- a/docs/guides/overview.md
+++ b/docs/guides/overview.md
@@ -58,6 +58,18 @@ cell's code just once, creating a directed acyclic graph based on the
global names each cell defines and reads. This is how data flows
in a marimo notebook.
+```{admonition} Minimize variable mutation.
+:class: warning
+
+marimo's understanding of your code is based on variable definitions and
+references; marimo does not track mutations to objects at runtime. For this
+reason, if you need to mutate a variable (such as adding a new column to a
+dataframe), you should perform the mutation in the same cell as the one that
+defines it.
+
+Learn more in our [reactivity guide](/guides/reactivity.md#reactivity-mutations).
+
+
For more on reactive execution, open the dataflow tutorial:
```bash
diff --git a/docs/guides/reactivity.md b/docs/guides/reactivity.md
index e144f59bc5..22738284ee 100644
--- a/docs/guides/reactivity.md
+++ b/docs/guides/reactivity.md
@@ -62,6 +62,15 @@ refactor your code.
This rule encourages you to keep the number of global variables in your
program small, which is generally considered good practice.
+## Local variables
+
+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 won't need to use many local variables, if any.
+
## No hidden state
Traditional notebooks like Jupyter have _hidden state_: running a cell may
@@ -84,16 +93,24 @@ deletes its global variables from program memory_.
</figure>
</div>
-## Mutations and attributes not tracked
+<a name="reactivity-mutations"></a>
+
+## Avoid mutating variables
marimo's reactive execution is based only on the global variables a cell reads
and the global variables it defines. In particular, _marimo does not track
mutations to objects_, _i.e._, mutations don't trigger reactive re-runs of
other cells. It also does not track the definition or mutation of object
-attributes.
+attributes. For this reason, **avoid defining a variable in one cell and
+mutating it in another**.
+
+If you need to mutate a variable (such as adding a new column to a dataframe),
+you should perform the mutation in the same cell as the one that defines it,
+Or try creating a new variable instead.
-If you must mutate a variable in a downstream cell, try creating a new variable
-instead.
+### Examples
+
+**Create a new variable instead of mutating an existing one.**
_Don't_ do this:
@@ -105,40 +122,95 @@ l = [1]
l.append(2)
```
+_Instead_, do this:
+
```python
-l
+l = [1]
```
-_Instead_, do this:
+```python
+extended_list = l + [2]
+```
+
+**Mutate variables in the cells that define them.**
+
+_Don't_ do this:
```python
-l = [1]
+df = pd.DataFrame({"my_column": [1, 2]})
```
```python
-ll = [1, 2]
+df["another_column"] = [3, 4]
```
+_Instead_, do this:
+
```python
-ll
+df = pd.DataFrame({"my_column": [1, 2]})
+df["another_column"] = [3, 4]
```
```{admonition} Why not track mutations?
:class: note
-Tracking mutations is fundamentally error-prone, with steep usability cliffs. The
-simplicity of marimo's static analysis approach makes marimo easier to
-understand, and encourages well-organized notebook code.
+Tracking mutations reliably is a fundamentally impossible task in Python; marimo
+could never detect all mutations, and even if we could, reacting to mutations could
+result in surprising re-runs of notebook cells. The simplicity of marimo's
+static analysis approach, based only on variable definitions and references,
+makes marimo easy to understand and encourages well-organized notebook code.
```
-## Local variables
+## Runtime configuration
-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.
+Through the notebook settings menu, you can configure how and when marimo runs
+cells.
-If you encapsulate your code using functions and classes when needed,
-you won't need to use many local variables, if any.
+### On cell change: disabling automatic execution
+
+You can disable automatic execution of cells by configuring the runtime to be
+**lazy**: the lazy runtime only runs cells when you ask for them to be run,
+marking downstream cells as stale instead of running them.
+
+When your notebook has expensive cells or dangerous side-effects, choosing lazy
+execution can be key to having a good experience in marimo.
+
+### On startup: disabling autorun
+
+By default, marimo notebooks run automatically on startup; just how the command
+
+```
+python main.py
+```
+
+executes a script,
+
+```
+marimo edit notebook.py
+```
+
+executes the notebook. You can disable autorun on startup in the notebook
+settings.
+
+<a href="module-change"></a>
+
+### On module change: autoreloading
+
+When module autoreloading is enabled,
+marimo tracks when Python modules used by your notebook are changed and reloads
+them so you can use the latest version of your code.
+This works recursively, meaning that marimo tracks modifications for modules
+imported by your notebook's imported modules too.
+
+Autoreloading comes in two types:
+
+- "lazy": automatically marks cells affected by module
+ modifications as stale, letting you know which cells need to be re-run.
+- "autorun": automatically re-runs cells affected by module modification.
+
+**Why autoreload?** Autoreloading enables a workflow that many developers find
+productive: develop complex logic in Python modules, and use the marimo
+notebook as a DAG or main script that orchestrates your logic.
## Disabling cells
@@ -167,13 +239,3 @@ disabled, marimo will automatically run it.
automatically.</figcaption>
</figure>
</div>
-
-```{admonition} Lazy evaluation
-:class: note
-
-If you prefer, you can configure the runtime to be lazy, only running cells
-when you ask for them to be run and marking affected cells as stale. When
-your notebook has expensive cells, choosing lazy execution can be more
-convenient than manually disabling and enabling cell. Learn more
-in the [runtime configuration guide](/guides/runtime_configuration.md)
-```
diff --git a/docs/guides/wasm.md b/docs/guides/wasm.md
index caf03f9bfb..bb1224d968 100644
--- a/docs/guides/wasm.md
+++ b/docs/guides/wasm.md
@@ -1,7 +1,9 @@
-# WASM notebooks
+# Online playground
-It's possible to run marimo **entirely in the browser** -- no backend required! marimo
-notebooks that run entirely in the browser are called **WebAssembly
+We've built an [online playground](https://marimo.app) that lets you
+run marimo **entirely in the browser** -- no backend required!
+
+marimo notebooks that run entirely in the browser are called **WebAssembly
notebooks**, or **WASM notebooks** for short.
In contrast to marimo notebooks that you create with the CLI, WASM notebooks
@@ -10,7 +12,7 @@ your Python code. For this reason, WASM makes it extremely easy to
share marimo notebooks, and makes it possible to tinker with notebooks without
having to install Python on your machine.
-**Try a WASM notebook today!** Just navigate to
+**Try our playground!** Just navigate to
[https://marimo.new](https://marimo.new).
```{admonition} WASM?
@@ -205,79 +207,6 @@ You can optionally render embedded notebooks in read-only mode by appending
<iframe src="https://marimo.app/l/c7h6pz?mode=read&embed=true" width="100%" height="600" class="demo" frameBorder="0"></iframe>
-## 🏝️ Islands
-
-```{admonition} Preview
-:class: note
-
-Islands are an early feature. While the API likely won't change, there are some improvements we'd like to make before we consider them stable.
-Please let us know on [GitHub](https://github.com/marimo-team/marimo/issues) if you run into any issues or have any feedback!
-```
-
-marimo islands are a way to embed marimo outputs and/or python code in your HTML that will become interactive when the page is loaded. This is useful for creating interactive blog posts, tutorials, and educational materials, all powered by marimo's reactive runtime.
-
-Check out an [example island-powered document](./island_example.md).
-
-### Islands in action
-
-```{admonition} Advanced topic!
-:class: warning
-
-Islands are an advanced concept that is meant to be a building block for creating integrations with existing tools such as static site generators or documentation tools.
-```
-
-In order to use marimo islands, you need to import the necessary JS/CSS headers in your HTML file, and use our custom HTML tags to define the islands.
-
-```html
-<head>
- <!-- marimo js/ccs -->
- <script
- type="module"
- src="https://cdn.jsdelivr.net/npm/@marimo-team/islands@<version>/dist/main.js"
- ></script>
- <link
- href="https://cdn.jsdelivr.net/npm/@marimo-team/islands@<version>/dist/style.css"
- rel="stylesheet"
- crossorigin="anonymous"
- />
- <!-- fonts -->
- <link rel="preconnect" href="https://fonts.googleapis.com" />
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
- <link
- href="https://fonts.googleapis.com/css2?family=Fira+Mono:wght@400;500;700&amp;family=Lora&amp;family=PT+Sans:wght@400;700&amp;display=swap"
- rel="stylesheet"
- />
- <link
- rel="stylesheet"
- href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css"
- integrity="sha384-wcIxkf4k558AjM3Yz3BBFQUbk/zgIYC2R0QpeeYb+TwlBVMrlgLqwRjRtGZiK7ww"
- crossorigin="anonymous"
- />
-</head>
-
-<body>
- <marimo-island data-app-id="main" data-cell-id="MJUe" data-reactive="true">
- <marimo-cell-output>
- <span class="markdown">
- <span class="paragraph">Hello, islands!</span>
- </span>
- </marimo-cell-output>
- <marimo-cell-code hidden>mo.md('Hello islands 🏝️!')</marimo-cell-code>
- </marimo-island>
-</body>
-```
-
-### Generating islands
-
-While you can generate the HTML code for islands yourself, it it recommend to use our `MarimoIslandGenerator` class to generate the HTML code for you.
-
-```{eval-rst}
-.. autoclass:: marimo.MarimoIslandGenerator
- :members:
-
- .. autoclasstoc::
-```
-
## Limitations
While WASM notebooks let you get up and running with marimo instantly, they
diff --git a/docs/index.md b/docs/index.md
index 458da0751d..ec12dbbd22 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -4,7 +4,7 @@
**marimo** is a reactive notebook for Python that models notebooks as dataflow
graphs. Run a cell or interact with a UI element, and marimo automatically runs
-affected cells (or [marks them as stale](/guides/runtime_configuration.md)),
+affected cells (or [marks them as stale](/guides/reactivity.md#runtime-configuration)),
keeping code and outputs consistent and preventing bugs before they happen.
Every marimo notebook is stored as pure Python, executable as a script, and
deployable as an app.