Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
184 changes: 92 additions & 92 deletions marimo/_tutorials/intro.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import marimo

__generated_with = "0.15.5"
__generated_with = "0.16.2"
app = marimo.App()


Expand All @@ -24,14 +24,14 @@ def _(mo):
def _(mo, slider):
mo.md(
f"""
marimo is a **reactive** Python notebook.
marimo is a **reactive** Python notebook.

This means that unlike traditional notebooks, marimo notebooks **run
automatically** when you modify them or
interact with UI elements, like this slider: {slider}.
This means that unlike traditional notebooks, marimo notebooks **run
automatically** when you modify them or
interact with UI elements, like this slider: {slider}.

{"##" + "🍃" * slider.value}
"""
{"##" + "🍃" * slider.value}
"""
)
return

Expand Down Expand Up @@ -73,19 +73,19 @@ def _(mo):
def _(mo):
mo.md(
"""
## 1. Reactive execution
## 1. Reactive execution

A marimo notebook is made up of small blocks of Python code called
cells.
A marimo notebook is made up of small blocks of Python code called
cells.

marimo reads your cells and models the dependencies among them: whenever
a cell that defines a global variable is run, marimo
**automatically runs** all cells that reference that variable.
marimo reads your cells and models the dependencies among them: whenever
a cell that defines a global variable is run, marimo
**automatically runs** all cells that reference that variable.

Reactivity keeps your program state and outputs in sync with your code,
making for a dynamic programming environment that prevents bugs before they
happen.
"""
Reactivity keeps your program state and outputs in sync with your code,
making for a dynamic programming environment that prevents bugs before they
happen.
"""
)
return

Expand Down Expand Up @@ -145,10 +145,10 @@ def _(mo):
def _(mo):
mo.md(
"""
**Global names must be unique.** To enable reactivity, marimo imposes a
constraint on how names appear in cells: no two cells may define the same
variable.
"""
**Global names must be unique.** To enable reactivity, marimo imposes a
constraint on how names appear in cells: no two cells may define the same
variable.
"""
)
return

Expand Down Expand Up @@ -187,16 +187,16 @@ def _(mo):
def _(mo):
mo.md(
"""
## 2. UI elements
## 2. UI elements

Cells can output interactive UI elements. Interacting with a UI
element **automatically triggers notebook execution**: when
you interact with a UI element, its value is sent back to Python, and
every cell that references that element is re-run.
Cells can output interactive UI elements. Interacting with a UI
element **automatically triggers notebook execution**: when
you interact with a UI element, its value is sent back to Python, and
every cell that references that element is re-run.

marimo provides a library of UI elements to choose from under
`marimo.ui`.
"""
marimo provides a library of UI elements to choose from under
`marimo.ui`.
"""
)
return

Expand Down Expand Up @@ -235,21 +235,21 @@ def _(icon, mo, repetitions):
def _(mo):
mo.md(
"""
## 3. marimo is just Python
## 3. marimo is just Python

marimo cells parse Python (and only Python), and marimo notebooks are
stored as pure Python files — outputs are _not_ included. There's no
magical syntax.
marimo cells parse Python (and only Python), and marimo notebooks are
stored as pure Python files — outputs are _not_ included. There's no
magical syntax.

The Python files generated by marimo are:
The Python files generated by marimo are:

- easily versioned with git, yielding minimal diffs
- legible for both humans and machines
- formattable using your tool of choice,
- usable as Python scripts, with UI elements taking their default
values, and
- importable by other modules (more on that in the future).
"""
- easily versioned with git, yielding minimal diffs
- legible for both humans and machines
- formattable using your tool of choice,
- usable as Python scripts, with UI elements taking their default
values, and
- importable by other modules (more on that in the future).
"""
)
return

Expand All @@ -258,15 +258,15 @@ def _(mo):
def _(mo):
mo.md(
"""
## 4. Running notebooks as apps
## 4. Running notebooks as apps

marimo notebooks can double as apps. Click the app window icon in the
bottom-right to see this notebook in "app view."
marimo notebooks can double as apps. Click the app window icon in the
bottom-right to see this notebook in "app view."

Serve a notebook as an app with `marimo run` at the command-line.
Of course, you can use marimo just to level-up your
notebooking, without ever making apps.
"""
Serve a notebook as an app with `marimo run` at the command-line.
Of course, you can use marimo just to level-up your
notebooking, without ever making apps.
"""
)
return

