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 patch the smallest layer that preserves builtin
printunless thread routing is actually needed. - Assistant
rgisn’t installed in this checkout, so I’m switching to targetedgrep/file discovery and keeping the search scoped to runtime and test code. - Assistant
The failure is caused by eagerly inserting a Python wrapper named
printinto every kernel’s global namespace. I’ve confirmed thread routing can be enabled lazily when anmo.Threadis constructed; that preservesprint is builtins.printfor ordinary notebooks while retaining the existing per-thread context routing. - Assistant
The focused runtime tests pass. I’m now checking lifecycle and module-patching coverage, because the change moves the override from kernel creation to
mo.Threadconstruction and could expose assumptions in lower-level tests. - Assistant
The lifecycle/module tests also pass, including a new concurrent two-cell case that verifies each thread’s print reaches only its own spawning cell. I’m doing the final type/lint pass and, if Numba is available locally, a direct compilation regression check.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.