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: update getting started (#3101)
Akshay Agrawaled67b0193e8a
diff --git a/README.md b/README.mdindex 844123c137..f625f76680 100644--- a/README.md+++ b/README.md@@ -183,7 +183,7 @@ the [`examples/`](examples/) folder, and our [gallery](https://marimo.io/gallery<table border="0"><tr><td>- <a target="_blank" href="https://docs.marimo.io/guides/overview.html">+ <a target="_blank" href="https://docs.marimo.io/getting_started/key_concepts.html"><img src="https://docs.marimo.io/_static/reactive.gif" style="max-height: 150px; width: auto; display: block" /></a></td>@@ -205,7 +205,7 @@ the [`examples/`](examples/) folder, and our [gallery](https://marimo.io/gallery</tr><tr><td>- <a target="_blank" href="https://docs.marimo.io/guides/overview.html"> Tutorial </a>+ <a target="_blank" href="https://docs.marimo.io/getting_started/key_concepts.html"> Tutorial </a></td><td><a target="_blank" href="https://docs.marimo.io/api/inputs/index.html"> Inputs </a>diff --git a/README_Chinese.md b/README_Chinese.mdindex 65b63d00d3..3f2dd59716 100644--- a/README_Chinese.md+++ b/README_Chinese.md@@ -142,7 +142,7 @@ Marimo 很容易上手,为高级用户提供了很大的空间。 例如,这<table border="0"><tr><td>- <a target="_blank" href="https://docs.marimo.io/guides/overview.html">+ <a target="_blank" href="https://docs.marimo.io/getting_started/key_concepts.html"><img src="https://docs.marimo.io/_static/reactive.gif" style="max-height: 150px; width: auto; display: block" /></a></td>@@ -164,7 +164,7 @@ Marimo 很容易上手,为高级用户提供了很大的空间。 例如,这</tr><tr><td>- <a target="_blank" href="https://docs.marimo.io/guides/overview.html"> 教程 </a>+ <a target="_blank" href="https://docs.marimo.io/getting_started/key_concepts.html"> 教程 </a></td><td><a target="_blank" href="https://docs.marimo.io/api/inputs/index.html"> 自定义输入 </a>diff --git a/docs/getting_started/index.md b/docs/getting_started/index.mdindex 991aa0e19b..c4beb7567f 100644--- a/docs/getting_started/index.md+++ b/docs/getting_started/index.md@@ -1,211 +1,19 @@# Getting Started-Installing marimo gets you the `marimo` command-line interface (CLI), the entry point to all things marimo.+```{eval-rst}+.. toctree::+ :maxdepth: 2+ :hidden:-## Install marimo--Before installing marimo, we recommend creating and activating a Python-[virtual environment](https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments).--```{dropdown} Setting up a virtual environment--Python uses virtual environments to minimize conflicts among packages.-Here's a quickstart for `pip` users. If you use `conda`, please use a [`conda`-environment](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands)-instead.--Run the following in the terminal:---- create an environment with `python -m venv marimo-env`-- activate the environment:- - macOS/Unix: `source marimo-env/bin/activate`- - Windows: `marimo-env\Scripts\activate`--_Make sure the environment is activated before installing marimo and when-using marimo._ Install other packages you may need, such as numpy, pandas, matplotlib,-and altair, in this environment. When you're done, deactivate the environment-with `deactivate` in the terimnal.--Learn more from the [official Python tutorial](https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments).--:::{admonition} Using uv?-:class: tip--[uv](https://github.com/astral-sh/uv) is a next-generation Python package-installer and manager that is 10-100x faster than pip, and also makes it easy-to install Python and manage projects. With `uv`, creating a virtual-environment is as easy as `uv venv`.-:::-```--To install marimo, run the following in a terminal:--::::{tab-set}-:::{tab-item} install with pip--```bash-pip install marimo-```--:::-:::{tab-item} install with uv--```bash-uv pip install marimo-```--:::-:::{tab-item} install with conda--```bash-conda install -c conda-forge marimo-```--:::-::::--To check if the install worked, run--```bash-marimo tutorial intro-```--A tutorial notebook should open in your browser.--```{admonition} Installation issues?--Having installation issues? Reach out to us [at GitHub](https://github.com/marimo-team/marimo/issues) or [on Discord](https://marimo.io/discord?ref=docs).-```--## Run tutorials--`marimo tutorial intro` opens the intro tutorial. List all tutorials with--```bash-marimo tutorial --help-```--## Edit notebooks--Create and edit notebooks with `marimo edit`.--- launch the notebook server to create new notebooks,- and start or stop existing ones:--```bash-marimo edit-```--- create or edit a single notebook with--```bash-marimo edit your_notebook.py-```--(If `your_notebook.py` doesn't exist, marimo will create a blank notebook-named `your_notebook.py`.)--## Deploy as apps--Use `marimo run` to serve your notebook as an app, with Python code hidden and-uneditable.--```bash-marimo run your_notebook.py-```--## Convert from Jupyter to marimo--Automatically convert Jupyter notebooks to marimo notebooks with `marimo convert`:--```bash-marimo convert your_notebook.ipynb -o your_notebook.py+ installation+ quickstart+ key_concepts```-Then open the notebook with `marimo edit your_notebook.py`--:::{admonition} Disable autorun on startup-:class: tip--marimo automatically runs notebooks when they are opened. If this-is a problem for you (not all Jupyter notebooks are designed to be run on-startup), you can disable autorun on startup via [user configuration](/guides/configuration/runtime_configuration.md).--1. Type `marimo config show` to get the location of your config file.-2. If no config file exists, create it at `~/.marimo.toml` or `$XDG_CONFIG_HOME/marimo/marimo.toml`.-3. Update your config to include the following:--```toml-[runtime]-auto_instantiate = false-```--:::--## Install optional dependencies for more features--Some features require additional dependencies, which are not installed by default. This includes:--- [SQL cells](/guides/working_with_data/sql.md)-- Charts in the datasource viewer-- [AI features](/guides/editor_features/ai_completion.md)-- Format on save--To install the optional dependencies, run:--::::{tab-set}-:::{tab-item} install with pip--```bash-pip install "marimo[recommended]"-```--:::-:::{tab-item} install with uv--```bash-uv pip install "marimo[recommended]"-```--:::-:::{tab-item} install with conda--```bash-conda install -c conda-forge marimo duckdb altair polars openai ruff-```--:::-::::--This will install: `duckdb`, `altair`, `polars`, `openai`, and `ruff`.--## Enable GitHub Copilot and AI Assistant--The marimo editor natively supports [GitHub Copilot](https://copilot.github.com/),-an AI pair programmer, similar to VS Code.--_Get started with Copilot_:--1. Install [Node.js](https://nodejs.org/en/download).-2. Enable Copilot via the settings menu in the marimo editor.--_Note_: Copilot is not yet available in our conda distribution; please install-marimo from `PyPI` if you need Copilot.--marimo also comes with support for [other copilots](/guides/editor_features/ai_completion.md#codeium-copilot),-and a built-in [AI assistant](/guides/editor_features/ai_completion.md#generate-code-with-our-ai-assistant) that helps you write code.--## Try our VS Code extension--The best way to use marimo is through the CLI. However, if you prefer VS Code-over terminal, try our [VS Code-extension](https://marketplace.visualstudio.com/items?itemName=marimo-team.vscode-marimo).-Use this extension to edit and run notebooks directly from VS Code, and to list-all marimo notebooks in your current directory.+These tutorials will help you get started with marimo-<div align="center">-<figure>-<img src="/_static/vscode-marimo.png"/>-</figure>-</div>+| Guide | Description |+| :------------------ | :------------------------------------------------------------------------------------------------------ |+| {doc}`installation` | Installing marimo |+| {doc}`quickstart` | Create notebooks, run apps, and more from the marimo command-line |+| {doc}`key_concepts` | A tour of key features and concepts |diff --git a/docs/getting_started/installation.md b/docs/getting_started/installation.mdnew file mode 100644index 0000000000..a3b5ba12ad--- /dev/null+++ b/docs/getting_started/installation.md@@ -0,0 +1,76 @@+# Installation+++Before installing marimo, we recommend creating and activating a Python+[virtual environment](https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments).++```{dropdown} Setting up a virtual environment++Python uses virtual environments to minimize conflicts among packages.+Here's a quickstart for `pip` users. If you use `conda`, please use a [`conda`+environment](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands)+instead.++Run the following in the terminal:+++- create an environment with `python -m venv marimo-env`+- activate the environment:+ - macOS/Unix: `source marimo-env/bin/activate`+ - Windows: `marimo-env\Scripts\activate`++_Make sure the environment is activated before installing marimo and when+using marimo._ Install other packages you may need, such as numpy, pandas, matplotlib,+and altair, in this environment. When you're done, deactivate the environment+with `deactivate` in the terimnal.++Learn more from the [official Python tutorial](https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments).++:::{admonition} Using uv?+:class: tip++[uv](https://github.com/astral-sh/uv) is a next-generation Python package+installer and manager that is 10-100x faster than pip, and also makes it easy+to install Python and manage projects. With `uv`, creating a virtual+environment is as easy as `uv venv`.+:::+```++To install marimo, run the following in a terminal:++::::{tab-set}+:::{tab-item} install with pip++```bash+pip install marimo+```++:::+:::{tab-item} install with uv++```bash+uv pip install marimo+```++:::+:::{tab-item} install with conda++```bash+conda install -c conda-forge marimo+```++:::+::::++To check if the install worked, run++```bash+marimo tutorial intro+```++A tutorial notebook should open in your browser.++```{admonition} Installation issues?++Having installation issues? Reach out to us [at GitHub](https://github.com/marimo-team/marimo/issues) or [on Discord](https://marimo.io/discord?ref=docs).+```diff --git a/docs/guides/overview.md b/docs/getting_started/key_concepts.mdsimilarity index 75%rename from docs/guides/overview.mdrename to docs/getting_started/key_concepts.mdindex 1f1f6fb86c..28dfd036dc 100644--- a/docs/guides/overview.md+++ b/docs/getting_started/key_concepts.md@@ -1,4 +1,14 @@-# Overview+# Key concepts++This page covers marimo's key concepts:++* marimo lets you rapidly experiment with data using Python, SQL, and interactive+elements in a reproducible **notebook environment**.+* Unlike Jupyter notebooks, marimo notebooks are reusable software artifacts.+ marimo notebooks can be shared as as **interactive web apps** and executed as+ **Python scripts**.++## Editing notebooksmarimo notebooks are **reactive**: they automatically react to your codechanges and UI interactions and keep your notebook up-to-date, not unlike a@@ -6,13 +16,6 @@ spreadsheet. This makes your notebooks reproducibile, [eliminating hiddenstate](/faq.md#faq-problems); it's also what enables marimo notebooks to double asapps and Python scripts.-```{admonition} Creating marimo notebooks-:class: tip--Make sure to first read the [getting started](/getting_started/index.md) page,-which teaches you how to install marimo and create notebooks.-```-```{admonition} Working with expensive notebooks:class: important@@ -23,16 +26,33 @@ stale. **See our guide on working with [expensivenotebooks](/guides/expensive_notebooks.md) for more tips.**```-## How marimo executes cells+**Create your first notebook.** After [installing+marimo](/getting_started/installation.md), create your first notebook with++```bash+marimo edit my_notebook.py+```++at the command-line.+++**The marimo library**.+We recommend starting each marimo notebook with a cell containing a single+line of code,++```python3+import marimo as mo+```++The marimo library lets you use interactive UI elements, layout elements,+dynamic markdown, and more in your marimo notebooks.++### How marimo executes cellsA marimo notebook is made of small blocks of Python code called **cells**._When you run a cell, marimo automatically runs all cells that read any globalvariables defined by that cell._ This is reactive execution.-> **Reactive execution guarantees that your code and program state are-> consistent.** It also gives notebooks a deterministic execution order,-> letting them double as both reproducible scripts and interactive apps.-<div align="center"><figure><img src="/_static/reactive.gif" width="600px"/>@@ -61,17 +81,6 @@ cell's code just once, creating a directed acyclic graph based on theglobal names each cell defines and reads. This is how data flowsin a marimo notebook.-**The marimo library.**-We recommend starting each marimo notebook with a cell containing a single-line of code,--```python3-import marimo as mo-```-The marimo library lets you use-interactive UI elements, layout elements, dynamic markdown, and more in your-marimo notebooks.-```{admonition} Minimize variable mutation.:class: warning@@ -83,9 +92,10 @@ dataframe), you should perform the mutation in the same cell as the one thatdefines it.Learn more in our [reactivity guide](/guides/reactivity.md#reactivity-mutations).+```-For more on reactive execution, open the dataflow tutorial:+For more on reactive execution, open the dataflow tutorial```bashmarimo tutorial dataflow@@ -93,7 +103,7 @@ marimo tutorial dataflowor read the [reactivity guide](/guides/reactivity.md).-## Visualizing outputs+### Visualizing outputsmarimo visualizes the last expression of each cell as its **output**. Outputscan be any Python value, including markdown and interactive elements created@@ -123,7 +133,9 @@ marimo tutorial plotsmarimo tutorial layout```-## Creating interactive elements+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@@ -159,13 +171,15 @@ Use [`mo.ui.run_button`](marimo.ui.run_button) to create a button thattriggers computation when clicked; see our recipes for [an example](/recipes#create-a-button-that-triggers-computation-when-clicked).```-For more on interactive elements, run the UI tutorial:+For more on interactive elements, run the UI tutorial```bashmarimo tutorial ui```-## Query dataframes and databases with SQL+or read the [interactivity guide](/guides/interactivity.md).++### Querying dataframes and databases with SQLmarimo has built-in support for SQL: you can query Python dataframes,databases, CSVs, Google Sheets, or anything else. After executing your query,@@ -183,10 +197,38 @@ To create a SQL cell, click on the SQL button that appears at the bottom of thecell array, or right click the create cell button next to a cell. Today,SQL in marimo is executed using [duckdb](https://duckdb.org/docs/).-To learn more, run the SQL tutorial:+To learn more, run the SQL tutorial```bashmarimo tutorial sql```or read the [SQL guide](/guides/working_with_data/sql.md).++## Running notebooks as applications++You can use marimo as a notebook, similar to how you might use Jupyter.++But you can also do more: because marimo notebooks are reactive and can include+interactive elements, hiding notebook code gives you a simple web app!++You can run your notebook as a read-only web app from the command-line:++```bash+marimo run my_notebook.py+```++The default renderer just hides the notebook code and concatenates outputs+vertically. But marimo also supports [other layouts](/guides/apps.md),+such as slides and grid.++## Running notebooks as scripts++Because marimo notebooks are stored as pure Python files, each notebook+can be executed as a script from the command-line:++```python+python my_notebook.py+```++You can also [pass command-line arguments](/guides/scripts.md) to scripts.diff --git a/docs/getting_started/quickstart.md b/docs/getting_started/quickstart.mdnew file mode 100644index 0000000000..b956bbf304--- /dev/null+++ b/docs/getting_started/quickstart.md@@ -0,0 +1,147 @@+# Quickstart++Installing marimo gets you the `marimo` command-line interface (CLI), the entry+point to all things marimo.++## Run tutorials++`marimo tutorial intro` opens the intro tutorial. List all tutorials with++```bash+marimo tutorial --help+```++## Edit notebooks++Create and edit notebooks with `marimo edit`.++- launch the notebook server to create new notebooks,+ and start or stop existing ones:++```bash+marimo edit+```++- create or edit a single notebook with++```bash+marimo edit your_notebook.py+```++(If `your_notebook.py` doesn't exist, marimo will create a blank notebook+named `your_notebook.py`.)++## Deploy as apps++Use `marimo run` to serve your notebook as an app, with Python code hidden and+uneditable.++```bash+marimo run your_notebook.py+```++## Convert from Jupyter to marimo++Automatically convert Jupyter notebooks to marimo notebooks with `marimo convert`:++```bash+marimo convert your_notebook.ipynb -o your_notebook.py+```++Then open the notebook with `marimo edit your_notebook.py`++:::{admonition} Disable autorun on startup+:class: tip++marimo automatically runs notebooks when they are opened. If this+is a problem for you (not all Jupyter notebooks are designed to be run on+startup), you can disable autorun on startup via [user configuration](/guides/configuration/runtime_configuration.md).++1. Type `marimo config show` to get the location of your config file.+2. If no config file exists, create it at `~/.marimo.toml` or `$XDG_CONFIG_HOME/marimo/marimo.toml`.+3. Update your config to include the following:++```toml+[runtime]+auto_instantiate = false+```++:::++## Export marimo notebooks to other file formats++Use++```bash+marimo export+```++to convert marimo notebooks to other file formats, including HTML, IPYNB,+and markdown.++## Install optional dependencies for more features++Some features require additional dependencies, which are not installed by default. This includes:++- [SQL cells](/guides/working_with_data/sql.md)+- Charts in the datasource viewer+- [AI features](/guides/editor_features/ai_completion.md)+- Format on save++To install the optional dependencies, run:++::::{tab-set}+:::{tab-item} install with pip++```bash+pip install "marimo[recommended]"+```++:::+:::{tab-item} install with uv++```bash+uv pip install "marimo[recommended]"+```++:::+:::{tab-item} install with conda++```bash+conda install -c conda-forge marimo duckdb altair polars openai ruff+```++:::+::::++This will install: `duckdb`, `altair`, `polars`, `openai`, and `ruff`.++## Enable GitHub Copilot and AI Assistant++The marimo editor natively supports [GitHub Copilot](https://copilot.github.com/),+an AI pair programmer, similar to VS Code.++_Get started with Copilot_:++1. Install [Node.js](https://nodejs.org/en/download).+2. Enable Copilot via the settings menu in the marimo editor.++_Note_: Copilot is not yet available in our conda distribution; please install+marimo from `PyPI` if you need Copilot.++marimo also comes with support for [other copilots](/guides/editor_features/ai_completion.md#codeium-copilot),+and a built-in [AI assistant](/guides/editor_features/ai_completion.md#generate-code-with-our-ai-assistant) that helps you write code.++## Try our VS Code extension++The best way to use marimo is through the CLI. However, if you prefer VS Code+over terminal, try our [VS Code+extension](https://marketplace.visualstudio.com/items?itemName=marimo-team.vscode-marimo).+Use this extension to edit and run notebooks directly from VS Code, and to list+all marimo notebooks in your current directory.++<div align="center">+<figure>+<img src="/_static/vscode-marimo.png"/>+</figure>+</div>diff --git a/docs/guides/coming_from/jupyter.md b/docs/guides/coming_from/jupyter.mdindex df6d11ffb3..b3a24267ba 100644--- a/docs/guides/coming_from/jupyter.md+++ b/docs/guides/coming_from/jupyter.md@@ -89,7 +89,7 @@ To adapt to the restriction, we suggest:of global variables.2. Prefixing temporary variables with an underscore (`_my_temporary`), whichmakes the variable **local** to a cell.-3. Mutatinge variables in the cell that defines them.+3. Mutating variables in the cell that defines them.When working with **dataframes**, you might be used to redefining the same `df`variable in multiple cells. That won't work in marimo. Instead, try mergingdiff --git a/docs/guides/expensive_notebooks.md b/docs/guides/expensive_notebooks.mdindex 78a7cc27b0..f634ad7f38 100644--- a/docs/guides/expensive_notebooks.md+++ b/docs/guides/expensive_notebooks.md@@ -1,4 +1,4 @@-# Expensive notebooks+# Working with expensive notebooksmarimo provides tools to control when cells run. Use these tools toprevent expensive cells, which may call APIs or take a long time to run, fromdiff --git a/docs/guides/index.md b/docs/guides/index.mdindex d32a7c776e..3dd48e99a1 100644--- a/docs/guides/index.md+++ b/docs/guides/index.md@@ -5,12 +5,11 @@:maxdepth: 2:hidden:- overviewreactivityinteractivityoutputs- expensive_notebookscoming_from/jupyter+ expensive_notebooksworking_with_data/indexeditor_features/indexconfiguration/index@@ -37,12 +36,11 @@ tutorials that you can launch with `marimo tutorial` at the command line.| Guide | Description || :----------------------------------- | :----------------------------------------------------------- |-| {doc}`overview` | An overview of basic concepts || {doc}`reactivity` | How marimo runs cells || {doc}`interactivity` | Using interactive UI elements || {doc}`outputs` | Creating markdown, plots, and other visual outputs |-| {doc}`expensive_notebooks` | Tips for working with expensive notebooks || {doc}`/guides/coming_from/jupyter` | Tips for transitioning from Jupyter |+| {doc}`expensive_notebooks` | Tips for working with expensive notebooks || {doc}`working_with_data/index` | Using SQL cells, no-code dataframe tools, and reactive plots || {doc}`editor_features/index` | View variables, dataframe schemas, docstrings, and more || {doc}`configuration/index` | Configure various settings |diff --git a/docs/index.md b/docs/index.mdindex bd4b25366f..abcfa41bdb 100644--- a/docs/index.md+++ b/docs/index.md@@ -192,7 +192,7 @@ GitHub to learn more.<table border="0"><tr><td>- <a target="_blank" href="/guides/overview.md">+ <a target="_blank" href="/getting_started/key_concepts.md"><img src="/_static/reactive.gif" style="max-height: 150px; width: auto; display: block" /></a></td>@@ -214,7 +214,7 @@ GitHub to learn more.</tr><tr><td>- <a target="_blank" href="/guides/overview.md"> Tutorial </a>+ <a target="_blank" href="/getting_started/key_concepts.md"> Tutorial </a></td><td><a target="_blank" href="/api/inputs/index.md"> Inputs </a>diff --git a/docs/vercel.json b/docs/vercel.jsonindex 4d276e072b..ef9433a95f 100644--- a/docs/vercel.json+++ b/docs/vercel.json@@ -19,6 +19,11 @@"source": "/guides/theming.html","destination": "/guides/configuration/theming.html","permanent": true+ },+ {+ "source": "/guides/overview.html",+ "destination": "/getting_started/key_concepts.html",+ "permanent": true}]}