# Announcing mojo-marimo: Run Mojo in Marimo Notebooks 🔥

**URL:** <https://forum.modular.com/t/announcing-mojo-marimo-run-mojo-in-marimo-notebooks/2615>\
**Category:** Community Showcase\
**Created:** [January 19, 2026, 4:32am UTC](https://forum.modular.com/t/announcing-mojo-marimo-run-mojo-in-marimo-notebooks/2615 "2026-01-19T04:32:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjboothaus](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@mjboothaus](https://forum.modular.com/u/mjboothaus)\
**Post date:** [January 19, 2026, 4:32am UTC](https://forum.modular.com/t/announcing-mojo-marimo-run-mojo-in-marimo-notebooks/2615/1 "2026-01-19T04:32:45Z")

</div>

# Announcing mojo-marimo: Run Mojo in Marimo Notebooks 🔥

**Status** : Work in progress — Released for community feedback and testing

**Version** : v0.1.0 (Beta)

I’m excited to share **mojo-marimo** — a library that lets you run real Mojo code inside interactive Python notebooks using marimo.

**Note** : This executes Mojo via compilation and subprocess/FFI, **not** as a Mojo kernel.

This is an early release and **I’m actively seeking feedback** from the Mojo and Marimo communities on the approach, API design, and use cases.

## What is it?

`mojo-marimo` provides **three integration patterns** for executing high-performance Mojo code from Python/marimo notebooks:

### Pattern 1: Decorator — Pythonic & Clean

Mojo code lives in function docstrings with `{{param}}` templates. Call it like normal Python.

**Example** : [notebooks/pattern\_decorator.py](https://github.com/DataBooth/mojo-marimo/blob/main/notebooks/pattern_decorator.py)

### Pattern 2: Executor — Dynamic & Flexible

Pass Mojo code as strings or execute `.mojo` files. Perfect for dynamic code generation.

**Example** : [notebooks/pattern\_executor.py](https://github.com/DataBooth/mojo-marimo/blob/main/notebooks/pattern_executor.py)

### Pattern 3: Extension Modules — Zero Overhead

Compile to `.so` files for direct Python imports. No subprocess, ~1000× faster calls.

**Examples** :

- [notebooks/monte\_carlo\_extension.py](https://github.com/DataBooth/mojo-marimo/blob/main/notebooks/monte_carlo_extension.py) — π estimation with scatter plots
- [notebooks/mandelbrot\_extension.py](https://github.com/DataBooth/mojo-marimo/blob/main/notebooks/mandelbrot_extension.py) — Fractal visualization

**Trade-off** : More complex Mojo code (requires [PythonModuleBuilder](https://docs.modular.com/mojo/stdlib/python/PythonModuleBuilder)), but eliminates subprocess overhead.

## Key Features

- ✅ Real Mojo compilation and execution
- ✅ Smart caching (SHA256-based)
- ✅ Three integration patterns
- ✅ Pre-compilation validation
- ✅ Interactive examples: Fibonacci, Monte Carlo π, Mandelbrot fractals
- ✅ Works with marimo’s reactive model

## Repository

🔗 [GitHub - DataBooth/py-run-mojo: Interactive Mojo integration for Python notebooks - three patterns for running high-performance Mojo code from marimo](https://github.com/DataBooth/mojo-marimo)

44 passing tests (75% coverage) | Three integration patterns | Interactive examples | Comprehensive documentation

## 🎯 Feedback Requested!

See [docs/FEEDBACK\_REQUESTED.md](https://github.com/DataBooth/mojo-marimo/blob/main/docs/FEEDBACK_REQUESTED.md) for specific areas where community input would be valuable.

---

<div class="post-metadata">

**Author:** ![trojan\_x](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/trojan_x/32/902_2.png) [@trojan\_x](https://forum.modular.com/u/trojan_x)\
**Post date:** [January 19, 2026, 7:45pm UTC](https://forum.modular.com/t/announcing-mojo-marimo-run-mojo-in-marimo-notebooks/2615/2 "2026-01-19T19:45:49Z")

</div>

Definitely exciting but since you said Mojo Marimo allows you to run Mojo code inside python notebooks. My humble ask is wether I can run this on the Maturin CLI bridging Python with Rust inorder to use Mojo code instead of Python through C- ABI.

---

<div class="post-metadata">

**Author:** ![mjboothaus](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@mjboothaus](https://forum.modular.com/u/mjboothaus)\
**Post date:** [January 19, 2026, 9:41pm UTC](https://forum.modular.com/t/announcing-mojo-marimo-run-mojo-in-marimo-notebooks/2615/3 "2026-01-19T21:41:58Z")

</div>

Hi @trojan_x - First I am not a Rust expert 🙂 and I am learning Mojo.

Thanks for the question! I want to make sure I understand correctly, as I’m not entirely certain about your use case. Some thoughts:

## Current Architecture

`mojo-marimo` bridges **Mojo → Python** , not Mojo → Rust. It provides three patterns:

1. **Decorator/Executor** : Compile Mojo to binaries, run via subprocess
2. **Extension modules** : Compile Mojo to `.so` files that Python imports via FFI

Maturin, as I understand it, bridges **Rust → Python** (building Python packages from Rust code).

## Possible Approaches

**If you want Mojo and Rust in the same Python environment:**

Maybe you could have both Mojo and Rust extension modules loaded in Python and call between them through Python:

```auto
Mojo (.so) → Python ← Rust (.so via Maturin)

```

Both would expose C-ABI functions that Python can call.

**If you want direct Mojo → Rust (bypassing Python):**

This wouldn’t involve `mojo-marimo` at all. You’d need both languages to expose C-compatible FFI and link them directly.

One link re Mojo/Python interop if helpful: [Python interoperability | Modular](https://docs.modular.com/mojo/manual/python/)

## Clarification

Feel welcome to elaborate on what you’re trying to achieve? Are you looking to:

- Call Mojo code from Rust code?
- Use both Mojo and Rust extension modules in Python notebooks?
- Something else I haven’t considered?

---

<div class="post-metadata">

**Author:** ![trojan\_x](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/trojan_x/32/902_2.png) [@trojan\_x](https://forum.modular.com/u/trojan_x)\
**Post date:** [January 20, 2026, 4:58pm UTC](https://forum.modular.com/t/announcing-mojo-marimo-run-mojo-in-marimo-notebooks/2615/4 "2026-01-20T16:58:39Z")

</div>

"Thanks for the breakdown, Michael. You’re spot on—the current ‘Python glue’ approach is the most stable.

However, for my project (an IPS for Cisco), I’m trying to minimize latency by bypassing the Python interpreter entirely. Since I’m using Rust for the security kernel (leveraging its memory safety and Maturin’s build system) and Mojo for the AI logic, I’m exploring a direct C-ABI link between them.

I’m happy to dive deeper into the Rust/Maturin side of things if that helps the community understand how to bridge these two high-performance worlds! It feels like the direct Mojo → Rust path is where the real ‘superpowers’ are for systems-level AI."

I’m looking for something like an FFI wrapper in Mojo that allows me to run Rust code in Mojo so that I can call Rust ML crates such as Smartcore, Linfa, Random Forest and Others. I’m heavily into sophisticated approach and to stop relying on python (Python.import\_module (“Tensor flow “) libraries such as Tensor flow, Pytorch, Scikit learn and Nltk. And enthusiastic in using Memory safe code for building Autonomous security systems. I’m focused in the Mojo and Rust ecosystem with no more interest in diving into Slow and memory unsafe languages.

---

<div class="post-metadata">

**Author:** ![mjboothaus](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@mjboothaus](https://forum.modular.com/u/mjboothaus)\
**Post date:** [January 28, 2026, 6:04am UTC](https://forum.modular.com/t/announcing-mojo-marimo-run-mojo-in-marimo-notebooks/2615/5 "2026-01-28T06:04:54Z")

</div>

Yes now `py-run-mojo` - PyPI package here: [Client Challenge](https://pypi.org/project/py-run-mojo/)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex001/uploads/modular/original/1X/2751e0fbdc595a99718b216730957e9db4448cfd.jpeg) [@system](https://forum.modular.com/u/system)\
**Post date:** [July 27, 2026, 6:05am UTC](https://forum.modular.com/t/announcing-mojo-marimo-run-mojo-in-marimo-notebooks/2615/6 "2026-07-27T06:05:04Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
