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 and thread context implementation, then add focused regression tests for builtin identity, Numba compilation where locally available, and concurrent thread isolation.
- Assistant
rgisn’t installed in this checkout, so I’m using targetedgit grep/findsearches instead. - Assistant
The failure comes from injecting a Python wrapper named
printinto every notebook’s global namespace at kernel creation. I’m changing that override to be installed only for the lifetime of activemo.Threadexecution, with reference-counted cleanup so concurrent threads share routing safely. - Assistant
The concurrent test exposed an important test-fixture detail: each
mo.Threadowns a separate cloned stream, so isolation must be asserted per thread rather than through their shared underlying mock pipe. The implementation routes each print to the correct spawning-cell stream and restores the global afterward. - Assistant
The focused lint and tests pass. The repository-wide Python check is continuing through type checking, but its lint phase reports 70 pre-existing violations in unrelated files; none point to this change.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.