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
Now let me look at the remaining call sites I need to update:
- Assistant
Now
kernel_lifecycle.py: - Assistant
Now the lazy installation in
threads.py: - Assistant
Update the
print_overridedocstring to reflect its new lifecycle: - Assistant
Now update the test helper:
- Assistant
Now add tests. Let me check the
kfixture first: - Assistant
Now add tests to
test_threads.py: - Assistant
Pre-existing lint violations on the clean tree too — not from my change. Mypy is clean on all touched files. Now run the broader affected suites:
- Assistant
Same 3 failures on the clean tree — pre-existing and unrelated (duckdb parquet glob). Let me check the
pytest.pyreference to print I saw earlier, plus run the pyodide suite: - Assistant
That failure is also pre-existing. Let me do an end-to-end check with actual Numba if it's available:
- Assistant
Now confirm this actually failed before my change:
- Assistant
All green. Let me do a final review of the complete diff:
- Assistant
Done. The fix is complete and verified.
Problem
marimo installed
print_overrideinto every kernel's__main__globals at startup (patches.py), soprintin notebook code never resolved to the builtin. Numba only compiles calls toprintwhen the name resolves to the actual builtin, so any function calling failed to compile inside a notebook — even when was never used.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.