mojokernel
A Jupyter kernel for Mojo. Supports full variable persistence, function/struct definitions, and error handling across notebook cells.
NB: This is not an official Modular project. It's created by Jeremy Howard from Answer.AI and uses undocumented private symbols from mojo in ways that might turn out to be flaky or disappear in a future version. If Modular releases an official kernel that provides the same functionality, we'll archive this one and update these docs to point at that instead.
Install
We recommend uv which handles the Mojo package index automatically:
uv pip install mojokernel
mojokernel install --sys-prefix
With pip, install Mojo first (it's hosted on a separate index that pip can't discover automatically):
pip install modular --extra-index-url https://modular.gateway.scarf.sh/simple/
pip install mojokernel
mojokernel install --sys-prefix
Then select "Mojo" in Jupyter's kernel picker.
The pre-built wheel includes a compiled C++ server that talks directly to Mojo's LLDB -- no text parsing, fast and reliable. If the server binary isn't available for your platform, the kernel falls back to a pexpect-based engine that wraps mojo repl.
Pexpect fallback
The pexpect engine is used automatically if the C++ server binary isn't present (e.g. when installing from the sdist). It spawns mojo repl and parses its output. To force pexpect mode:
MOJO_KERNEL_ENGINE=pexpect jupyter lab
Building from source
To build the C++ server yourself (e.g. for development or an unsupported platform):
brew install llvm # macOS; on Linux: apt install llvm-18-dev liblldb-18-dev
tools/build_server.sh
PTY server (backup)
A third engine variant (server/repl_server_pty.cpp) uses SBDebugger::RunREPL() with PTY I/O redirection. This is a fallback in case the EvaluateExpression approach breaks in a future Modular release.
Releases
mojokernel wheels are built against a specific Mojo version. Install the version matching your Mojo:
# Check your Mojo version
mojo --version # e.g. "Mojo 0.26.1.0 (156d3ac6)" → version 26.1.0
# Install matching mojokernel
uv pip install mojokernel==26.1.0
Publishing a new release
The wheel version is determined automatically from the latest Mojo release (via mojokernel/_version.py). No manual version bumping needed.
When Mojo publishes a new version:
- Go to Actions > "Build and publish wheels" > Run workflow
- Set
publish: trueto upload to PyPI
The CI installs the latest Mojo, builds the C++ server, and produces platform wheels tagged with the detected Mojo version. Wheels are built for macOS (Apple Silicon) and Linux (x86_64).
Testing
uv pip install -e .
pytest -q
Architecture
mojokernel/
kernel.py -- Jupyter kernel (ipykernel subclass)
engines/
base.py -- ExecutionResult dataclass
pexpect_engine.py -- pexpect-based engine (default)
server_engine.py -- C++ server engine client
server/
repl_server.cpp -- C++ server (EvaluateExpression + REPL mode)
repl_server_pty.cpp -- PTY-based backup server
mojo_repl.cpp -- thin REPL wrapper (RunREPL)
json.hpp -- nlohmann/json
tests/
test_pexpect_engine.py -- pexpect engine tests
test_server_execute.py -- server engine tests
test_kernel.py -- kernel integration tests
tools/
build_server.sh -- compile C++ binaries
server_exec.py -- send code to server (debugging tool)
test.sh -- run pytest
Release files for mojokernel 26.1.0.post4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mojokernel-26.1.0.post4.tar.gz | 18.3 kB | Details |
Built distributions (wheels)
Total release size: 5.2 MB
Release files / mojokernel-26.1.0.post4.tar.gz
| Download URL | mojokernel-26.1.0.post4.tar.gz |
|---|---|
| Size | 18.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a0e0a1f7414cc3d6616cdb5cadb8d8d5b6ab2f2b08bb99718fe381f47e986500
|
|
BLAKE2b-256 checksum How to use checksums |
2db362e083f5ff7927532149c0a8028ef43292b8180e3bddf569c8d9caac73bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 19, 2026.
Transparency logRelease files / mojokernel-26.1.0.post4-cp314-cp314-manylinux_2_34_x86_64.whl
| Download URL | mojokernel-26.1.0.post4-cp314-cp314-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 182.5 kB |
| Tags | CPython 3.14 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
68f700d707146ff7d3f63ecd9f5301616f54dbcddc943fa175af27077257c539
|
|
BLAKE2b-256 checksum How to use checksums |
c6f6b8fd19abe1e4dc43df57668c911f114ea857a7bd197b8e95fb8ad1ec1176
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 19, 2026.
Transparency logRelease files / mojokernel-26.1.0.post4-cp314-cp314-macosx_14_0_arm64.whl
| Download URL | mojokernel-26.1.0.post4-cp314-cp314-macosx_14_0_arm64.whl |
|---|---|
| Size | 845.3 kB |
| Tags | CPython 3.14 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d9f66a11d1608a43270b94d385ca8ff1f3279758c0499cbbbf893bad2ecbc58b
|
|
BLAKE2b-256 checksum How to use checksums |
5ad68fa321d4f30c8d43462b5453aa0aa97641e7ac26b98f01d9c7a19f187ebf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 19, 2026.
Transparency logRelease files / mojokernel-26.1.0.post4-cp313-cp313-manylinux_2_34_x86_64.whl
| Download URL | mojokernel-26.1.0.post4-cp313-cp313-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 182.5 kB |
| Tags | CPython 3.13 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
dc346c6275dfa0900fdefee71262e42cd819a7e819bf7c8a26a66a57c9a11134
|
|
BLAKE2b-256 checksum How to use checksums |
e4eb211148262fd83f2bd281f4f63b8a05e47f7f7595fbba69c724d12f396a3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 19, 2026.
Transparency logRelease files / mojokernel-26.1.0.post4-cp313-cp313-macosx_14_0_arm64.whl
| Download URL | mojokernel-26.1.0.post4-cp313-cp313-macosx_14_0_arm64.whl |
|---|---|
| Size | 845.3 kB |
| Tags | CPython 3.13 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ffd438824a883dd4fb9767eb83924421223c358f1bf6c7380c94370e8551e57a
|
|
BLAKE2b-256 checksum How to use checksums |
727b1afc5715647659e33c4d44303b49fac9fdec1096d3e05612e8f3ee5e39b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 19, 2026.
Transparency logRelease files / mojokernel-26.1.0.post4-cp312-cp312-manylinux_2_34_x86_64.whl
| Download URL | mojokernel-26.1.0.post4-cp312-cp312-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 182.5 kB |
| Tags | CPython 3.12 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
ff9b9287d68461ccd71e488bd165fe4836f82a5acfa0475afa78d9d5f3beade4
|
|
BLAKE2b-256 checksum How to use checksums |
c6514bf082c3945fc99a7d6941754fd5b3915e09f6d24f6f9112e112b3884acc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 19, 2026.
Transparency logRelease files / mojokernel-26.1.0.post4-cp312-cp312-macosx_10_13_universal2.whl
| Download URL | mojokernel-26.1.0.post4-cp312-cp312-macosx_10_13_universal2.whl |
|---|---|
| Size | 845.3 kB |
| Tags | CPython 3.12 macOS 10.13+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
11fe04d60e3614b604e40d04ed66f0cdb5b49d783a9e12ffe07a5919caf7e9e6
|
|
BLAKE2b-256 checksum How to use checksums |
ffbc965e99a783f335fe99917d725ff1fd5fb051d4765df152b92e5aaf2326a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 19, 2026.
Transparency logRelease files / mojokernel-26.1.0.post4-cp311-cp311-manylinux_2_34_x86_64.whl
| Download URL | mojokernel-26.1.0.post4-cp311-cp311-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 182.5 kB |
| Tags | CPython 3.11 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
afe937df9721f075110de50646ae9408115b7663f06d186f19f9d853257c6090
|
|
BLAKE2b-256 checksum How to use checksums |
73a32a3cef22811e8a14a6bfcff2a16eac92d05bfd9abd04b370b01557df75b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 19, 2026.
Transparency logRelease files / mojokernel-26.1.0.post4-cp311-cp311-macosx_10_9_universal2.whl
| Download URL | mojokernel-26.1.0.post4-cp311-cp311-macosx_10_9_universal2.whl |
|---|---|
| Size | 845.3 kB |
| Tags | CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
58da012f491b233b2a342916521578aa2cb7c02305ea4ee4d83c2930af613b09
|
|
BLAKE2b-256 checksum How to use checksums |
dd2b52e31071df286ec7b082b41cc75eb7d9f98087646e43f4c4e2294de877cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 19, 2026.
Transparency logRelease files / mojokernel-26.1.0.post4-cp310-cp310-manylinux_2_34_x86_64.whl
| Download URL | mojokernel-26.1.0.post4-cp310-cp310-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 182.5 kB |
| Tags | CPython 3.10 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
e8b2710b7d18337c12cb792d3c888b6e52925c82ddf76638bc3489d5889b0947
|
|
BLAKE2b-256 checksum How to use checksums |
8fb8d0fe8b0673bdf2ff4e1cb423ed82e8e2fb6246b367a9b645113d23e2e877
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 19, 2026.
Transparency logRelease files / mojokernel-26.1.0.post4-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | mojokernel-26.1.0.post4-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 845.3 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d98f51e3ed47de64242fe4e953981e11be8f37d8b7f5cd3f2b8dbc1fa5af9c50
|
|
BLAKE2b-256 checksum How to use checksums |
7353fdae1ca517563b405a2abdaf2bfeabeb5f8c684c1717079cb1b0bf633f90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 19, 2026.
Transparency log