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: output (#175)
Akshay Agrawalae427926e529
diff --git a/docs/api/console.md b/docs/api/console.mddeleted file mode 100644index f7104b58d4..0000000000--- a/docs/api/console.md+++ /dev/null@@ -1,24 +0,0 @@-# Console outputs--Outputs written to `stdout` or `stderr`, including print statements-and logs, show up in a console output area below a cell.--By default, these console outputs don't appear when running a marimo notebook-as an app. If you do want them to appear in apps, marimo provides utility-functions for capturing console outputs and redirecting them to cell outputs.--```{eval-rst}-.. autofunction:: marimo.redirect_stdout-```--```{eval-rst}-.. autofunction:: marimo.redirect_stderr-```--```{eval-rst}-.. autofunction:: marimo.capture_stdout-```--```{eval-rst}-.. autofunction:: marimo.capture_stderr-```diff --git a/docs/api/index.md b/docs/api/index.mdindex 37accf0bed..ee3d11bdc8 100644--- a/docs/api/index.md+++ b/docs/api/index.md@@ -11,7 +11,7 @@plottingmedia/indexhtml- console+ outputscontrol_flowstatedebugging@@ -33,7 +33,7 @@ Use the marimo library in marimo notebooks (`import marimo as mo`) to| {doc}`plotting` | Output interactive plots || {doc}`media/index` | Output media like images, audio, PDFs, and plain text || {doc}`html` | Manipulate HTML objects |-| {doc}`console` | Redirect print statements and other console output |+| {doc}`outputs` | Modify cell outputs, redirect console output || {doc}`control_flow` | Control how cells execute || {doc}`state` | Make stateful apps with `mo.state` || {doc}`debugging` | Debugging utilities |diff --git a/docs/api/outputs.md b/docs/api/outputs.mdnew file mode 100644index 0000000000..3f206df8c1--- /dev/null+++ b/docs/api/outputs.md@@ -0,0 +1,67 @@+# Outputs++## Cell outputs++```{admonition} Cell outputs+:class: note++Every cell in a marimo notebook can have a visual **output**. When editing,+outputs are displayed above cells. When running a notebook as an app,+its UI is an arrangement of outputs.++A cell's output is by default its last expression. You can also create outputs+programmatically, using `mo.output.replace()` and `mo.output.append()`.+```++```{eval-rst}+.. autofunction:: marimo.output.replace+```++```{eval-rst}+.. autofunction:: marimo.output.append+```++```{eval-rst}+.. autofunction:: marimo.output.clear+```++```{admonition} Last expression replaces existing output+:class: warning++Ending a cell with a non-`None` expression is the same as calling+`mo.output.replace()` on it: the last expression replaces any output you may have+already written. Wrap the last expression in `mo.output.append` if you want+to add to an existing output instead of replacing it.+```+++++## Console outputs++```{admonition} Console outputs+:class: note++Text written to `stdout`/`stderr`, including print statements+and logs, shows up in a console output area below a cell.++By default, these console outputs don't appear when running a marimo notebook+as an app. If you do want them to appear in apps, marimo provides utility+functions for capturing console outputs and redirecting them to cell outputs.+```++```{eval-rst}+.. autofunction:: marimo.redirect_stdout+```++```{eval-rst}+.. autofunction:: marimo.redirect_stderr+```++```{eval-rst}+.. autofunction:: marimo.capture_stdout+```++```{eval-rst}+.. autofunction:: marimo.capture_stderr+```