diff --git a/docs/guides/editor_features/watching.md b/docs/guides/editor_features/watching.md index 007630a84d6..cc3c533bdcb 100644 --- a/docs/guides/editor_features/watching.md +++ b/docs/guides/editor_features/watching.md @@ -45,11 +45,15 @@ Guide](module_autoreloading.md) !!! note Support for watching data files and automatically refreshing cells that depend on them is coming soon. Follow along at -## Developing in WASM mode +## Hot-reloading WebAssembly notebooks + +Follow these steps to develop a notebook using your own editor while +previewing it as a [WebAssembly notebook](../wasm.md) in the browser. This lets +you take advantage of local development tools while seeing the notebook as it +appears when deployed as a WebAssembly notebook. -Follow these steps to develop a notebook using your own editor, while previewing it as a WebAssembly notebook in the browser. This lets you take advantage of local development tools while seeing the notebook as it appears when deployed as a [WebAssembly notebook](../wasm.md). ```bash -# in one terminal, start a watched edit session +# in one terminal, start a watched edit (or run) session marimo edit notebook.py --watch # in another terminal @@ -58,4 +62,4 @@ marimo export html-wasm notebook.py -o output_dir --watch # in a third terminal, serve the WASM application cd path/to/output_dir python -m http.server # or a server that watches for changes -``` \ No newline at end of file +``` diff --git a/tests/conftest.py b/tests/conftest.py index dec4f778052..e43b22a90c5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -229,6 +229,16 @@ def executing_kernel() -> Generator[Kernel, None, None]: mocked.teardown() +def _cleanup_tmp_dir(tmp_dir: TemporaryDirectory) -> None: + try: + # Tests shouldn't care whether temporary directory cleanup + # fails. Python 3.10+ has an ignore_cleanup_error argument, + # but we still support 3.9. + tmp_dir.cleanup() + except Exception: + pass + + @pytest.fixture def temp_marimo_file() -> Generator[str, None, None]: tmp_dir = TemporaryDirectory() @@ -258,7 +268,7 @@ def __(mo): f.write(content) yield tmp_file finally: - tmp_dir.cleanup() + _cleanup_tmp_dir(tmp_dir) @pytest.fixture @@ -301,7 +311,7 @@ def __(mo): f.write(content) yield tmp_file finally: - tmp_dir.cleanup() + _cleanup_tmp_dir(tmp_dir) @pytest.fixture @@ -330,7 +340,7 @@ async def __(): f.flush() yield tmp_file finally: - tmp_dir.cleanup() + _cleanup_tmp_dir(tmp_dir) @pytest.fixture @@ -372,7 +382,7 @@ def __(): f.flush() yield tmp_file finally: - tmp_dir.cleanup() + _cleanup_tmp_dir(tmp_dir) @pytest.fixture @@ -416,7 +426,7 @@ def __(): f.write(content) yield tmp_file finally: - tmp_dir.cleanup() + _cleanup_tmp_dir(tmp_dir) @pytest.fixture @@ -449,7 +459,7 @@ def temp_md_marimo_file() -> Generator[str, None, None]: f.write(content) yield tmp_file finally: - tmp_dir.cleanup() + _cleanup_tmp_dir(tmp_dir) @pytest.fixture @@ -486,7 +496,7 @@ def __(): f.write(content) yield tmp_file finally: - tmp_dir.cleanup() + _cleanup_tmp_dir(tmp_dir) @pytest.fixture @@ -518,7 +528,7 @@ def __(): f.write(content) yield tmp_file finally: - tmp_dir.cleanup() + _cleanup_tmp_dir(tmp_dir) # Factory to create ExecutionRequests and abstract away cell ID