Function
run
(
ctx: click.Context,
port: int | None,
host: str,
proxy: str | None,
headless: bool,
token: bool,
token_password: str | None,
token_password_file: str | None,
include_code: bool,
session_ttl: int,
watch: bool,
skew_protection: bool,
base_url: str,
allow_origins: tuple[str, ...],
redirect_console_to_browser: bool,
sandbox: bool | None,
check: bool,
trusted: bool | None,
server_startup_command: str | None,
asset_url: str | None,
show_tracebacks: bool | None,
name: str,
args: tuple[str, ...],
)
Source from the content-addressed store, hash-verified
| 1117 | ) |
| 1118 | @click.argument("args", nargs=-1, type=click.UNPROCESSED) |
| 1119 | def run( |
| 1120 | ctx: click.Context, |
| 1121 | port: int | None, |
| 1122 | host: str, |
| 1123 | proxy: str | None, |
| 1124 | headless: bool, |
| 1125 | token: bool, |
| 1126 | token_password: str | None, |
| 1127 | token_password_file: str | None, |
| 1128 | include_code: bool, |
| 1129 | session_ttl: int, |
| 1130 | watch: bool, |
| 1131 | skew_protection: bool, |
| 1132 | base_url: str, |
| 1133 | allow_origins: tuple[str, ...], |
| 1134 | redirect_console_to_browser: bool, |
| 1135 | sandbox: bool | None, |
| 1136 | check: bool, |
| 1137 | trusted: bool | None, |
| 1138 | server_startup_command: str | None, |
| 1139 | asset_url: str | None, |
| 1140 | show_tracebacks: bool | None, |
| 1141 | name: str, |
| 1142 | args: tuple[str, ...], |
| 1143 | ) -> None: |
| 1144 | from marimo._cli.sandbox import ( |
| 1145 | SandboxMode, |
| 1146 | resolve_sandbox_mode, |
| 1147 | run_in_sandbox, |
| 1148 | ) |
| 1149 | |
| 1150 | # click consumes `--` as an option terminator and does not pass it |
| 1151 | # through to `args`. `RunCommand` records the raw tail so splitting |
| 1152 | # logic can preserve "args after --" semantics without reading process- |
| 1153 | # global argv state. |
| 1154 | args_after_separator = ctx.meta.get("marimo_run_args_after_separator") |
| 1155 | paths, notebook_args = _split_run_paths_and_args( |
| 1156 | name, |
| 1157 | args, |
| 1158 | args_after_separator |
| 1159 | if isinstance(args_after_separator, tuple) |
| 1160 | else None, |
| 1161 | ) |
| 1162 | |
| 1163 | if len(paths) == 1 and prompt_run_in_docker_container( |
| 1164 | paths[0], trusted=trusted |
| 1165 | ): |
| 1166 | from marimo._cli.run_docker import run_in_docker |
| 1167 | |
| 1168 | run_in_docker( |
| 1169 | paths[0], |
| 1170 | "run", |
| 1171 | port=port, |
| 1172 | debug=GLOBAL_SETTINGS.DEVELOPMENT_MODE, |
| 1173 | ) |
| 1174 | return |
| 1175 | |
| 1176 | # Validate name, or download from URL |