Skip to content

Commit

Permalink
Update exported notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
mscolnick authored and github-actions[bot] committed Feb 7, 2025
1 parent c8a2d09 commit 9ad6898
Show file tree
Hide file tree
Showing 316 changed files with 2,113 additions and 1,564 deletions.
54 changes: 27 additions & 27 deletions generated/examples/ui/arrays_and_dicts.py.ipynb

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions generated/examples/ui/arrays_and_dicts.py.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
---
title: Arrays And Dicts
marimo-version: 0.9.34
marimo-version: 0.11.0
---

```python {.marimo}
import marimo as mo
import random
```

# Arrays and Dictionaries
<!---->
Use `mo.ui.array` and `mo.ui.dictionary` to create UI elements that wrap
Expand All @@ -12,17 +17,17 @@ Because UI elements must be assigned to global variables,
these functions are required when the set of elements to create is not
known until runtime.

```{.python.marimo}
```python {.marimo}
create = mo.ui.button(label="Create new collections")
```

```{.python.marimo}
```python {.marimo}
create.center()
```

UI Elements ...

```{.python.marimo}
```python {.marimo}
create

array = mo.ui.array(
Expand All @@ -38,15 +43,15 @@ mo.hstack([array, dictionary], justify="space-around")

... and their values

```{.python.marimo}
```python {.marimo}
mo.hstack([array.value, dictionary.value], justify="space-around")
```

Key difference between marimo dict and standard python dict:

The main reason to use `mo.ui.dictionary` is for reactive execution — when you interact with an element in a `mo.ui.dictionary`, all cells that reference the `mo.ui.dictionary` run automatically, just like all other ui elements. When you use a regular dictionary, you don't get this reactivity.

```{.python.marimo hide_code="true"}
```python {.marimo hide_code="true"}
create

slider = mo.ui.slider(1, 10, show_value=True)
Expand Down Expand Up @@ -77,7 +82,7 @@ mo.hstack(
)
```

```{.python.marimo hide_code="true"}
```python {.marimo hide_code="true"}
mo_d_ref = {k: mo_d[k].value for k in mo_d.value.keys()}
py_d_ref = {k: py_d[k].value for k in py_d.keys()}
mo.hstack(
Expand All @@ -89,9 +94,4 @@ mo.hstack(
)
```

Notice that when you interact with the UI elements in the marimo dict, the reference of marimo dict updates automatically. However, when you interact with the elements in the python dict, you need to manually re-run the cell to see the updated values.

```{.python.marimo}
import marimo as mo
import random
```
Notice that when you interact with the UI elements in the marimo dict, the reference of marimo dict updates automatically. However, when you interact with the elements in the python dict, you need to manually re-run the cell to see the updated values.
2 changes: 1 addition & 1 deletion generated/examples/ui/arrays_and_dicts.script.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

__generated_with = "0.9.34"
__generated_with = "0.11.0"

# %%
import marimo as mo
Expand Down
40 changes: 20 additions & 20 deletions generated/examples/ui/batch_and_form.py.ipynb
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
{
"cells": [
{
"cell_type": "markdown",
"cell_type": "code",
"execution_count": null,
"id": "Hbol",
"metadata": {},
"outputs": [],
"source": [
"# Batch and Form"
"import marimo as mo"
]
},
{
"cell_type": "markdown",
"id": "MJUe",
"metadata": {},
"source": [
"# Batch and Form"
]
},
{
"cell_type": "markdown",
"id": "vblA",
"metadata": {},
"source": [
"Make custom UI elements using `batch()`, and turn any UI element\n",
"into a form with `form()`."
Expand All @@ -20,15 +30,15 @@
{
"cell_type": "code",
"execution_count": null,
"id": "vblA",
"id": "bkHC",
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"&lt;marimo-form data-initial-value=&#x27;null&#x27; data-label=&#x27;null&#x27; data-element-id=&#x27;&amp;quot;vblA-7&amp;quot;&#x27; data-loading=&#x27;false&#x27; data-bordered=&#x27;false&#x27; data-submit-button-label=&#x27;&amp;quot;Submit&amp;quot;&#x27; data-submit-button-disabled=&#x27;false&#x27; data-clear-on-submit=&#x27;false&#x27; data-show-clear-button=&#x27;true&#x27; data-clear-button-label=&#x27;&amp;quot;Clear&amp;quot;&#x27; data-should-validate=&#x27;false&#x27;&gt;&lt;marimo-ui-element object-id=&#x27;vblA-7&#x27; random-id=&#x27;47378190-96da-1dac-72ff-5d2a386ecbe0&#x27;&gt;&lt;marimo-dict data-initial-value=&#x27;{&amp;quot;x&amp;quot;: 1, &amp;quot;y&amp;quot;: 1}&#x27; data-label=&#x27;null&#x27; data-element-ids=&#x27;{&amp;quot;vblA-5&amp;quot;: &amp;quot;x&amp;quot;, &amp;quot;vblA-6&amp;quot;: &amp;quot;y&amp;quot;}&#x27;&gt;&lt;span class=&quot;markdown prose dark:prose-invert&quot;&gt;&lt;span class=&quot;paragraph&quot;&gt;Choose your variable values&lt;/span&gt;\n",
"&lt;span class=&quot;paragraph&quot;&gt;&lt;marimo-ui-element object-id=&#x27;vblA-5&#x27; random-id=&#x27;b74d0fb1-32e7-0629-8fad-c1a606cb0fb3&#x27;&gt;&lt;marimo-slider data-initial-value=&#x27;1&#x27; data-label=&#x27;&amp;quot;&amp;lt;span class=&amp;#92;&amp;quot;markdown prose dark:prose-invert&amp;#92;&amp;quot;&amp;gt;&amp;lt;span class=&amp;#92;&amp;quot;paragraph&amp;#92;&amp;quot;&amp;gt;&amp;lt;marimo-tex class=&amp;#92;&amp;quot;arithmatex&amp;#92;&amp;quot;&amp;gt;||(x =||)&amp;lt;/marimo-tex&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;quot;&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-step=&#x27;1&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;&lt;/marimo-ui-element&gt;&lt;/span&gt;\n",
"&lt;span class=&quot;paragraph&quot;&gt;&lt;marimo-ui-element object-id=&#x27;vblA-6&#x27; random-id=&#x27;6b65a6a4-8b81-48f6-b38a-088ca65ed389&#x27;&gt;&lt;marimo-slider data-initial-value=&#x27;1&#x27; data-label=&#x27;&amp;quot;&amp;lt;span class=&amp;#92;&amp;quot;markdown prose dark:prose-invert&amp;#92;&amp;quot;&amp;gt;&amp;lt;span class=&amp;#92;&amp;quot;paragraph&amp;#92;&amp;quot;&amp;gt;&amp;lt;marimo-tex class=&amp;#92;&amp;quot;arithmatex&amp;#92;&amp;quot;&amp;gt;||(y =||)&amp;lt;/marimo-tex&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;quot;&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-step=&#x27;1&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;&lt;/marimo-ui-element&gt;&lt;/span&gt;&lt;/span&gt;&lt;/marimo-dict&gt;&lt;/marimo-ui-element&gt;&lt;/marimo-form&gt;"
"&lt;marimo-form data-initial-value=&#x27;null&#x27; data-label=&#x27;null&#x27; data-element-id=&#x27;&amp;quot;bkHC-7&amp;quot;&#x27; data-loading=&#x27;false&#x27; data-bordered=&#x27;false&#x27; data-submit-button-label=&#x27;&amp;quot;Submit&amp;quot;&#x27; data-submit-button-disabled=&#x27;false&#x27; data-clear-on-submit=&#x27;false&#x27; data-show-clear-button=&#x27;true&#x27; data-clear-button-label=&#x27;&amp;quot;Clear&amp;quot;&#x27; data-should-validate=&#x27;false&#x27;&gt;&lt;marimo-ui-element object-id=&#x27;bkHC-7&#x27; random-id=&#x27;47378190-96da-1dac-72ff-5d2a386ecbe0&#x27;&gt;&lt;marimo-dict data-initial-value=&#x27;{&amp;quot;x&amp;quot;: 1, &amp;quot;y&amp;quot;: 1}&#x27; data-label=&#x27;null&#x27; data-element-ids=&#x27;{&amp;quot;bkHC-5&amp;quot;: &amp;quot;x&amp;quot;, &amp;quot;bkHC-6&amp;quot;: &amp;quot;y&amp;quot;}&#x27;&gt;&lt;span class=&quot;markdown prose dark:prose-invert&quot;&gt;&lt;span class=&quot;paragraph&quot;&gt;Choose your variable values&lt;/span&gt;\n",
"&lt;span class=&quot;paragraph&quot;&gt;&lt;marimo-ui-element object-id=&#x27;bkHC-5&#x27; random-id=&#x27;b74d0fb1-32e7-0629-8fad-c1a606cb0fb3&#x27;&gt;&lt;marimo-slider data-initial-value=&#x27;1&#x27; data-label=&#x27;&amp;quot;&amp;lt;span class=&amp;#92;&amp;quot;markdown prose dark:prose-invert&amp;#92;&amp;quot;&amp;gt;&amp;lt;span class=&amp;#92;&amp;quot;paragraph&amp;#92;&amp;quot;&amp;gt;&amp;lt;marimo-tex class=&amp;#92;&amp;quot;arithmatex&amp;#92;&amp;quot;&amp;gt;||(x =||)&amp;lt;/marimo-tex&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;quot;&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-step=&#x27;1&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;&lt;/marimo-ui-element&gt;&lt;/span&gt;\n",
"&lt;span class=&quot;paragraph&quot;&gt;&lt;marimo-ui-element object-id=&#x27;bkHC-6&#x27; random-id=&#x27;6b65a6a4-8b81-48f6-b38a-088ca65ed389&#x27;&gt;&lt;marimo-slider data-initial-value=&#x27;1&#x27; data-label=&#x27;&amp;quot;&amp;lt;span class=&amp;#92;&amp;quot;markdown prose dark:prose-invert&amp;#92;&amp;quot;&amp;gt;&amp;lt;span class=&amp;#92;&amp;quot;paragraph&amp;#92;&amp;quot;&amp;gt;&amp;lt;marimo-tex class=&amp;#92;&amp;quot;arithmatex&amp;#92;&amp;quot;&amp;gt;||(y =||)&amp;lt;/marimo-tex&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;quot;&#x27; data-start=&#x27;1&#x27; data-stop=&#x27;10&#x27; data-step=&#x27;1&#x27; data-steps=&#x27;[]&#x27; data-debounce=&#x27;false&#x27; data-orientation=&#x27;&amp;quot;horizontal&amp;quot;&#x27; data-show-value=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-slider&gt;&lt;/marimo-ui-element&gt;&lt;/span&gt;&lt;/span&gt;&lt;/marimo-dict&gt;&lt;/marimo-ui-element&gt;&lt;/marimo-form&gt;"
]
},
"metadata": {},
Expand Down Expand Up @@ -61,13 +71,13 @@
{
"cell_type": "code",
"execution_count": null,
"id": "bkHC",
"id": "lEQa",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<marimo-callout-output data-html='&quot;&lt;span class=&#92;&quot;markdown prose dark:prose-invert&#92;&quot;&gt;&lt;span class=&#92;&quot;paragraph&#92;&quot;&gt;At the moment,&#92;n&lt;marimo-tex class=&#92;&quot;arithmatex&#92;&quot;&gt;||(x = &#92;&#92;ldots||)&lt;/marimo-tex&gt; and &lt;marimo-tex class=&#92;&quot;arithmatex&#92;&quot;&gt;||(y = &#92;&#92;ldots||)&lt;/marimo-tex&gt;&lt;/span&gt;&#92;n&lt;span class=&#92;&quot;paragraph&#92;&quot;&gt;All values ever assumed by &lt;marimo-tex class=&#92;&quot;arithmatex&#92;&quot;&gt;||(x||)&lt;/marimo-tex&gt; and &lt;marimo-tex class=&#92;&quot;arithmatex&#92;&quot;&gt;||(y||)&lt;/marimo-tex&gt; are&lt;/span&gt;&#92;n&lt;div style=&#x27;display: flex;flex: 1;flex-direction: row;justify-content: space-between;align-items: center;flex-wrap: nowrap;gap: 4rem&#x27;&gt;&lt;div&gt;&lt;marimo-json-output data-json-data=&#x27;{&amp;quot;x&amp;quot;: &amp;quot;text/plain+set:set()&amp;quot;, &amp;quot;y&amp;quot;: &amp;quot;text/plain+set:set()&amp;quot;}&#x27;&gt;&lt;/marimo-json-output&gt;&lt;/div&gt;&lt;div&gt;&lt;marimo-ui-element object-id=&#x27;PKri-0&#x27; random-id=&#x27;bdd640fb-0667-1ad1-1c80-317fa3b1799d&#x27;&gt;&lt;marimo-button data-initial-value=&#x27;0&#x27; data-label=&#x27;&amp;quot;&amp;lt;span class=&amp;#92;&amp;quot;markdown prose dark:prose-invert&amp;#92;&amp;quot;&amp;gt;&amp;lt;span class=&amp;#92;&amp;quot;paragraph&amp;#92;&amp;quot;&amp;gt;reset history&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;quot;&#x27; data-kind=&#x27;&amp;quot;neutral&amp;quot;&#x27; data-disabled=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-button&gt;&lt;/marimo-ui-element&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&quot;' data-kind='&quot;neutral&quot;'></marimo-callout-output>"
"<marimo-callout-output data-html='&quot;&lt;span class=&#92;&quot;markdown prose dark:prose-invert&#92;&quot;&gt;&lt;span class=&#92;&quot;paragraph&#92;&quot;&gt;At the moment,&#92;n&lt;marimo-tex class=&#92;&quot;arithmatex&#92;&quot;&gt;||(x = &#92;&#92;ldots||)&lt;/marimo-tex&gt; and &lt;marimo-tex class=&#92;&quot;arithmatex&#92;&quot;&gt;||(y = &#92;&#92;ldots||)&lt;/marimo-tex&gt;&lt;/span&gt;&#92;n&lt;span class=&#92;&quot;paragraph&#92;&quot;&gt;All values ever assumed by &lt;marimo-tex class=&#92;&quot;arithmatex&#92;&quot;&gt;||(x||)&lt;/marimo-tex&gt; and &lt;marimo-tex class=&#92;&quot;arithmatex&#92;&quot;&gt;||(y||)&lt;/marimo-tex&gt; are&lt;/span&gt;&#92;n&lt;div style=&#x27;display: flex;flex: 1;flex-direction: row;justify-content: space-between;align-items: center;flex-wrap: nowrap;gap: 4rem&#x27;&gt;&lt;div&gt;&lt;marimo-json-output data-json-data=&#x27;{&amp;quot;x&amp;quot;: &amp;quot;text/plain+set:set()&amp;quot;, &amp;quot;y&amp;quot;: &amp;quot;text/plain+set:set()&amp;quot;}&#x27;&gt;&lt;/marimo-json-output&gt;&lt;/div&gt;&lt;div&gt;&lt;marimo-ui-element object-id=&#x27;Xref-0&#x27; random-id=&#x27;bdd640fb-0667-1ad1-1c80-317fa3b1799d&#x27;&gt;&lt;marimo-button data-initial-value=&#x27;0&#x27; data-label=&#x27;&amp;quot;&amp;lt;span class=&amp;#92;&amp;quot;markdown prose dark:prose-invert&amp;#92;&amp;quot;&amp;gt;&amp;lt;span class=&amp;#92;&amp;quot;paragraph&amp;#92;&amp;quot;&amp;gt;reset history&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;quot;&#x27; data-kind=&#x27;&amp;quot;neutral&amp;quot;&#x27; data-disabled=&#x27;false&#x27; data-full-width=&#x27;false&#x27;&gt;&lt;/marimo-button&gt;&lt;/marimo-ui-element&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&quot;' data-kind='&quot;neutral&quot;'></marimo-callout-output>"
]
},
"metadata": {},
Expand Down Expand Up @@ -98,7 +108,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "lEQa",
"id": "PKri",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -107,24 +117,14 @@
"submitted_values = {\"x\": set(), \"y\": set()}"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "PKri",
"metadata": {},
"outputs": [],
"source": [
"reset = mo.ui.button(label=\"reset history\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "Xref",
"metadata": {},
"outputs": [],
"source": [
"import marimo as mo"
"reset = mo.ui.button(label=\"reset history\")"
]
}
],
Expand Down
18 changes: 9 additions & 9 deletions generated/examples/ui/batch_and_form.py.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
---
title: Batch And Form
marimo-version: 0.9.34
marimo-version: 0.11.0
---

```python {.marimo}
import marimo as mo
```

# Batch and Form
<!---->
Make custom UI elements using `batch()`, and turn any UI element
into a form with `form()`.

```{.python.marimo}
```python {.marimo}
reset

variables = (
Expand All @@ -31,7 +35,7 @@ variables = (
variables
```

```{.python.marimo}
```python {.marimo}
if variables.value is not None:
submitted_values["x"].add(variables.value["x"])
submitted_values["y"].add(variables.value["y"])
Expand All @@ -52,16 +56,12 @@ mo.md(
).callout()
```

```{.python.marimo}
```python {.marimo}
reset

submitted_values = {"x": set(), "y": set()}
```

```{.python.marimo}
```python {.marimo}
reset = mo.ui.button(label="reset history")
```

```{.python.marimo}
import marimo as mo
```
2 changes: 1 addition & 1 deletion generated/examples/ui/batch_and_form.script.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

__generated_with = "0.9.34"
__generated_with = "0.11.0"

# %%
import marimo as mo
Expand Down
Loading

0 comments on commit 9ad6898

Please sign in to comment.