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 CLI run (#1970)
Akshay Agrawalaa7d42828327
diff --git a/docs/api/cli_args.md b/docs/api/cli_args.mdindex 0bee8b4672..8705245bea 100644--- a/docs/api/cli_args.md+++ b/docs/api/cli_args.md@@ -1,20 +1,28 @@# Command Line Arguments-Use `mo.cli_args` to access command-line arguments passed to the notebook. This allows you to pass arguments to the notebook that are not controllable by the user. The arguments will be parsed from the command line when running the notebook as an application with `marimo run` or `marimo edit`. These arguments are passed after the notebook name and are separated from the notebook arguments by a double dash `--`.+Use `mo.cli_args` to access command-line arguments passed to the notebook. This+allows you to pass arguments to the notebook that are not controllable by the+user. The arguments will be parsed from the command line when running the+notebook as an application with `marimo run` or `marimo edit`; they will also+be parsed from the command line when running as a script.-Some examples passing command-line arguments to the notebook:+Some examples passing command-line arguments to the notebook when running+as a script:```bash-marimo run app.py -- --arg1 value1 --arg2 value2-# {'arg1': 'value1', 'arg2': 'value2'}+python notebook.py -- --arg1 value1 --arg2 value2+# mo.cli_args() == {'arg1': 'value1', 'arg2': 'value2'}-marimo run app.py -- --arg1=10 --arg2=true --arg3-# {'arg1': 10, 'arg2': True, 'arg3': ''}+python notebook.py -- --arg1=10 --arg2=true --arg3+# mo.cli_args() == {'arg1': 10, 'arg2': True, 'arg3': ''}-marimo run app.py -- --arg1 10.5 --arg2 hello --arg2 world-# {'arg1': 10.5, 'arg2': ['hello', 'world']}+python notebook.py -- --arg1 10.5 --arg2 hello --arg2 world+# mo.cli_args() == {'arg1': 10.5, 'arg2': ['hello', 'world']}```+In each example, `python` can be replaced as `marimo run` (for running as+an app) or `marimo edit` (for running as a notebook).+```{eval-rst}.. autofunction:: marimo.cli_args```diff --git a/docs/guides/apps.md b/docs/guides/apps.mdindex f0d6b98a61..a17a4be484 100644--- a/docs/guides/apps.md+++ b/docs/guides/apps.md@@ -10,7 +10,7 @@ grid editor; you can also choose to include code in the app view.## CLI```-Usage: marimo run [OPTIONS] NAME+Usage: marimo run [OPTIONS] NAME [ARGS]...Run a notebook as an app in read-only mode.@@ -21,12 +21,27 @@ Usage: marimo run [OPTIONS] NAME* marimo run notebook.pyOptions:- -p, --port INTEGER Port to attach to.- --host TEXT Host to attach to.- --headless Don't launch a browser.- --include-code Include notebook code in the app.- --base-url TEXT Base URL for the server. Should start with a /.- --help Show this message and exit.+ -p, --port INTEGER Port to attach to.+ --host TEXT Host to attach to. [default: 127.0.0.1]+ --proxy TEXT Address of reverse proxy.+ --headless Don't launch a browser.+ --token / --no-token Use a token for authentication. This enables session-+ based authentication. A random token will be+ generated if --token-password is not set.++ If --no-token is set, session-based authentication+ will not be used. [default: no-token]+ --token-password TEXT Use a specific token for authentication. This enables+ session-based authentication. A random token will be+ generated if not set.+ --include-code Include notebook code in the app.+ --watch Watch the file for changes and reload the app. If+ watchdog is installed, it will be used to watch the+ file. Otherwise, file watcher will poll the file+ every 1s.+ --base-url TEXT Base URL for the server. Should start with a /.+ --allow-origins TEXT Allowed origins for CORS. Can be repeated.+ --help Show this message and exit.```## Layoutdiff --git a/docs/guides/scripts.md b/docs/guides/scripts.mdindex c78aa306f8..18d1fc93f2 100644--- a/docs/guides/scripts.md+++ b/docs/guides/scripts.md@@ -11,9 +11,12 @@ 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 showup in your terminal.+You can pass arguments to your notebook at the command-line: see+the [docs page on CLI args](/api/cli_args.md) to learn more.+```{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.+In the future, we may give you the option to generate a PDF or HTML of the cell+outputs when running as a script.```