(
port: int | None,
host: str,
proxy: str | None,
headless: bool,
token: bool,
token_password: str | None,
token_password_file: str | None,
base_url: str,
allow_origins: tuple[str, ...] | None,
skip_update_check: bool,
sandbox: bool | None,
trusted: bool | None,
profile_dir: str | None,
watch: bool,
skew_protection: bool,
remote_url: str | None,
convert: bool,
mcp: McpType | None,
mcp_allow_remote: bool,
server_startup_command: str | None,
asset_url: str | None,
timeout: float | None,
session_ttl: int | None,
name: str | None,
args: tuple[str, ...],
)
| 444 | ) |
| 445 | @click.argument("args", nargs=-1, type=click.UNPROCESSED) |
| 446 | def edit( |
| 447 | port: int | None, |
| 448 | host: str, |
| 449 | proxy: str | None, |
| 450 | headless: bool, |
| 451 | token: bool, |
| 452 | token_password: str | None, |
| 453 | token_password_file: str | None, |
| 454 | base_url: str, |
| 455 | allow_origins: tuple[str, ...] | None, |
| 456 | skip_update_check: bool, |
| 457 | sandbox: bool | None, |
| 458 | trusted: bool | None, |
| 459 | profile_dir: str | None, |
| 460 | watch: bool, |
| 461 | skew_protection: bool, |
| 462 | remote_url: str | None, |
| 463 | convert: bool, |
| 464 | mcp: McpType | None, |
| 465 | mcp_allow_remote: bool, |
| 466 | server_startup_command: str | None, |
| 467 | asset_url: str | None, |
| 468 | timeout: float | None, |
| 469 | session_ttl: int | None, |
| 470 | name: str | None, |
| 471 | args: tuple[str, ...], |
| 472 | ) -> None: |
| 473 | from marimo._cli.sandbox import SandboxMode, resolve_sandbox_mode |
| 474 | |
| 475 | pass_on_stdin = token_password_file == "-" |
| 476 | # We support unix-style piping, e.g. cat notebook.py | marimo edit |
| 477 | if ( |
| 478 | not pass_on_stdin |
| 479 | and name is None |
| 480 | and (stdin_contents := _get_stdin_contents()) is not None |
| 481 | ): |
| 482 | temp_dir = tempfile.TemporaryDirectory() |
| 483 | path = create_temp_notebook_file( |
| 484 | "notebook.py", "py", stdin_contents, temp_dir |
| 485 | ) |
| 486 | name = path.absolute_name |
| 487 | |
| 488 | if prompt_run_in_docker_container(name, trusted=trusted): |
| 489 | from marimo._cli.run_docker import run_in_docker |
| 490 | |
| 491 | run_in_docker( |
| 492 | name, |
| 493 | "edit", |
| 494 | port=port, |
| 495 | debug=GLOBAL_SETTINGS.DEVELOPMENT_MODE, |
| 496 | ) |
| 497 | return |
| 498 | |
| 499 | GLOBAL_SETTINGS.PROFILE_DIR = profile_dir |
| 500 | |
| 501 | if name is not None: |
| 502 | # Validate name, or download from URL |
| 503 | # The second return value is an optional temporary directory. It is |
nothing calls this directly
no test coverage detected
searching dependent graphs…