Marimo's print routing breaks Numba compilation In notebooks that do not use mo.Thread,…
- User
Marimo's print routing breaks Numba compilation
In notebooks that do not use
mo.Thread,printmust retain builtin identity so Numba can compile functions that call it.mo.Threadmust continue routing output to the spawning cell, with output isolation between concurrent threads.Interface
No new interfaces are introduced.
- Assistant
I’ll trace the print-routing implementation and its thread tests, then make the smallest compatible change and run focused Python tests.
- Assistant
rgisn’t installed in this checkout, so I’m switching to targetedgrep/findsearches and keeping the scope to runtime output and thread code. - Assistant
The failure is caused by placing a Python wrapper named
printin every notebook’s global namespace. The clean compatibility point is lazy activation: leave ordinary notebooks to resolve the true builtin, and install the existing thread-aware router only when anmo.Threadis constructed; its thread-ID routing already provides concurrent isolation. I’m checking module-creation expectations before editing. - Assistant
The implementation now keeps
printabsent from notebook globals untilmo.Threadis actually requested, while retaining the existing router thereafter. I added regression coverage for builtin identity and lazy activation; next I’m running the focused runtime and messaging suites. - Assistant
Focused tests and Ruff pass. The standalone
pyrightexecutable is not installed in this environment, so I’m checking the repository’s own Python validation target to use its configured type checker. - Assistant
The regression suite now also exercises two truly concurrent
mo.Threads and verifies each print reaches only that thread’s spawning-cell stream. All 17 focused tests, Ruff, and diff validation pass; the configured Mypy environment cannot run fully offline because one locked dependency is not cached. I’m doing a final change review for unintended workspace edits.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.