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.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
docs fixes (#3213)
Akshay Agrawal5e6c8f6465b3
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 171126eafa..b4bc0510aa 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -109,7 +109,7 @@ NODE_OPTIONS=--max_old_space_size=8192 NODE_ENV=development make fe -B| `py-snapshots` | Test | Update HTML snapshots || `storybook` | Docs | Run Storybook || `docs` | Docs | Build docs. Use `make ARGS="-a" docs` to force docs to rebuild |-| `docs-auto` | Docs | Autobuild docs |+| `docs-serve` | Docs | Serve docs || `docs-clean` | Docs | Remove built docs |## Lint, Typecheck, Formatdiff --git a/Makefile b/Makefileindex 5f2fb11718..3898e94b70 100644--- a/Makefile+++ b/Makefile@@ -98,10 +98,9 @@ storybook:docs:hatch run docs:build $(ARGS)-.PHONY: docs-auto-# autobuild docs-docs-auto:- hatch run docs:autobuild $(ARGS)+.PHONY: docs-serve+docs-serve:+ hatch run docs:serve $(ARGS).PHONY: docs-clean# remove built docsdiff --git a/README.md b/README.mdindex 2388fd0f0d..cbb555b667 100644--- a/README.md+++ b/README.md@@ -106,7 +106,7 @@ Organize your notebooks to best fit the stories you'd like to tell.**Built-in package management.** marimo has built-in support for all majorpackage managers, letting you install packages on import. marimo can even[serialize package-requirements](https://docs.marimo.io/guides/editor_features/package_management.html#auto-add-inline-script-metadata-uv-only)+requirements](https://docs.marimo.io/guides/editor_features/package_management.html#auto-tracking-inline-script-metadata)in notebook files, and auto install them in[isolated venv sandboxes](https://docs.marimo.io/guides/editor_features/package_management.html#running-marimo-in-a-sandbox-environment-uv-only).diff --git a/docs/api/caching.md b/docs/api/caching.mdindex 28b7616c52..f8f0bcda49 100644--- a/docs/api/caching.md+++ b/docs/api/caching.md@@ -6,25 +6,25 @@ and caching the values of variables to disk.## Caching expensive functions-Use [`mo.cache`](#marimo.cache) to cache the return values of functions in+Use [`mo.cache`][marimo.cache] to cache the return values of functions inmemory, based on the function arguments, closed-over values, and the notebookcode defining the function.The resulting cache is similar to `functools.cache`, but with the benefit that-[`mo.cache`](#marimo.cache) won't return stale values (because it keys on+[`mo.cache`][marimo.cache] won't return stale values (because it keys onclosed-over values) and isn't invalidated when the cell defining the decoratedfunction is simply re-run (because it keys on notebook code). This means that-like marimo notebooks, [`mo.cache`](#marimo.cache) has no hidden state+like marimo notebooks, [`mo.cache`][marimo.cache] has no hidden stateassociated with the cached function, which makes you more productive while developing iteratively.-For a cache with bounded size, use [`mo.lru_cache`](#marimo.lru_cache).+For a cache with bounded size, use [`mo.lru_cache`][marimo.lru_cache].::: marimo.cache::: marimo.lru_cache## Caching variables to disk-Use `mo.persistent_cache` to cache variables computed in an expensive block of+Use [`mo.persistent_cache`][marimo.persistent_cache] to cache variables computed in an expensive block ofcode to disk. The next time this block of code is run, if marimo detects acache hit, the code will be skipped and your variables will be loaded intomemory, letting you pick up where you left off.diff --git a/docs/api/control_flow.md b/docs/api/control_flow.mdindex dccb554349..cfec9fdb64 100644--- a/docs/api/control_flow.md+++ b/docs/api/control_flow.md@@ -5,7 +5,5 @@ This function is useful for validating user input.::: marimo.stop-Use `mo.ui.refresh` to trigger other cells to run periodically, on a configurable+Use [`mo.ui.refresh`][marimo.ui.refresh] to trigger other cells to run periodically, on a configurableinterval (or on click).--::: marimo.ui.refreshdiff --git a/docs/api/inputs/button.md b/docs/api/inputs/button.mdindex 13d41b496f..15fae0b2a6 100644--- a/docs/api/inputs/button.md+++ b/docs/api/inputs/button.md@@ -2,7 +2,7 @@!!! tip "Looking for a submit/run button?"If you're looking for a button to trigger computation on click, consider- using [`mo.ui.run_button`](../api/inputs/run_button.md).+ using [`mo.ui.run_button`][marimo.ui.run_button]./// marimo-embeddiff --git a/docs/api/inputs/chat.md b/docs/api/inputs/chat.mdindex 016f113d48..40073bcf91 100644--- a/docs/api/inputs/chat.md+++ b/docs/api/inputs/chat.md@@ -43,10 +43,10 @@ chat = mo.ui.chat(echo_model, prompts=["Hello", "How are you?"])chat```-Here, `messages` is a list of [`ChatMessage`](#marimo.ai.ChatMessage) objects,+Here, `messages` is a list of [`ChatMessage`][marimo.ai.ChatMessage] objects,which has `role` (`"user"`, `"assistant"`, or `"system"`) and `content` (themessage string) attributes; `config` is a-[`ChatModelConfig`](#marimo.ai.ChatModelConfig) object with various+[`ChatModelConfig`][marimo.ai.ChatModelConfig] object with variousconfiguration parameters, which you are free to ignore.## Using a Built-in AI Model@@ -74,7 +74,7 @@ You can access the chat history using the `value` attribute:chat.value```-This returns a list of [`ChatMessage`](#marimo.ai.ChatMessage) objects, each+This returns a list of [`ChatMessage`][marimo.ai.ChatMessage] objects, eachcontaining `role`, `content`, and optional `attachments` attributes.::: marimo.ai.ChatMessage@@ -209,14 +209,14 @@ mo.ui.chat(## TypesChatbots can be implemented with a function that receives a list of-[`ChatMessage`](#marimo.ai.ChatMessage) objects and a-[`ChatModelConfig`](#marimo.ai.ChatModelConfig).+[`ChatMessage`][marimo.ai.ChatMessage] objects and a+[`ChatModelConfig`][marimo.ai.ChatModelConfig].::: marimo.ai.ChatMessage::: marimo.ai.ChatModelConfig-[`mo.ui.chat`](#marimo.ui.chat) can be instantiated with an initial+[`mo.ui.chat`][marimo.ui.chat] can be instantiated with an initialconfiguration with a dictionary conforming to the config.`ChatMessage`s can also include attachments.@@ -276,4 +276,4 @@ chatbot!!! note- We have added examples for GROQ and Cerebras. These providers offer free API keys and are great for trying out Llama models (from Meta). You can sign up on their platforms and integrate with various AI integrations in marimo easily. For more information, refer to the [AI completion documentation in marimo](../guides/editor_features/ai_completion).+ We have added examples for GROQ and Cerebras. These providers offer free API keys and are great for trying out Llama models (from Meta). You can sign up on their platforms and integrate with various AI integrations in marimo easily. For more information, refer to the [AI completion documentation in marimo](../../guides/editor_features/ai_completion.md).diff --git a/docs/api/inputs/index.md b/docs/api/inputs/index.mdindex a7c671c642..d7fe22a96b 100644--- a/docs/api/inputs/index.md+++ b/docs/api/inputs/index.md@@ -5,35 +5,35 @@ powerful notebooks and apps. These elements are available in `marimo.ui`.| Element | Description ||---------|-------------|-| [`marimo.ui.array`](array.md) | Create array inputs |-| [`marimo.ui.batch`](batch.md) | Batch operations |-| [`marimo.ui.button`](button.md) | Create buttons |-| [`marimo.ui.chat`](chat.md) | Create chat interfaces |-| [`marimo.ui.checkbox`](checkbox.md) | Create checkboxes |-| [`marimo.ui.code_editor`](code_editor.md) | Create code editors |-| [`marimo.ui.dataframe`](dataframe.md) | Interactive dataframes |-| [`marimo.ui.data_explorer`](data_explorer.md) | Explore data |-| [`marimo.ui.date`](dates.md) | Date picker |-| [`marimo.ui.datetime`](dates.md) | Date and time picker |-| [`marimo.ui.date_range`](dates.md) | Date range picker |-| [`marimo.ui.dictionary`](dictionary.md) | Dictionary inputs |-| [`marimo.ui.dropdown`](dropdown.md) | Create dropdowns |-| [`marimo.ui.file`](file.md) | File uploads |-| [`marimo.ui.file_browser`](file_browser.md) | Browse files |-| [`marimo.ui.form`](form.md) | Create forms |-| [`marimo.ui.microphone`](microphone.md) | Record audio |-| [`marimo.ui.multiselect`](multiselect.md) | Multiple selection |-| [`marimo.ui.number`](number.md) | Number inputs |-| [`marimo.ui.radio`](radio.md) | Radio buttons |-| [`marimo.ui.range_slider`](range_slider.md) | Range sliders |-| [`marimo.ui.refresh`](refresh.md) | Refresh buttons |-| [`marimo.ui.run_button`](run_button.md) | Run buttons |-| [`marimo.ui.slider`](slider.md) | Create sliders |-| [`marimo.ui.switch`](switch.md) | Toggle switches |-| [`marimo.ui.tabs`](tabs.md) | Tabbed interfaces |-| [`marimo.ui.table`](table.md) | Interactive tables |-| [`marimo.ui.text`](text.md) | Text inputs |-| [`marimo.ui.text_area`](text_area.md) | Multiline text inputs |+| [`marimo.ui.array`][marimo.ui.array] | Create array inputs |+| [`marimo.ui.batch`][marimo.ui.batch] | Batch operations |+| [`marimo.ui.button`][marimo.ui.button] | Create buttons |+| [`marimo.ui.chat`][marimo.ui.chat] | Create chat interfaces |+| [`marimo.ui.checkbox`][marimo.ui.checkbox] | Create checkboxes |+| [`marimo.ui.code_editor`][marimo.ui.code_editor] | Create code editors |+| [`marimo.ui.dataframe`][marimo.ui.dataframe] | Interactive dataframes |+| [`marimo.ui.data_explorer`][marimo.ui.data_explorer] | Explore data |+| [`marimo.ui.date`][marimo.ui.date] | Date picker |+| [`marimo.ui.datetime`][marimo.ui.datetime] | Date and time picker |+| [`marimo.ui.date_range`][marimo.ui.date_range] | Date range picker |+| [`marimo.ui.dictionary`][marimo.ui.dictionary] | Dictionary inputs |+| [`marimo.ui.dropdown`][marimo.ui.dropdown] | Create dropdowns |+| [`marimo.ui.file`][marimo.ui.file] | File uploads |+| [`marimo.ui.file_browser`][marimo.ui.file_browser] | Browse files |+| [`marimo.ui.form`][marimo.ui.form] | Create forms |+| [`marimo.ui.microphone`][marimo.ui.microphone] | Record audio |+| [`marimo.ui.multiselect`][marimo.ui.multiselect] | Multiple selection |+| [`marimo.ui.number`][marimo.ui.number] | Number inputs |+| [`marimo.ui.radio`][marimo.ui.radio] | Radio buttons |+| [`marimo.ui.range_slider`][marimo.ui.range_slider] | Range sliders |+| [`marimo.ui.refresh`][marimo.ui.refresh] | Refresh buttons |+| [`marimo.ui.run_button`][marimo.ui.run_button] | Run buttons |+| [`marimo.ui.slider`][marimo.ui.slider] | Create sliders |+| [`marimo.ui.switch`][marimo.ui.switch] | Toggle switches |+| [`marimo.ui.tabs`][marimo.ui.tabs] | Tabbed interfaces |+| [`marimo.ui.table`][marimo.ui.table] | Interactive tables |+| [`marimo.ui.text`][marimo.ui.text] | Text inputs |+| [`marimo.ui.text_area`][marimo.ui.text_area] | Multiline text inputs |To use a UI element, assign it to a global variable and output it in a cell.When you interact with the frontend element, the Python object's `value`@@ -44,7 +44,7 @@ automatically run with the element's latest value.| Integration | Description ||-------------|-------------|-| [`marimo.ui.altair_chart`](altair_chart.md) | Interactive Altair charts |-| [`marimo.ui.plotly`](plotly.md) | Interactive Plotly charts |-| [`marimo.mpl.interactive`](mpl.md) | Interactive Matplotlib plots |-| [`marimo.ui.anywidget`](anywidget.md) | Custom widgets |+| [`marimo.ui.altair_chart`][marimo.ui.altair_chart] | Interactive Altair charts |+| [`marimo.ui.plotly`][marimo.ui.plotly] | Interactive Plotly charts |+| [`marimo.mpl.interactive`][marimo.mpl.interactive] | Interactive Matplotlib plots |+| [`marimo.ui.anywidget`][marimo.ui.anywidget] | Custom widgets |diff --git a/docs/api/inputs/text_area.md b/docs/api/inputs/text_area.mdindex b3eff284a2..e02c8ee0fe 100644--- a/docs/api/inputs/text_area.md+++ b/docs/api/inputs/text_area.md@@ -13,5 +13,8 @@ def __():mo.hstack([text_area, mo.md(f"Has value: {text_area.value}")])return///-::: marimo.ui.text_area```++///++::: marimo.ui.text_areadiff --git a/docs/api/layouts/index.md b/docs/api/layouts/index.mdindex 479cb47ac2..421153ffdb 100644--- a/docs/api/layouts/index.md+++ b/docs/api/layouts/index.md@@ -10,20 +10,20 @@ them but just render their children in a certain way.| Function | Description ||----------|-------------|-| [`marimo.accordion`](accordion.md) | Create collapsible sections |-| [`marimo.carousel`](carousel.md) | Create a slideshow |-| [`marimo.callout`](callout.md) | Create highlighted sections |-| [`marimo.center`](center.md) | Center content |-| [`marimo.hstack`](hstack.md) | Stack elements horizontally |-| [`marimo.lazy`](lazy.md) | Lazy load content |-| [`marimo.left`](left.md) | Left-align content |-| [`marimo.nav_menu`](nav_menu.md) | Create navigation menus |-| [`marimo.plain`](plain.md) | Display content without styling |-| [`marimo.right`](right.md) | Right-align content |-| [`marimo.routes`](routes.md) | Create page routing |-| [`marimo.sidebar`](sidebar.md) | Create sidebars |-| [`marimo.tree`](tree.md) | Create tree structures |-| [`marimo.vstack`](vstack.md) | Stack elements vertically |+| [`marimo.accordion`][marimo.accordion] | Create collapsible sections |+| [`marimo.carousel`][marimo.carousel] | Create a slideshow |+| [`marimo.callout`][marimo.callout] | Create highlighted sections |+| [`marimo.center`][marimo.center] | Center content |+| [`marimo.hstack`][marimo.hstack] | Stack elements horizontally |+| [`marimo.lazy`][marimo.lazy] | Lazy load content |+| [`marimo.left`][marimo.left] | Left-align content |+| [`marimo.nav_menu`][marimo.nav_menu] | Create navigation menus |+| [`marimo.plain`][marimo.plain] | Display content without styling |+| [`marimo.right`][marimo.right] | Right-align content |+| [`marimo.routes`][marimo.routes] | Create page routing |+| [`marimo.sidebar`][marimo.sidebar] | Create sidebars |+| [`marimo.tree`][marimo.tree] | Create tree structures |+| [`marimo.vstack`][marimo.vstack] | Stack elements vertically |## Stateful@@ -33,5 +33,5 @@ selected tab name, and `table` tracks the selected rows.| Function | Description ||----------|-------------|-| [`marimo.ui.tabs`](../inputs/tabs.md) | Create tabbed interfaces |-| [`marimo.ui.table`](../inputs/table.md) | Create interactive tables |+| [`marimo.ui.tabs`][marimo.ui.tabs] | Create tabbed interfaces |+| [`marimo.ui.table`][marimo.ui.table] | Create interactive tables |diff --git a/docs/api/layouts/justify.md b/docs/api/layouts/justify.mdindex 3fe5a2fc0f..4b31ac5ae3 100644--- a/docs/api/layouts/justify.md+++ b/docs/api/layouts/justify.md@@ -1,6 +1,7 @@# Justify::: marimo.center+::: marimo.left::: marimo.rightdiff --git a/docs/api/layouts/stacks.md b/docs/api/layouts/stacks.mdindex 0f3bfd9736..8e07e3a86f 100644--- a/docs/api/layouts/stacks.md+++ b/docs/api/layouts/stacks.md@@ -63,4 +63,5 @@ def __():///::: marimo.hstack+::: marimo.vstackdiff --git a/docs/api/plotting.md b/docs/api/plotting.mdindex b7ec72a43c..9fa377bd13 100644--- a/docs/api/plotting.md+++ b/docs/api/plotting.md@@ -11,7 +11,7 @@ For more information about plotting, see the [plotting guide](../guides/working_/// marimo-embedsize: large-````python+```python@app.cellasync def __():import pandas as pd@@ -40,6 +40,7 @@ def __():mo.vstack([chart, mo.ui.table(chart.value)])return```+///### Disabling automatic selection@@ -68,7 +69,6 @@ chart # You can now access chart.value to get the selected data::: marimo.ui.altair_chart-### Performance and Data TransformersAltair has a concept of [data](https://altair-viz.github.io/user_guide/data_transformers.html) transformers, which can be used to improve performance.@@ -93,14 +93,14 @@ alt.data_transformers.enable('marimo_csv')## Reactive plots with Plotly!!! warning "mo.ui.plotly only supports scatter plots, treemaps charts, and sunbursts charts."- marimo can render any Plotly plot, but [`mo.ui.plotly`](#marimo.ui.plotly) only+ marimo can render any Plotly plot, but [`mo.ui.plotly`][marimo.ui.plotly] onlysupports reactive selections for scatter plots, treemaps charts, and sunbursts charts. If you require other kinds of- selection, consider using [`mo.ui.altair_chart`](#marimo.ui.altair_chart).+ selection, consider using [`mo.ui.altair_chart`][marimo.ui.altair_chart].::: marimo.ui.plotly-## Interactive matplotlib+::: marimo.mpl.interactiveoptions:show_root_heading: truediff --git a/docs/api/state.md b/docs/api/state.mdindex 2e186f5ee0..f24050e1f4 100644--- a/docs/api/state.md+++ b/docs/api/state.md@@ -10,7 +10,7 @@interval, while `mo.ui.button()` has a value that can be configured tocount the number of times it has been clicked, or to toggle between `True` and`False`. Additionally, interacting with UI elements bound to global variables- [automatically executes cells](guides/interactivity) that reference those+ [automatically executes cells](../guides/interactivity.md) that reference thosevariables, letting you react to changes by just reading their`value` attributes. This functional paradigm is the preferred way ofreacting to UI interactions in marimo. So if youdiff --git a/docs/faq.md b/docs/faq.mdindex 3305e35c6d..a7f7221248 100644--- a/docs/faq.md+++ b/docs/faq.md@@ -51,7 +51,7 @@ running the cells that reference its variables. Delete a cell and marimo scrubsits variables from program memory, eliminating hidden state.**Built-in interactivity.** marimo also comes with [UI-elements](/guides/interactivity) like sliders, a dataframe transformer, and+elements](guides/interactivity.md) like sliders, a dataframe transformer, andinteractive plots that are automatically synchronized with Python. Interactwith an element and the cells that use it are automatically re-run with itslatest value.@@ -82,7 +82,7 @@ relationships between cells, and automatically re-running cells as needed.In addition, marimo notebooks can serialize package requirements inline;marimo runs these "sandboxed" notebooks in temporary virtual environments,-making them [reproducible down to the packages](/guides/editor_features/package_management.md).+making them [reproducible down to the packages]guides/editor_features/package_management.md).**Maintainability.**marimo notebooks are stored as pure Python programs (`.py` files). This lets you@@ -90,7 +90,7 @@ version them with Git; in contrast, Jupyter notebooks are stored as JSON andrequire extra steps to version.**Interactivity.**-marimo notebooks come with [UI elements](/guides/interacivity) that are+marimo notebooks come with [UI elements](guides/interactivity.md) that areautomatically synchronized with Python (like sliders, dropdowns); _eg_, scrub aslider and all cells that reference it are automatically re-run with the newvalue. This is difficult to get working in Jupyter notebooks.@@ -200,22 +200,22 @@ _Here are some tips to avoid accidental execution of expensive cells:_- [Disable expensive cells](guides/reactivity.md#disabling-cells). When a cellis disabled, it and its descendants are blocked from running.-- Wrap UI elements in a [form](api/inputs/form.md#marimo.ui.form).-- Use [`mo.stop`](api/control_flow.md#marimo.stop) to conditionally stop+- Wrap UI elements in a [form][marimo.ui.form].+- Use [`mo.stop`][marimo.stop] to conditionally stopexecution of a cell and its descendants.-- Decorate functions with marimo's [`mo.cache`](#marimo.cache) to cache+- Decorate functions with marimo's [`mo.cache`][marimo.cache] to cacheexpensive intermediate computations.-- Use [`mo.persistent_cache`](#marimo.persistent_cache) to cache variables to+- Use [`mo.persistent_cache`][marimo.persistent_cache] to cache variables todisk; on re-run, marimo will read values from disk instead of recalculatingthem as long as the cell is not stale.-- Disable automatic execution in the [runtime configuration](/guides/runtime_configuration.md).+- Disable automatic execution in the [runtime configuration](guides/configuration/runtime_configuration.md).<a name="faq-lazy"></a>### How do I disable automatic execution?You can disable automatic execution through the notebook runtime settings;-see the [guide on runtime configuration](/guides/runtime_configuration.md).+see the [guide on runtime configuration](guides/configuration/runtime_configuration.md).When automatic execution is disabled, marimo still gives you guarantees onyour notebook state and automatically marks cells as stale when appropriate.@@ -266,7 +266,7 @@ Access the last submitted value of the text area with `form.value`.### How do I write markdown?Import `marimo` (as `mo`) in a notebook, and use the `mo.md` function.-Learn more in the [outputs guide](/guides/outputs.md#markdown)+Learn more in the [outputs guide](guides/outputs.md#markdown)or by running `marimo tutorial markdown`.<a name="faq-plots"></a>@@ -303,7 +303,7 @@ plt.gca()### How do I display interactive matplotlib plots?-Use <a href="/api/plotting.html#marimo.mpl.interactive">`marimo.mpl.interactive`</a>.+Use [`marimo.mpl.interactive`][marimo.mpl.interactive].```bashfig, ax = plt.subplots()@@ -325,24 +325,24 @@ marimo tutorial layout### How do I show cell code in the app view?(#faq-show-code)-Use [`mo.show_code`](/api/outputs.md#marimo.show_code).+Use [`mo.show_code`][marimo.show_code].<a name="faq-dynamic-ui-elements"></a>### How do I create an output with a dynamic number of UI elements?-Use [`mo.ui.array`](api/inputs/array.md#marimo.ui.array),-[`mo.ui.dictionary`](api/inputs/dictionary.md#marimo.ui.dictionary), or-[`mo.ui.batch`](api/inputs/batch.md#marimo.ui.batch) to create a UI element+Use [`mo.ui.array`][marimo.ui.array],+[`mo.ui.dictionary`][marimo.ui.dictionary], or+[`mo.ui.batch`][marimo.ui.batch] to create a UI elementthat wraps a dynamic number of other UI elements.If you need custom-formatting, use [`mo.ui.batch`](api/inputs/batch.md#marimo.ui.batch), otherwise-use [`mo.ui.array`](api/inputs/array.md#marimo.ui.array) or-[`mo.ui.dictionary`](api/inputs/dictionary.md#marimo.ui.dictionary).+formatting, use [`mo.ui.batch`][marimo.ui.batch], otherwise+use [`mo.ui.array`][marimo.ui.array] or+[`mo.ui.dictionary`][marimo.ui.dictionary].For usage examples, see the-[recipes for grouping UI elements together](/recipes.md#grouping-ui-elements-together).+[recipes for grouping UI elements together](recipes.md#grouping-ui-elements-together).<a name="faq-restart"></a>@@ -375,12 +375,12 @@ mo.vstack([mo.ui.button(on_change=lambda _: print("I was called")) for _ in rangIn such cases (when you want to output a dynamic number of UI elements),you need to use-[`mo.ui.array`](api/inputs/array.md#marimo.ui.array),-[`mo.ui.dictionary`](api/inputs/dictionary.md#marimo.ui.dictionary), or-[`mo.ui.batch`](api/inputs/batch.md#marimo.ui.batch).+[`mo.ui.array`][marimo.ui.array],+[`mo.ui.dictionary`][marimo.ui.dictionary], or+[`mo.ui.batch`][marimo.ui.batch].See the-[recipes for grouping UI elements together](/recipes.md#grouping-ui-elements-together)+[recipes for grouping UI elements together](recipes.md#grouping-ui-elements-together)for example code.<a name="faq-on-change-last"></a>diff --git a/docs/getting_started/key_concepts.md b/docs/getting_started/key_concepts.mdindex ea690ea983..70bee7418b 100644--- a/docs/getting_started/key_concepts.md+++ b/docs/getting_started/key_concepts.md@@ -100,7 +100,7 @@ or read the [reactivity guide](../guides/reactivity.md).marimo visualizes the last expression of each cell as its **output**. Outputscan be any Python value, including markdown and interactive elements created-with the marimo library, (_e.g._, [`mo.md`](marimo.md), [`mo.ui.slider`](marimo.ui.slider)).+with the marimo library, (_e.g._, [`mo.md`][marimo.md], [`mo.ui.slider`][marimo.ui.slider]).You can even interpolate Python values into markdown (using `mo.md(f"...")`) andother marimo elements to build rich composite outputs:@@ -113,9 +113,9 @@ other marimo elements to build rich composite outputs:> Thanks to reactive execution, running a cell refreshes all the relevant outputs in your notebook.The marimo library also comes with elements for laying out outputs, including-[`mo.hstack`](#marimo.hstack), [`mo.vstack`](#marimo.vstack),-[`mo.accordion`](#marimo.accordion), [`mo.ui.tabs`](#marimo.ui.tabs), [`mo.sidebar`](#sidebar),-[`mo.nav_menu`](#marimo.nav_menu), [`mo.ui.table`](#marimo.ui.table),+[`mo.hstack`][marimo.hstack], [`mo.vstack`][marimo.vstack],+[`mo.accordion`][marimo.accordion], [`mo.ui.tabs`][marimo.ui.tabs], [`mo.sidebar`][marimo.sidebar],+[`mo.nav_menu`][marimo.nav_menu], [`mo.ui.table`][marimo.ui.table],and [many more](https://docs.marimo.io/api/layouts/index.html).For more on outputs, try these tutorials:@@ -131,7 +131,7 @@ or read the [visualizing outputs guide](../guides/outputs.md).### Creating interactive elementsThe marimo library comes with many interactive stateful elements in-[`marimo.ui`](../api/inputs/index), including simple ones like sliders, dropdowns, text fields, and file+[`marimo.ui`](../api/inputs/index.md), including simple ones like sliders, dropdowns, text fields, and fileupload areas, as well as composite ones like forms, arrays, and dictionariesthat can wrap other UI elements.@@ -153,14 +153,14 @@ attribute.> and apps._marimo can only synchronize UI elements that are assigned to-global variables._ Use composite elements like [`mo.ui.array`](marimo.ui.array) and-[`mo.ui.dictionary`](marimo.ui.dictionary) if the set of UI elements is not+global variables._ Use composite elements like [`mo.ui.array`][marimo.ui.array] and+[`mo.ui.dictionary`][marimo.ui.dictionary] if the set of UI elements is notknown until runtime.!!! tip "Using buttons to execute cells"- Use [`mo.ui.run_button`](marimo.ui.run_button) to create a button that- triggers computation when clicked; see our recipes for [an example](../recipes#create-a-button-that-triggers-computation-when-clicked).+ Use [`mo.ui.run_button`][marimo.ui.run_button] to create a button that+ triggers computation when clicked; see our recipes for [an example](../recipes.md#create-a-button-that-triggers-computation-when-clicked).For more on interactive elements, run the UI tutorialdiff --git a/docs/guides/best_practices.md b/docs/guides/best_practices.mdindex 766ae9bbc3..5bf132dee1 100644--- a/docs/guides/best_practices.md+++ b/docs/guides/best_practices.md@@ -15,11 +15,11 @@ result in better code.global namespace withtemporary or intermediate variables, and to avoid code duplication.-**Use [`mo.stop`](#marimo.stop) to stop execution.** Use [`mo.stop`](#marimo.stop)+**Use [`mo.stop`][marimo.stop] to stop execution.** Use [`mo.stop`][marimo.stop]to stop a cell from running when a condition is true; this is helpfulwhen working with expensive notebooks. For example, prevent a cell from running-until a button is clicked using [`mo.ui.run_button`](#marimo.ui.run_button) and-[`mo.stop`](#marimo.stop).+until a button is clicked using [`mo.ui.run_button`][marimo.ui.run_button] and+[`mo.stop`][marimo.stop].!!! caution "Expensive notebooks"For more tips on working with expensive notebooks, see thediff --git a/docs/guides/coming_from/index.md b/docs/guides/coming_from/index.mdindex 646fd28301..ee17f050d6 100644--- a/docs/guides/coming_from/index.md+++ b/docs/guides/coming_from/index.md@@ -10,6 +10,4 @@ marimo is a **single tool** that replaces `jupyter`, `streamlit`, `jupytext`,| [Papermill](papermill.md) | Transitioning from Papermill |!!! important "Coming from Jupyter?"- See our [coming from Jupyter guide](../guides/coming_from/jupyter.md).--+ See our [coming from Jupyter guide](../coming_from/jupyter.md).diff --git a/docs/guides/coming_from/jupyter.md b/docs/guides/coming_from/jupyter.mdindex 1cd9eb07bb..112d530065 100644--- a/docs/guides/coming_from/jupyter.md+++ b/docs/guides/coming_from/jupyter.md@@ -13,7 +13,7 @@ other. As a result a Jupyter notebook can easilyaccumulate "hidden state" (and hidden bugs) --- you might accidentally executecells out of order, or you might run (or delete) a cell but forget to re-runcells that depended on its variables. Because of this, Jupyter notebooks-suffer from a [reproducibility crisis](../faq.md#faq-problems), with over+suffer from a [reproducibility crisis](../../faq.md#faq-problems), with overa third of Jupyter notebooks on GitHub failing to reproduce.Unlike Jupyter, **marimo** notebooks understand how different blocks of@@ -38,7 +38,7 @@ button to run all your stale cells and bring your notebook back up-to-date.### Stop execution with `mo.stop`-Use [`mo.stop`](../../api/control_flow.md#marimo.stop) to stop a cell from executing if a condition+Use [`mo.stop`][marimo.stop] to stop a cell from executing if a conditionis met:```python@@ -48,8 +48,8 @@ mo.stop(condition)expensive_function_call()```-Use [`mo.stop()`](../../api/control_flow.md#marimo.stop) in conjunction with-[`mo.ui.run_button()`](../../api/inputs/run_button.md) to require a button press for+Use [`mo.stop()`][marimo.stop] in conjunction with+[`mo.ui.run_button()`][marimo.ui.run_button] to require a button press forexpensive cells:/// marimo-embed@@ -74,7 +74,7 @@ def __():### Working with expensive notebooksFor more tips on adapting to marimo's execution model, see our guide-on [working with expensive notebooks](expensive_notebooks.md).+on [working with expensive notebooks](../expensive_notebooks.md).## Adapting to marimo's restriction on redefining variables@@ -128,12 +128,12 @@ augmented_df["another_column"] = [3, 4]## Adapting to marimo's file formatmarimo stores notebooks as Python, not JSON. This lets you version notebooks-with git, [execute them as scripts](scripts.md), and import named+with git, [execute them as scripts](../scripts.md), and import namedcells into other Python files. However, it does mean that your notebook outputs(e.g., plots) are not stored in the file.If you'd like to keep a visual record of your notebook work, [enable-the "Auto-download as HTML" setting](configuration/index.md), which will+the "Auto-download as HTML" setting](../configuration/index.md), which willperiodically snapshot your notebook as HTML to a `__marimo__` folder in thenotebook directory.diff --git a/docs/guides/coming_from/papermill.md b/docs/guides/coming_from/papermill.mdindex 6e000c7c59..5e204e5ec9 100644--- a/docs/guides/coming_from/papermill.md+++ b/docs/guides/coming_from/papermill.md@@ -75,7 +75,7 @@ programmatically.1. **Running a named cell**:After naming a cell in your file, you can run it using the- [cell execution API](../../api/cell.md#marimo.Cell.run).+ [cell execution API][marimo.Cell.run].```pythonfrom my_notebook import my_cell@@ -86,7 +86,7 @@ programmatically.```This API also allows for parametrizing the inputs to the cell; to learn more,- make sure to checkout [the example](../../api/cell.md#marimo.Cell.run) in our API reference.+ make sure to checkout [the example][marimo.Cell.run] in our API reference.2. **Using subprocess**:diff --git a/docs/guides/coming_from/streamlit.md b/docs/guides/coming_from/streamlit.mdindex 15c18696f6..17381adcd1 100644--- a/docs/guides/coming_from/streamlit.md+++ b/docs/guides/coming_from/streamlit.md@@ -30,7 +30,7 @@ In addition, marimo is much more performant than streamlit.- marimo's structure allows for more fine-grained reactivity.- Unlike streamlit files, marimo files can be executed as Python scripts from thecommand-line, and can be imported and used as a module by other Python- programs. For example, other programs can [reuse cells](../../api/cell.md#marimo.Cell.run) from+ programs. For example, other programs can [reuse cells][marimo.Cell.run] froma marimo notebook.4. **UI Elements**:diff --git a/docs/guides/configuration/runtime_configuration.md b/docs/guides/configuration/runtime_configuration.mdindex 10832be22b..09091d5e1d 100644--- a/docs/guides/configuration/runtime_configuration.md+++ b/docs/guides/configuration/runtime_configuration.md@@ -45,12 +45,12 @@ when working on notebooks with expensive cells.!!! tip "Tip: speed up expensive notebooks with marimo's smart caching"-In addition to runtime configuration, marimo also provides [opt-in caching](caching.md)+In addition to runtime configuration, marimo also provides [opt-in caching](../../api/caching.md)to help you work with expensive or side-effectful notebooks. marimo'scan cache expensive functions in memory and expensive blocks of code to disk,letting you skip entire sections of your code and automatically loadingvariables in memory on notebook startup. Read our [caching-guide](caching.md) to learn more.+guide](../../api/caching.md) to learn more._When sharing a notebook as an app with `marimo run`, this setting hasno effect._diff --git a/docs/guides/deploying/index.md b/docs/guides/deploying/index.mdindex 62557c2824..915da2bc2a 100644--- a/docs/guides/deploying/index.md+++ b/docs/guides/deploying/index.md@@ -24,7 +24,7 @@ You can deploy marimo in three ways:Here are a few ways to deploy an edit server on a remote instance:1. With [ssh-port forwarding](../../faq.md#faq-remote), using `marimo edit --headless`.-2. Via docker and our [prebuilt containers](../../guides/prebuilt_containers.md).+2. Via docker and our [prebuilt containers](prebuilt_containers.md).3. Via a deployment service [such as Railway](deploying_railway.md).4. [Behind JupyterHub](../../faq.md#faq-jupyter-hub).diff --git a/docs/guides/editor_features/ai_completion.md b/docs/guides/editor_features/ai_completion.mdindex 8311e3a4fb..414322a20b 100644--- a/docs/guides/editor_features/ai_completion.md+++ b/docs/guides/editor_features/ai_completion.md@@ -118,7 +118,7 @@ To locate your configuration file, run:marimo config show```-At the top, the path to your `marimo.toml` file will be shown. You can Ctrl/Cmd+click the path to open it in your editor. For more information about configuration, see the [Configuration Guide](../guides/configuration/index).+At the top, the path to your `marimo.toml` file will be shown. You can Ctrl/Cmd+click the path to open it in your editor. For more information about configuration, see the [Configuration Guide](../configuration/index.md).Below we describe how to connect marimo to your AI provider. Once enabled, you can generate entirely new cells by clicking the "Generate with AI" button at the bottom of your notebook. You can also refactor existing cells by inputting `Ctrl/Cmd-Shift-e` in a cell, opening an input to modify the cell using AI.@@ -181,7 +181,7 @@ model = "gemini-1.5-flash"api_key = "AI..."```-### Using local models with Ollama+### Using local models with Ollama { #using-ollama }Ollama allows you to run open-source LLMs on your local machine. To integrate Ollama with marimo:diff --git a/docs/guides/editor_features/index.md b/docs/guides/editor_features/index.mdindex a904b5f03d..a2e94a3c78 100644--- a/docs/guides/editor_features/index.md+++ b/docs/guides/editor_features/index.md@@ -1,3 +1,4 @@+# Editor featuresThe **marimo editor** is the browser-based IDE in which you write marimodiff --git a/docs/guides/editor_features/package_management.md b/docs/guides/editor_features/package_management.mdindex c7f7d768bd..3bfc70109b 100644--- a/docs/guides/editor_features/package_management.md+++ b/docs/guides/editor_features/package_management.md@@ -18,7 +18,7 @@ This is useful when you want to run marimo in a clean environment without affectmarimo edit --sandbox notebook.py```-### Auto-tracking inline script metadata+### Auto-tracking inline script metadata { #auto-tracking-inline-script-metadata }When running with `--sandbox`, marimo will automatically track the package name metadata in your notebook file, per [PEP 723](https://peps.python.org/pep-0723/). This metadata is used to manage the notebook's dependencies and Python version.diff --git a/docs/guides/expensive_notebooks.md b/docs/guides/expensive_notebooks.mdindex 3d9e04d7d7..b303524628 100644--- a/docs/guides/expensive_notebooks.md+++ b/docs/guides/expensive_notebooks.md@@ -6,17 +6,18 @@ accidentally running.## Stop execution with `mo.stop`-Use [`mo.stop`](#marimo.stop) to stop a cell from executing if a condition+Use [`mo.stop`][marimo.stop] to stop a cell from executing if a conditionis met:-````+```python# if condition is True, the cell will stop executing after mo.stop() returnsmo.stop(condition)# this won't be called if condition is Trueexpensive_function_call()+```-Use [`mo.stop()`](#marimo.stop) in conjunction with-[`mo.ui.run_button()`](#marimo.ui.run_button) to require a button press for+Use [`mo.stop()`][marimo.stop] in conjunction with+[`mo.ui.run_button()`][marimo.ui.run_button] to require a button press forexpensive cells:/// marimo-embed@@ -35,6 +36,7 @@ def __():mo.md("You clicked the button! 🎉")return```+///## Configure how marimo runs cells@@ -64,7 +66,7 @@ execution of other parts. See the### Cache computations with `@mo.cache`-Use [`mo.cache`](#marimo.cache) to cache the return values of+Use [`mo.cache`][marimo.cache] to cache the return values ofexpensive functions, based on their arguments:```python@@ -74,6 +76,7 @@ import modef compute_predictions(problem_parameters):# do some expensive computations and return a value...+```When `compute_predictions` is called with a value of`problem_parameters` it hasn't seen, it will compute the predictions and store@@ -103,7 +106,7 @@ previously computed value from the cache.### Save and load from disk with `mo.persistent_cache`-Use [`mo.persistent_cache`](#marimo.persistent_cache) to cache variables to+Use [`mo.persistent_cache`][marimo.persistent_cache] to cache variables todisk. The next time your run your notebook, the cached variables will be loadedfrom disk instead of being recomputed, letting you pick up where you left off.@@ -121,6 +124,7 @@ with mo.persistent_cache(name="my_cache"):# will be loaded from disk.my_variable = some_expensive_function()...+```Roughly speaking, `mo.persistent_cache` registers a cache hit when the cellis not stale, meaning its code hasn't changed and neither have its ancestors.@@ -139,6 +143,7 @@ import marimo as modata = db.query("SELECT * FROM data")mo.lazy(mo.ui.table(data))+```In this example, `mo.ui.table(data)` will not be rendered on the frontend until is it in the viewport.For example, an element can be out of the viewport due to scroll, inside a tab that is not selected, or inside an accordion that is not open.@@ -157,10 +162,10 @@ def expensive_component():accordion = mo.ui.accordion({"Charts": mo.lazy(expensive_component)})+```In this example, we pass a function to `mo.lazy` instead of a component. Thisfunction will only be called when the user opens the accordion. In this way,`expensive_component` lazily computed and we only query the database when theuser needs to see the data. This can be useful when the data is expensive tocompute and the user may not need to see it immediately.-````diff --git a/docs/guides/index.md b/docs/guides/index.mdindex e2af7405e9..7b80401419 100644--- a/docs/guides/index.md+++ b/docs/guides/index.md@@ -7,23 +7,23 @@ These guides cover marimo's core concepts.Prefer a hands-on learning experience? marimo comes packaged with interactivetutorials that you can launch with `marimo tutorial` at the command line.-| Guide | Description |-| :----------------------------------- | :----------------------------------------------------------- |-| [reactivity](reactivity.md) | How marimo runs cells |-| [interactivity](interactivity.md) | Using interactive UI elements |-| [outputs](outputs.md) | Creating markdown, plots, and other visual outputs |-| [coming_from/jupyter](coming_from/jupyter.md) | Tips for transitioning from Jupyter |-| [expensive_notebooks](expensive_notebooks.md) | Tips for working with expensive notebooks |-| [working_with_data/index](working_with_data/index.md) | Using SQL cells, no-code dataframe tools, and reactive plots |-| [editor_features/index](editor_features/index.md) | View variables, dataframe schemas, docstrings, and more |-| [configuration/index](configuration/index.md) | Configure various settings |-| [apps](apps.md) | Running notebooks as apps |-| [scripts](scripts.md) | Running notebooks as scripts |-| [coming_from/index](coming_from/index.md) | Transitioning from Jupyter and other tools |-| [integrating_with_marimo/index](integrating_with_marimo/index.md) | Rich displays of objects, custom UI plugins |-| [state](state.md) | Advanced: mutable reactive state |-| [wasm](wasm.md) | Create notebooks in our online playground |-| [exporting](exporting.md) | Exporting notebooks to HTML and flat scripts |-| [deploying/index](deploying/index.md) | Deploying marimo notebooks and apps |-| [best_practices](best_practices.md) | Best practices to help you get the most out of marimo |-| [troubleshooting](troubleshooting.md) | Troubleshooting notebooks |+| Guide | Description |+| :--------------------------------------------------- | :----------------------------------------------------------- |+| [Reactive execution](reactivity.md) | Understanding how marimo runs cells |+| [Interactive elements](interactivity.md) | Using interactive UI elements |+| [Visualizing outputs](outputs.md) | Creating markdown, plots, and other visual outputs |+| [Migrating from Jupyter](coming_from/jupyter.md) | Tips for transitioning from Jupyter |+| [Expensive notebooks](expensive_notebooks.md) | Tips for working with expensive notebooks |+| [Working with data](working_with_data/index.md) | Using SQL cells, no-code dataframe tools, and reactive plots |+| [Apps](apps.md) | Running notebooks as apps |+| [Scripts](scripts.md) | Running notebooks as scripts |+| [Export to HTML and other formats](exporting.md) | Exporting notebooks to HTML and flat scripts |+| [Run notebooks with WebAssembly](wasm.md) | Create notebooks in our online playground |+| [Deploying](deploying/index.md) | Deploying marimo notebooks and apps |+| [Editor Features](editor_features/index.md) | View variables, dataframe schemas, docstrings, and more |+| [Configuration](configuration/index.md) | Configure various settings |+| [Coming from other tools](coming_from/index.md) | Transitioning from Jupyter and other tools |+| [Extending marimo](integrating_with_marimo/index.md) | Rich displays of objects, custom UI plugins |+| [State management](state.md) | Advanced: mutable reactive state |+| [Best practices](best_practices.md) | Best practices to help you get the most out of marimo |+| [Troubleshooting](troubleshooting.md) | Troubleshooting notebooks |diff --git a/docs/guides/integrating_with_marimo/custom_ui_plugins.md b/docs/guides/integrating_with_marimo/custom_ui_plugins.mdindex 9b0cef9c34..596a6d180d 100644--- a/docs/guides/integrating_with_marimo/custom_ui_plugins.md+++ b/docs/guides/integrating_with_marimo/custom_ui_plugins.md@@ -1 +1,3 @@-[Visit the AnyWidget API docs](../../api/inputs/anywidget.md) for more information.+Build custom UI plugins that hook into marimo’s reactive execution engine by+using [anywidget](https://anywidget.dev/). [See our AnyWidget API+docs](../../api/inputs/anywidget.md) for more information.diff --git a/docs/guides/integrating_with_marimo/displaying_objects.md b/docs/guides/integrating_with_marimo/displaying_objects.mdindex 36b36237a2..86e74fd95f 100644--- a/docs/guides/integrating_with_marimo/displaying_objects.md+++ b/docs/guides/integrating_with_marimo/displaying_objects.md@@ -5,7 +5,7 @@ Python objects like lists and dicts as well as marimo objects like [UIelements](../interactivity.md) and libraries, including matplotlib,seaborn, Plotly, altair pandas, and more. These rich representations aredisplayed for the last expression of a cell, or when using-[`mo.output.append`](#marimo.output.append).+[`mo.output.append`][marimo.output.append].You can register rich displays with marimo for your own objects. You havethree options:diff --git a/docs/guides/integrating_with_marimo/index.md b/docs/guides/integrating_with_marimo/index.mdindex dd01503525..6d87da5d49 100644--- a/docs/guides/integrating_with_marimo/index.md+++ b/docs/guides/integrating_with_marimo/index.md@@ -9,7 +9,7 @@ Still need help? Reach out to us on [Discord](https://marimo.io/discord?ref=docs!!! tip "Checking if running in a marimo notebook"You can check if Python is running in a marimo notebook with- [`mo.running_in_notebook`](#marimo.running_in_notebook). This can be helpful+ [`mo.running_in_notebook`][marimo.running_in_notebook]. This can be helpfulwhen developing library code that integrates with marimo.| Guide | Description |diff --git a/docs/guides/interactivity.md b/docs/guides/interactivity.mdindex 725f40779b..89e2793789 100644--- a/docs/guides/interactivity.md+++ b/docs/guides/interactivity.md@@ -2,7 +2,7 @@One of marimo's most powerful features is its first-class support forinteractive, stateful user interface (UI) elements, or "widgets": create them using-[`marimo.ui`](../api/inputs/index/). **Interacting with a UI element bound to a+[`marimo.ui`](../api/inputs/index.md). **Interacting with a UI element bound to aglobal variable automatically runs all cells that reference it.**<div align="center">@@ -34,25 +34,26 @@ assigned to a global variable.**Display UI elements in the output area above a cell by including them in thelast expression, just like any other object. You can also embed elements-in [markdown](#marimo.md) using Python f-strings, like so:+in [markdown][marimo.md]using Python f-strings, like so:```python3slider = mo.ui.slider(1, 10)mo.md(f"Choose a value: {slider})")+```## Composite elementsComposite elements are advanced elements let you build UI elements out of otherUI elements. The following composite elements are available:-- [`mo.ui.array`](#marimo.ui.array)-- [`mo.ui.dictionary`](#marimo.ui.dictionary)-- [`mo.ui.batch`](#marimo.ui.batch)-- [`mo.ui.form`](#marimo.ui.form)+- [`mo.ui.array`][marimo.ui.array]+- [`mo.ui.dictionary`][marimo.ui.dictionary]+- [`mo.ui.batch`][marimo.ui.batch]+- [`mo.ui.form`][marimo.ui.form]**Arrays and dictionaries.**-Use [`mo.ui.array`](#marimo.ui.array) and-[`mo.ui.dictionary`](#marimo.ui.dictionary) to logically group together related+Use [`mo.ui.array`][marimo.ui.array] and+[`mo.ui.dictionary`][marimo.ui.dictionary] to logically group together relatedelements. These elements are especially useful when a set of UI elements isonly known at runtime (so you can't assign each to a global variableindividually, but can assign them to an array or dictionary).diff --git a/docs/guides/outputs.md b/docs/guides/outputs.mdindex 7a9537c7ec..e90edc5e96 100644--- a/docs/guides/outputs.md+++ b/docs/guides/outputs.md@@ -3,7 +3,7 @@The last expression of a cell is its visual output, rendered above the cell.Outputs are included in the "app" or read-only view of the notebook. marimocomes out of the box a number of elements to help you make rich outputs,-documented in the [API reference](../api/index/).+documented in the [API reference](../api/index.md).<div align="center"><figure>@@ -13,7 +13,7 @@ documented in the [API reference](../api/index/).## Markdown-Markdown is written with the marimo library function [`mo.md`](../api/markdown/).+Markdown is written with the marimo library function [`mo.md`][marimo.md].Writing markdown programmatically lets you make dynamic markdown: interpolatePython values into markdown strings, conditionally render your markdown, andembed markdown in other objects.@@ -44,11 +44,11 @@ mo.md(```Notice that marimo knows how to render marimo objects in markdown: you can just-embed them in [`mo.md()`](../api/markdown) using an f-string, and marimo will+embed them in [`mo.md()`][marimo.md] using an f-string, and marimo willfigure out how to display them!For other objects, like matplotlib plots, wrap-them in [`mo.as_html()`](api/html/#marimo.as_html) to tap into marimo's+them in [`mo.as_html()`][marimo.as_html] to tap into marimo'smedia viewer:```python@@ -81,15 +81,15 @@ top right.## LayoutThe marimo library also comes with elements for laying out outputs, including-[`mo.hstack`](#marimo.hstack), [`mo.vstack`](#marimo.vstack),-[`mo.accordion`](#marimo.accordion), [`mo.ui.tabs`](#marimo.ui.tabs), [`mo.sidebar`](#marimo.sidebar),-[`mo.nav_menu`](#marimo.nav_menu), [`mo.ui.table`](#marimo.ui.table),-and [many more](https://docs.marimo.io/api/layouts/index.html).+[`mo.hstack`][marimo.hstack], [`mo.vstack`][marimo.vstack],+[`mo.accordion`][marimo.accordion], [`mo.ui.tabs`][marimo.ui.tabs], [`mo.sidebar`][marimo.sidebar],+[`mo.nav_menu`][marimo.nav_menu], [`mo.ui.table`][marimo.ui.table],+and [many more](../api/layouts/index.md).## Progress bars-Use [`mo.status.progress_bar`](#marimo.status.progress_bar) and-[`mo.status.spinner`](#marimo.status.progress_bar) to create progress indicators:+Use [`mo.status.progress_bar`][marimo.status.progress_bar] and+[`mo.status.spinner`][marimo.status.spinner] to create progress indicators:```python# mo.status.progress_bar is similar to TQDM@@ -108,8 +108,8 @@ video, pdfs, and more. See the [API docs](../api/media/index.md) for more info.While a cell's output is its last expression, it can at times be helpfulto imperatively add to the output area while a cell is running. marimoprovides utility functions like-[`mo.output.append`](#marimo.output.append) for accomplishing this; see the-[API docs](api/outputs.md) for more information.+[`mo.output.append`][marimo.output.append] for accomplishing this; see the+[API docs](../api/outputs.md) for more information.## Console Outputs@@ -117,22 +117,20 @@ Console outputs, such as print statements, show up below a cell in the consoleoutput area; they are not included in the output area or app view by default.To include console outputs in the cell output area, use-[`mo.redirect_stdout`](#marimo.redirect_stdout) or-[`mo.redirect_stderr`](#marimo.redirect_stderr):+[`mo.redirect_stdout`][marimo.redirect_stdout] or+[`mo.redirect_stderr`][marimo.redirect_stderr]:```pythonwith mo.redirect_stdout():print("Hello, world!")```-marimo also includes utility functions for [capturing standard out](#marimo.capture_stdout) and [standard-error](#marimo.capture_stderr) without redirecting them. See the [API-docs](api/outputs.md#console-outputs) for more.+marimo also includes utility functions for [capturing standard out][marimo.capture_stdout] and [standard error][marimo.capture_stderr] without redirecting them. See the [API docs](../api/outputs.md#console-outputs) for more.## ThreadingTo create a thread that can reliably communicate outputs to the frontend,-use [`mo.Thread`](#marimo.Thread), which has exactly the same API as+use [`mo.Thread`][marimo.Thread], which has exactly the same API asas `threading.Thread`.If you need to forward outputs from threads spawned by third-party code, trydiff --git a/docs/guides/reactivity.md b/docs/guides/reactivity.mdindex fc293800b7..37998f14ea 100644--- a/docs/guides/reactivity.md+++ b/docs/guides/reactivity.md@@ -16,7 +16,7 @@ Reactive execution is based on a single rule:!!! tip "Working with expensive notebooks"marimo gives you tools that make it easy to work with expensive notebooks. Forexample, the [runtime can be- configured](../configuration/runtime_configuration.md) to be lazy, only+ configured](configuration/runtime_configuration.md) to be lazy, onlyrunning cells when you ask for them to be run and marking affected cells asstale instead of auto-running them. **See our guide on working with [expensivenotebooks](expensive_notebooks.md) for more tips.**@@ -106,17 +106,21 @@ _Don't_ do this:```pythonl = [1]+``````pythonl.append(2)+```_Instead_, do this:```pythonl = [1]+``````pythonextended_list = l + [2]+```**Mutate variables in the cells that define them.**@@ -124,15 +128,18 @@ _Don't_ do this:```pythondf = pd.DataFrame({"my_column": [1, 2]})+``````pythondf["another_column"] = [3, 4]+```_Instead_, do this:```pythondf = pd.DataFrame({"my_column": [1, 2]})df["another_column"] = [3, 4]+```!!! note "Why not track mutations?"Tracking mutations reliably is a fundamentally impossible task in Python; marimo@@ -146,7 +153,7 @@ df["another_column"] = [3, 4]Through the notebook settings menu, you can configure how and when marimo runscells. In particular, you can disable autorun on startup, disable autorunon cell execution, and enable a powerful module autoreloader. Read our-[runtime configuration guide](../configuration/runtime_configuration.md) to learn more.+[runtime configuration guide](configuration/runtime_configuration.md) to learn more.## Disabling cellsdiff --git a/docs/guides/state.md b/docs/guides/state.mdindex afd7ff6e78..5650ee7276 100644--- a/docs/guides/state.md+++ b/docs/guides/state.md@@ -9,7 +9,7 @@interval, while `mo.ui.button()` has a value that can be configured tocount the number of times it has been clicked, or to toggle between `True` and`False`. Additionally, interacting with UI elements bound to global variables- [automatically executes cells](guides/interactivity) that reference those+ [automatically executes cells](../guides/interactivity.md) that reference thosevariables, letting you react to changes by just reading their`value` attributes. This functional paradigm is the preferred way ofreacting to UI interactions in marimo. So if you@@ -64,14 +64,11 @@ function **via a global variable** are automatically run (similar to UIelements).!!! note "State and UI elements are similar"-State is analogous to UI elements. When you interact-with a UI element, all cells that reference that element via a global variable-run automatically with the new value. In the same way, when you update state-via the setter, all other cells that reference the getter via-a global variable run automatically with the new value.-- State is particularly useful when used in conjunction with a `UIElement`'s- `on_change` callback to run side effects based on user input.+ State is analogous to UI elements. When you interact+ with a UI element, all cells that reference that element via a global variable+ run automatically with the new value. In the same way, when you update state+ via the setter, all other cells that reference the getter via+ a global variable run automatically with the new value.[`mo.state()`](../api/state.md) takes an initial state value as its argument, createsa state object, and returnsdiff --git a/docs/guides/wasm.md b/docs/guides/wasm.mdindex becec89ffc..277fdd4e04 100644--- a/docs/guides/wasm.md+++ b/docs/guides/wasm.md@@ -158,6 +158,7 @@ providing your users with an interactive code playground.height="300"frameborder="0"></iframe>+```<iframe src="https://marimo.app/l/aojjhb?embed=true" width="100%" height="300" class="demo" frameBorder="0"></iframe>@@ -173,6 +174,7 @@ URL to your notebook](#creating-and-sharing-wasm-notebooks), then put it in an iheight="300"frameborder="0"></iframe>+```<iframe src="https://marimo.app/l/c7h6pz?embed=true" width="100%" height="600" class="demo" frameBorder="0"></iframe>@@ -191,6 +193,7 @@ You can optionally render embedded notebooks in read-only mode by appendingheight="300"frameborder="0"></iframe>+```<iframe src="https://marimo.app/l/c7h6pz?mode=read&embed=true" width="100%" height="600" class="demo" frameBorder="0"></iframe>diff --git a/docs/guides/working_with_data/dataframes.md b/docs/guides/working_with_data/dataframes.mdindex 227e117a51..6b93b2ce8d 100644--- a/docs/guides/working_with_data/dataframes.md+++ b/docs/guides/working_with_data/dataframes.md@@ -51,7 +51,7 @@ df///-To opt out of the rich dataframe viewer, use [`mo.plain`](../../api/outputs.md#marimo.plain):+To opt out of the rich dataframe viewer, use [`mo.plain`][marimo.plain]:/// tab | pandas@@ -79,7 +79,7 @@ mo.plain(df)### No-code transformations-Use [`mo.ui.dataframe`](../../api/inputs/dataframe.md) to interactively+Use [`mo.ui.dataframe`][marimo.ui.dataframe] to interactivelytransform a dataframe with a GUI, no coding required. When you're done, youcan copy the code that the GUI generated for you and paste it into yournotebook.@@ -194,9 +194,9 @@ mo.ui.table(filtered_df)## Select dataframe rows {#selecting-dataframes}Display dataframes as interactive, [selectable charts](plotting.md) using-[`mo.ui.altair_chart`](../../api/plotting.md#marimo.ui.altair_chart) or-[`mo.ui.plotly`](../../api/plotting.md#marimo.ui.plotly), or as a row-selectable table with-[`mo.ui.table`](../../api/inputs/table.md). Select points in the chart, or select a table+[`mo.ui.altair_chart`][marimo.ui.altair_chart] or+[`mo.ui.plotly`][marimo.ui.plotly], or as a row-selectable table with+[`mo.ui.table`][marimo.ui.table]. Select points in the chart, or select a tablerow, and your selection is _automatically sent to Python as a subset of the originaldataframe_.diff --git a/docs/guides/working_with_data/plotting.md b/docs/guides/working_with_data/plotting.mdindex 135ee98b5b..6440e65e9f 100644--- a/docs/guides/working_with_data/plotting.md+++ b/docs/guides/working_with_data/plotting.md@@ -5,15 +5,15 @@ Plotly, Altair, and HoloViews. Just import your plotting library of choice anduse it as you normally would.For Altair and Plotly plots, marimo does something special: use-[`mo.ui.altair_chart`](../../api/plotting.md#marimo.ui.altair_chart) or-[`mo.ui.plotly`](../../api/plotting.md#marimo.ui.plotly) to connect frontend+[`mo.ui.altair_chart`][marimo.ui.altair_chart] or+[`mo.ui.plotly`][marimo.ui.plotly] to connect frontendselections to Python!!!! important "Reactive plots!"marimo supports reactive plots via- [`mo.ui.altair_chart`](../../api/plotting.md#marimo.ui.altair_chart) and- [`mo.ui.plotly`](../../api/plotting.md#marimo.ui.plotly)! Select and+ [`mo.ui.altair_chart`][marimo.ui.altair_chart] and+ [`mo.ui.plotly`][marimo.ui.plotly]! Select andfilter with your mouse, and marimo _automatically makes the selected dataavailable in Python as a Pandas dataframe_!@@ -62,7 +62,7 @@ def __():///-Use [`mo.ui.altair_chart`](../../api/plotting.md#marimo.ui.altair_chart) to easily+Use [`mo.ui.altair_chart`][marimo.ui.altair_chart] to easilycreate interactive, selectable plots: _selections you make on the frontend areautomatically made available as Pandas dataframes in Python._@@ -72,7 +72,7 @@ automatically made available as Pandas dataframes in Python._</figure></div>-Wrap an Altair chart in [`mo.ui.altair_chart`](../../api/plotting.md#marimo.ui.altair_chart)+Wrap an Altair chart in [`mo.ui.altair_chart`][marimo.ui.altair_chart]to make it **reactive**: select data on the frontend, access it via the chart's`value` attribute (`chart.value`).@@ -178,16 +178,16 @@ encoding, marimo will add a legend and a click selection.#### Automatic Selections-By default [`mo.ui.altair_chart`](../../api/plotting.md#marimo.ui.altair_chart)+By default [`mo.ui.altair_chart`][marimo.ui.altair_chart]will make the chart and legend selectable. Depending on the mark type, thechart will either have a `point` or `interval` ("brush") selection. When usingnon-positional encodings (color, size, etc),-[`mo.ui.altair_chart`](../../api/plotting.md#marimo.ui.altair_chart) will also+[`mo.ui.altair_chart`][marimo.ui.altair_chart] will alsomake the legend selectable.Selection configurable through `*_selection` params in-[`mo.ui.altair_chart`](../../api/plotting.md#marimo.ui.altair_chart). See the [API-docs](../../api/plotting.md#marimo.ui.altair_chart) for details.+[`mo.ui.altair_chart`][marimo.ui.altair_chart]. See the [API+docs][marimo.ui.altair_chart] for details.!!! noteYou may still add your own selection parameters via Altair or Vega-Lite.@@ -210,9 +210,9 @@ conda install -c conda-forge "vegafusion-python-embed>=1.4.0" "vegafusion>=1.4.0!!! warning "mo.ui.plotly only supports scatter plots, treemaps charts, and sunbursts charts"- marimo can render any Plotly plot, but [`mo.ui.plotly`](../../api/plotting.md#marimo.ui.plotly) only+ marimo can render any Plotly plot, but [`mo.ui.plotly`][marimo.ui.plotly] onlysupports reactive selections for scatter plots, treemaps charts, and sunbursts charts. If you require other kinds of- selection, consider using [`mo.ui.altair_chart`](../../api/plotting.md#marimo.ui.altair_chart).+ selection, consider using [`mo.ui.altair_chart`][marimo.ui.altair_chart]./// marimo-embedsize: large@@ -244,11 +244,9 @@ def __(plot):///-Use [`mo.ui.plotly`](../../api/plotting.md#marimo.ui.plotly) to create+Use [`mo.ui.plotly`][marimo.ui.plotly] to createselectable Plotly plots whose values are sent back to Python on selection.-::: marimo.ui.plotly-## matplotlibTo output a matplotlib plot in a cell's output area, include its `Axes` or@@ -275,5 +273,5 @@ If you want to output the plot in the console area, use `plt.show()` or### Interactive plotsTo make matplotlib plots interactive, use-[mo.mpl.interactive](../../api/plotting.md#marimo.mpl.interactive).+[mo.mpl.interactive][marimo.mpl.interactive].(Matplotlib plots are not yet reactive.)diff --git a/docs/index.md b/docs/index.mdindex 668f22dcef..9b1ce21a62 100644--- a/docs/index.md+++ b/docs/index.md@@ -109,7 +109,7 @@ Organize your notebooks to best fit the stories you'd like to tell.**Built-in package management.** marimo has built-in support for all majorpackage managers, letting you install packages on import. marimo can even[serialize package-requirements](guides/editor_features/package_management.md#auto-add-inline-script-metadata-uv-only)+requirements](guides/editor_features/package_management.md#auto-tracking-inline-script-metadata)in notebook files, and auto install them in[isolated venv sandboxes](guides/editor_features/package_management.md#running-marimo-in-a-sandbox-environment-uv-only).diff --git a/docs/recipes.md b/docs/recipes.mdindex 7870506f89..0c61be8362 100644--- a/docs/recipes.md+++ b/docs/recipes.md@@ -40,7 +40,7 @@ condition = Trueimport marimo as mo```-2. Create a [`mo.ui.refresh`](api/inputs/refresh.md#marimo.ui.refresh) timer that fires once a second:+1. Create a [`mo.ui.refresh`][marimo.ui.refresh] timer that fires once a second:```pythonrefresh = mo.ui.refresh(default_interval="1s")@@ -59,14 +59,10 @@ refreshmo.md("#" + "🍃" * random.randint(1, 10))```-```{admonition} Requires "on cell change" autorun-:class: note--For this to work, the [runtime configuration's](/guides/configuration/runtime_configuration.md) `on cell change` should be-set to `autorun`-```--+!!! note "Requires 'on cell change' autorun"+ For this to work, the [runtime+ configuration's](guides/configuration/runtime_configuration.md) `on cell+ change` should be set to `autorun`### Require form submission before sending UI value@@ -119,7 +115,7 @@ form = mo.ui.text(label="Your name").form()form```-3. Use [`mo.stop`](api/control_flow.md#marimo.stop) to stop execution when+3. Use [`mo.stop`][marimo.stop] to stop execution whenthe form is unsubmitted.```python@@ -144,7 +140,7 @@ such as `l = [mo.ui.slider(1, 10) for i in range(number.value)]`: _however,this won't work, because the sliders are not bound to global variables_.For such cases, marimo provides the "higher-order" UI element-[`mo.ui.array`](api/inputs/array.md#marimo.ui.array), which lets you make+[`mo.ui.array`][marimo.ui.array], which lets you makea new UI element out of a list of UI elements:`l = mo.ui.array([mo.ui.slider(1, 10) for i in range(number.value)])`.The value of an `array` element is a list of the values of the elements@@ -160,7 +156,7 @@ by name (in this case, "`l`") will run automatically.import marimo as mo```-2. Use [`mo.ui.array`](api/inputs/array.md#marimo.ui.array) to group together+1. Use [`mo.ui.array`][marimo.ui.array] to group togethermany UI elements into a list.```python@@ -191,7 +187,7 @@ name each of the wrapped elements with a string key.import marimo as mo```-2. Use [`mo.ui.dictionary`](api/inputs/dictionary.md#marimo.ui.dictionary) to+2. Use [`mo.ui.dictionary`][marimo.ui.dictionary] togroup together many UI elements into a list.```python@@ -223,8 +219,8 @@ import marimo as mo```2. Group the elements with-[`mo.ui.dictionary`](#marimo.ui.dictionary) or-[`mo.ui.array`](#marimo.ui.array), then retrieve them from the container+[`mo.ui.dictionary`][marimo.ui.dictionary] or+[`mo.ui.array`][marimo.ui.array], then retrieve them from the containerand display them elsewhere.```python@@ -373,8 +369,8 @@ of the form sends all its elements to Python.import marimo as mo```-2. Use [`mo.ui.form`](api/inputs/form.md#marimo.ui.form) and-[`Html.batch`](api/html.md#marimo.Html.batch) to create a form with+1. Use [`mo.ui.form`][marimo.ui.form] and+[`Html.batch`][marimo.Html.batch] to create a form withmultiple elements.```python@@ -420,6 +416,7 @@ examples = mo.ui.dropdown(label="examples",)```+3. Create form from examples.```@@ -498,7 +495,7 @@ it has been clicked, is a helpful building block for reacting to button clicksimport marimo as mo```-2. Use [`mo.ui.button`](api/inputs/button.md#marimo.ui.button) and its+2. Use [`mo.ui.button`][marimo.ui.button] and its`on_click` argument to create a counter button.```python@@ -517,7 +514,7 @@ button.value**Use cases.** Toggle between two states using a button with a buttonthat toggles between `True` and `False`. (Tip: you can also just use-[`mo.ui.switch`](api/inputs/switch.md#marimo.ui.switch).)+[`mo.ui.switch`][marimo.ui.switch].)**Recipe.**@@ -527,7 +524,7 @@ that toggles between `True` and `False`. (Tip: you can also just useimport marimo as mo```-2. Use [`mo.ui.button`](api/inputs/button.md#marimo.ui.button) and its+2. Use [`mo.ui.button`][marimo.ui.button] and its`on_click` argument to create a toggle button.```python@@ -640,7 +637,7 @@ for different configurations of the elements would greatly speed up your noteboo**Recipe.**-1. Use [`mo.cache`](#marimo.cache) to cache function outputs given inputs.+1. Use [`mo.cache`][marimo.cache] to cache function outputs given inputs.```pythonimport marimo as mo@@ -663,7 +660,7 @@ results, you may want to save the state of your computations to disk. Ideally,if you update your code, then this save should be invalidated. It may also beadvantageous to add UI elements to explore your results, without having torecompute expensive computations. You can achieve this with-[`mo.persistent_cache`](#marimo.persistent_cache).+[`mo.persistent_cache`][marimo.persistent_cache].**Recipe.**diff --git a/mkdocs.yml b/mkdocs.ymlindex 514afcb58e..cf1b405931 100644--- a/mkdocs.yml+++ b/mkdocs.yml@@ -92,7 +92,8 @@ nav:- Prebuilt containers: guides/deploying/prebuilt_containers.md- Programmatic: guides/deploying/programmatically.md- Editor features:- - Overview: guides/editor_features/index.md+ - TODO: guides/editor_features/index.md+ - Overview: guides/editor_features/overview.md- AI Completion: guides/editor_features/ai_completion.md- Hotkeys: guides/editor_features/hotkeys.md- Package Management: guides/editor_features/package_management.md