My personal use case of Marimo so far has been to add notebooks to existing python codebases. This has been working really well since the notebook code can easily import my own code from outside the notebook. However, this doesn't seem compatible with the WASM export functionality at the moment. It seems like the WASM export functionality simply takes the code explicitly defined in the notebook and converts it to WASM via pyodide, but really, in my use case I'd need the export to pass all of my python source code to pyodide so that my notebook actually works.
Here's a minimal example:
# test_file.py def test_external_func() -> str: return "Some string from external func!"
# TestExternal.py import marimo __generated_with = "0.11.5" app = marimo.App(width="medium") @app.cell def _(): import marimo as mo return (mo,) @app.cell def _(): from test_file import test_external_func test_external_func() return (test_external_func,) if __name__ == "__main__": app.run()
The above notebook runs as expected when invoked via marimo edit TestExternal.py
:
But fails when run as a WASM export:
I know that there's been a recent addition to support loading data files into the WASM export. Is there any analogous way to include additional python code that I have locally (not just 3rd party libraries on pypi)?