Skip to content

Commit 1e442be

Browse files
docs: add marimo on spaces guide (#1478)
* docs: add marimo on spaces guide * Update docs/hub/spaces-sdks-docker-marimo.md Co-authored-by: Caleb Fahlgren <[email protected]> --------- Co-authored-by: Caleb Fahlgren <[email protected]>
1 parent 68155a0 commit 1e442be

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

docs/hub/_toctree.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@
279279
title: Tabby on Spaces
280280
- local: spaces-sdks-docker-giskard
281281
title: Giskard on Spaces
282+
- local: spaces-sdks-docker-marimo
283+
title: marimo on Spaces
282284
- local: spaces-embed
283285
title: Embed your Space
284286
- local: spaces-run-with-docker
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# marimo on Spaces
2+
3+
[marimo](https://github.com/marimo-team/marimo) is a reactive notebook for Python that models notebooks as dataflow graphs. When you run a cell or interact with a UI element, marimo automatically runs affected cells (or marks them as stale), keeping code and outputs consistent and preventing bugs before they happen. Every marimo notebook is stored as pure Python, executable as a script, and deployable as an app.
4+
5+
Key features:
6+
7+
- ⚡️ **reactive:** run a cell, and marimo reactively runs all dependent cells or marks them as stale
8+
- 🖐️ **interactive:** bind sliders, tables, plots, and more to Python — no callbacks required
9+
- 🔬 **reproducible:** no hidden state, deterministic execution, built-in package management
10+
- 🏃 **executable:** execute as a Python script, parametrized by CLI args
11+
- 🛜 **shareable:** deploy as an interactive web app or slides, run in the browser via WASM
12+
- 🛢️ **designed for data:** query dataframes and databases with SQL, filter and search dataframes
13+
14+
## Deploying marimo apps on Spaces
15+
16+
To get started with marimo on Spaces, click the button below:
17+
18+
<a href="http://huggingface.co/new-space?template=marimo-team/marimo-app-template" target="_blank">
19+
<img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/deploy-to-spaces-lg.svg" alt="">
20+
</a>
21+
22+
This will start building your Space using marimo's Docker template. If successful, you should see a similar application to the [marimo introduction notebook](https://huggingface.co/spaces/marimo-team/marimo-app-template).
23+
24+
## Customizing your marimo app
25+
26+
When you create a marimo Space, you'll get a few key files to help you get started:
27+
28+
### 1. app.py
29+
30+
This is your main marimo notebook file that defines your app's logic. marimo notebooks are pure Python files that use the `@app.cell` decorator to define cells. To learn more about building notebooks and apps, see [the marimo documentation](https://docs.marimo.io). As your app grows, you can organize your code into modules and import them into your main notebook.
31+
32+
### 2. Dockerfile
33+
34+
The Dockerfile for a marimo app is minimal since marimo has few system dependencies. The key requirements are:
35+
36+
- It installs the dependencies listed in `requirements.txt` (using `uv`)
37+
- It creates a non-root user for security
38+
- It runs the app using `marimo run app.py`
39+
40+
You may need to modify this file if your application requires additional system dependencies, permissions, or other CLI flags.
41+
42+
### 3. requirements.txt
43+
44+
The Space will automatically install dependencies listed in the `requirements.txt` file. At minimum, you must include `marimo` in this file. You will want to add any other required packages your app needs.
45+
46+
The marimo Space template provides a basic setup that you can extend based on your needs. When deployed, your notebook will run in "app mode" which hides the code cells and only shows the interactive outputs - perfect for sharing with end users. You can opt to include the code cells in your app by setting adding `--include-code` to the `marimo run` command in the Dockerfile.
47+
48+
## Additional Resources and Support
49+
50+
- [marimo documentation](https://docs.marimo.io)
51+
- [marimo GitHub repository](https://github.com/marimo-team/marimo)
52+
- [marimo Discord](https://marimo.io/discord)
53+
- [marimo template Space](https://huggingface.co/spaces/marimo-team/marimo-app-template)
54+
55+
## Troubleshooting
56+
57+
If you encounter issues:
58+
59+
1. Make sure your notebook runs locally in app mode using `marimo run app.py`
60+
2. Check that all required packages are listed in `requirements.txt`
61+
3. Verify the port configuration matches (7860 is the default for Spaces)
62+
4. Check Space logs for any Python errors
63+
64+
For more help, visit the [marimo Discord](https://marimo.io/discord) or [open an issue](https://github.com/marimo-team/marimo/issues).

0 commit comments

Comments
 (0)