(
notebook: MarimoPath,
*,
force_overwrite: bool,
notebook_args: tuple[str, ...],
sandbox_pool: SandboxVenvPool | None,
)
| 164 | |
| 165 | |
| 166 | async def _export_session_for_notebook( |
| 167 | notebook: MarimoPath, |
| 168 | *, |
| 169 | force_overwrite: bool, |
| 170 | notebook_args: tuple[str, ...], |
| 171 | sandbox_pool: SandboxVenvPool | None, |
| 172 | ) -> None: |
| 173 | output = get_session_cache_file(notebook.path) |
| 174 | if _maybe_skip_fresh_snapshot(notebook, force_overwrite=force_overwrite): |
| 175 | return |
| 176 | |
| 177 | echo(f"Running {notebook.short_name}...") |
| 178 | venv_python = ( |
| 179 | sandbox_pool.get_python(str(notebook.path)) |
| 180 | if sandbox_pool is not None |
| 181 | else None |
| 182 | ) |
| 183 | |
| 184 | session_snapshot, did_error = await _export_session_snapshot( |
| 185 | notebook, |
| 186 | notebook_args=notebook_args, |
| 187 | venv_python=venv_python, |
| 188 | ) |
| 189 | |
| 190 | output = write_session_snapshot( |
| 191 | notebook_path=notebook.path, |
| 192 | snapshot=session_snapshot, |
| 193 | ) |
| 194 | |
| 195 | if did_error: |
| 196 | raise click.ClickException( |
| 197 | "Session export succeeded, but some cells failed to execute." |
| 198 | ) |
| 199 | |
| 200 | echo(green("ok") + f": {output}") |
| 201 | |
| 202 | |
| 203 | def _maybe_skip_fresh_snapshot( |
no test coverage detected
searching dependent graphs…