Skip to content

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.

Docs: running programs as scripts (#16)

Akshay Agrawalfd39c8b94931
diff --git a/Makefile b/Makefile
index 9a84a5a52c..54d1e3a38a 100644
--- a/Makefile
+++ b/Makefile
@@ -87,3 +87,8 @@ docs:
# autobuild docs
docs-auto:
sphinx-autobuild $(ARGS) docs/ docs/_build
+
+.PHONY: docs-clean
+# remove built docs
+docs-clean:
+ cd docs && make clean
diff --git a/README.md b/README.md
index e60d91ba0f..a5a01a95ae 100644
--- a/README.md
+++ b/README.md
@@ -256,7 +256,7 @@ collections of elements.
### Layout
The marimo library also comes with layout elements, including `mo.hstack`,
-`mo.vstack`, `mo.tabs`, and more.
+`mo.vstack`, and `mo.tabs`. See the [API reference](https://docs.marimo.io/api/layouts/index.html) for more info.
## Examples
diff --git a/docs/guides/index.md b/docs/guides/index.md
index 8b3ed13ebd..4d667d1708 100644
--- a/docs/guides/index.md
+++ b/docs/guides/index.md
@@ -10,15 +10,11 @@
interactivity
outputs
apps
+ scripts
best_practices
```
-_The best way to learn marimo is to use it._ marimo even comes packaged
-with tutorials that you can launch at the command line using the `marimo
-tutorial` command.
-
-If you prefer reading docs, the guides below are a thorough walkthrough
-of marimo's core concepts.
+These guides cover marimo's core concepts.
| | |
| :-------------------- | :---------------------------------------- |
@@ -27,5 +23,12 @@ of marimo's core concepts.
| {doc}`interactivity` | Using interactive UI elements |
| {doc}`outputs` | Markdown, plots, and other visual outputs |
| {doc}`apps` | Running notebooks as apps |
+| {doc}`scripts` | Running notebooks as scripts |
| {doc}`best_practices` | Best practices when working with marimo |
+```{admonition} Learn by doing
+:class: tip
+
+Prefer a hands-on learning experience? marimo comes packaged with interactive
+tutorials that you can launch with `marimo tutorial` at the command line.
+```
diff --git a/docs/guides/scripts.md b/docs/guides/scripts.md
new file mode 100644
index 0000000000..4329324ac5
--- /dev/null
+++ b/docs/guides/scripts.md
@@ -0,0 +1,21 @@
+# Scripts
+
+You can run marimo notebooks as scripts at the command line, just like
+any other Python script. For example,
+
+```bash
+python my_marimo_notebook.py
+```
+
+
+Running a notebook as a script is useful when your notebook has side-effects,
+like writing to disk. Print statements and other console outputs will show
+up in your terminal.
+
+```{admonition} Future plans
+:class: note
+
+In the future, we may make UI element values configurable as command-line
+arguments, and optionally generate a PDF or HTML of the cell outputs.
+```
+