Expand All @@ -275,56 +275,56 @@ def _(mo):
def _(mo):
mo.md(
"""
## 5. The `marimo` command-line tool
## 5. The `marimo` command-line tool

**Creating and editing notebooks.** Use
**Creating and editing notebooks.** Use

```
marimo edit
```
```
marimo edit
```

in a terminal to start the marimo notebook server. From here
you can create a new notebook or edit existing ones.
in a terminal to start the marimo notebook server. From here
you can create a new notebook or edit existing ones.


**Running as apps.** Use
**Running as apps.** Use

```
marimo run notebook.py
```
```
marimo run notebook.py
```

to start a webserver that serves your notebook as an app in read-only mode,
with code cells hidden.
to start a webserver that serves your notebook as an app in read-only mode,
with code cells hidden.

**Convert a Jupyter notebook.** Convert a Jupyter notebook to a marimo
notebook using `marimo convert`:
**Convert a Jupyter notebook.** Convert a Jupyter notebook to a marimo
notebook using `marimo convert`:

```
marimo convert your_notebook.ipynb > your_app.py
```
```
marimo convert your_notebook.ipynb > your_app.py
```

**Tutorials.** marimo comes packaged with tutorials:
**Tutorials.** marimo comes packaged with tutorials:

- `dataflow`: more on marimo's automatic execution
- `ui`: how to use UI elements
- `markdown`: how to write markdown, with interpolated values and
LaTeX
- `plots`: how plotting works in marimo
- `sql`: how to use SQL
- `layout`: layout elements in marimo
- `fileformat`: how marimo's file format works
- `markdown-format`: for using `.md` files in marimo
- `for-jupyter-users`: if you are coming from Jupyter
- `dataflow`: more on marimo's automatic execution
- `ui`: how to use UI elements
- `markdown`: how to write markdown, with interpolated values and
LaTeX
- `plots`: how plotting works in marimo
- `sql`: how to use SQL
- `layout`: layout elements in marimo
- `fileformat`: how marimo's file format works
- `markdown-format`: for using `.md` files in marimo
- `for-jupyter-users`: if you are coming from Jupyter

Start a tutorial with `marimo tutorial`; for example,
Start a tutorial with `marimo tutorial`; for example,

```
marimo tutorial dataflow
```
```
marimo tutorial dataflow
```

In addition to tutorials, we have examples in our
[our GitHub repo](https://www.github.com/marimo-team/marimo/tree/main/examples).
"""
In addition to tutorials, we have examples in our
[our GitHub repo](https://www.github.com/marimo-team/marimo/tree/main/examples).
"""
)
return

Expand All @@ -333,10 +333,10 @@ def _(mo):
def _(mo):
mo.md(
"""
## 6. The marimo editor
## 6. The marimo editor

Here are some tips to help you get started with the marimo editor.
"""
Here are some tips to help you get started with the marimo editor.
"""
)
return

Expand All @@ -357,11 +357,11 @@ def _(mo):
def _(mo):
mo.md(
"""
The name "marimo" is a reference to a type of algae that, under
the right conditions, clumps together to form a small sphere
called a "marimo moss ball". Made of just strands of algae, these
beloved assemblages are greater than the sum of their parts.
"""
The name "marimo" is a reference to a type of algae that, under
the right conditions, clumps together to form a small sphere
called a "marimo moss ball". Made of just strands of algae, these
beloved assemblages are greater than the sum of their parts.
"""
)
return

Expand Down
Loading
Loading