Skip to main content

xmojo

xmojo is an interactive Mojo environment built on Modular's ORC execution engine. One command provides a terminal REPL, native compilation, package precompilation, and a Jupyter kernel with persistent state and rich display.

Install

xmojo supports Apple Silicon on macOS 12 or newer, and ARM64 or x86-64 Linux systems with glibc 2.35 or newer:

uv pip install xmojo

The wheel is self-contained. It includes the Mojo compiler, runtime, and standard library used by xmojo, so it does not require a Modular checkout, Bazel, or a separate Mojo installation. It also installs a Jupyter kernelspec.

Each xmojo release targets one exact Mojo nightly. Its numeric release component ends with that nightly's timestamp; a .postN suffix denotes packaging or documentation updates for the same build.

Commands

xmojo                                      # interactive ORC REPL
xmojo -e 'print("hello")'                  # evaluate one cell
xmojo example.mojo                         # execute a Mojo file
xmojo build hello.mojo -o hello            # build a native executable
xmojo precompile mypackage -o mypackage.mojoc  # precompile a package
xmojo kernel -f connection.json            # run as a Jupyter kernel
xmojo --version

REPL

Run xmojo without arguments. A blank line submits each cell:

$ xmojo
Mojo ORC REPL
Expressions are delimited by a blank line. :quit exits.

1> def answer() -> Int:
..   return 42
..
2> print(answer())
..
42

Declarations and variables persist between cells:

var total = 40
total += 2
total

The final expression produces Int(42) in Jupyter. Persistent variables keep their original type and cannot be redeclared. They must own their data or refer only to static storage; copy borrowed views into an owned value before persisting them.

Build executables

xmojo build uses Modular's native Mojo build driver with an ordinary stdlib, so compiled programs retain normal standalone I/O behavior:

hello.mojo:

def main():
    print("Hello from Mojo")
xmojo build hello.mojo -o hello
./hello
Hello from Mojo

Precompile packages

Precompile a directory containing __init__.mojo and other Mojo modules:

xmojo precompile mypackage -o mypackage.mojoc

The result can be supplied to Mojo through its normal import paths.

Jupyter notebooks

Install xmojo in the environment used by Jupyter, start your preferred Jupyter frontend, and select Mojo (xmojo):

uv pip install xmojo jupyterlab
jupyter lab

The kernel provides:

  • persistent functions, types, and typed top-level variables;
  • exact streaming of stdout and stderr;
  • automatic display of a cell's final expression;
  • explicit rich display with textual MIME bundles;
  • compiler-backed completion, inspection, and input completeness;
  • source-mapped compiler diagnostics and Mojo runtime stack traces; and
  • continued use of the session after ordinary compilation or runtime errors.

Compilation failures execute nothing and add no names. Mutations completed before a runtime error remain visible, while new variables from the raising cell are not persisted.

Rich display

display() publishes explicit output. Mojo repr traits provide compiler-checked HTML, Markdown, SVG, LaTeX, or complete MIME-bundle representations:

from xmojo import HTMLRepr, display

@fieldwise_init
struct HTML(HTMLRepr):
    var source: String

    def _repr_html_(self) -> String:
        return self.source

display(HTML("<b>explicit display</b>"))
HTML("<b>automatic final-expression result</b>")

The other traits are MarkdownRepr, SVGRepr, LaTeXRepr, and MIMEBundleRepr. A Writable value also receives a text/plain representation; other values receive a type-name fallback.

Modular GPU

GPU sessions use the exactly matched official Mojo compiler and MAX runtime. Install the optional dependency from Modular's nightly package index:

uv pip install --prerelease=allow \
  --extra-index-url https://whl.modular.com/nightly/simple/ \
  'xmojo[modular-gpu]'

On Apple Silicon, install Xcode's optional Metal toolchain once:

xcodebuild -downloadComponent MetalToolchain

Start a GPU-enabled REPL with:

xmojo --modular-gpu

The launcher detects the local accelerator and supplies the matched compiler, MAX imports, and AsyncRT runtime automatically. Compile and launch an ordinary top-level Mojo function:

from std.gpu import global_idx
from max.gpu.host import DeviceContext
from xmojo.gpu import compile

def increment(output: Pointer[Float32, MutAnyOrigin], size: Int32):
    var i = global_idx.x
    if i < Int(size):
        output[unsafe_offset=i] += 1

with DeviceContext() as context:
    var buffer = context.enqueue_create_buffer[DType.float32](256)
    var kernel = compile[increment](context)
    kernel.enqueue(buffer, Int32(256), grid_dim=1, block_dim=256)
    context.synchronize()

compile[...] caches device objects under ~/Library/Caches/xmojo/gpu. Set XMOJO_GPU_CACHE_DIR to choose another directory. Kernels must currently be top-level, nonparameterized, noncapturing functions with an ordinary name. Launch argument count and device types are checked while compiling the cell.

The installed Jupyter kernelspec is CPU-only. To add a separate GPU kernel:

gpu_kernel="$(jupyter --data-dir)/kernels/xmojo-gpu"
mkdir -p "$gpu_kernel"
cat > "$gpu_kernel/kernel.json" <<'JSON'
{
  "argv": ["xmojo", "--modular-gpu", "kernel", "-f", "{connection_file}"],
  "display_name": "Mojo (xmojo, Modular GPU)",
  "language": "mojo"
}
JSON

Select Mojo (xmojo, Modular GPU) in Jupyter.

Current limitations

  • Interrupting a running cell is not yet supported.
  • Rich display currently supports textual MIME data, without binary buffers, display metadata, or transient display IDs.
  • Persistent variables cannot be redeclared or implicitly captured by functions defined in other cells.
  • GPU support is opt-in and currently targets top-level noncapturing kernels.

See DEV.md for architecture, source builds, dependency revisions, testing, and contributor workflow.

License

Apache License v2.0 with LLVM Exceptions. See LICENSE.

Metadata

Release files for xmojo 0.0.2026082005.post3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for xmojo 0.0.2026082005.post3
File Interpreter ABI Platform Actions
xmojo-0.0.2026082005.post3-py3-none-manylinux_2_35_x86_64.whl Python 3 none Linux glibc 2.35+ x86-64 Details for xmojo-0.0.2026082005.post3-py3-none-manylinux_2_35_x86_64.whl
xmojo-0.0.2026082005.post3-py3-none-manylinux_2_35_aarch64.whl Python 3 none Linux glibc 2.35+ ARM64 Details for xmojo-0.0.2026082005.post3-py3-none-manylinux_2_35_aarch64.whl
xmojo-0.0.2026082005.post3-py3-none-macosx_12_0_arm64.whl Python 3 none macOS 12.0+ ARM64 Details for xmojo-0.0.2026082005.post3-py3-none-macosx_12_0_arm64.whl

Total release size: 169.2 MB

Release files / xmojo-0.0.2026082005.post3-py3-none-manylinux_2_35_x86_64.whl

Download URL xmojo-0.0.2026082005.post3-py3-none-manylinux_2_35_x86_64.whl
Size 61.7 MB
Tags Linux glibc 2.35+ x86-64 Python 3
SHA-256 checksum
How to use checksums
a4d6e89ce82b3da145f32f14015ced7f8d2ee2c7a21a802c91313e7ceab1e680
BLAKE2b-256 checksum
How to use checksums
f028fa4b6f60c4c93de13dcf9a9dfe3630e33e6bf8e4dfa4d7d43aaa1dccff5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 23, 2026.

Transparency log

Release files / xmojo-0.0.2026082005.post3-py3-none-manylinux_2_35_aarch64.whl

Download URL xmojo-0.0.2026082005.post3-py3-none-manylinux_2_35_aarch64.whl
Size 59.8 MB
Tags Linux glibc 2.35+ ARM64 Python 3
SHA-256 checksum
How to use checksums
76246c1b4d00926d7223e8c8b373da45267cbfbbe0f94cc56e263c180073a152
BLAKE2b-256 checksum
How to use checksums
ee5a7f8a06f90bd7b5e051a58a18281f9881ddb1e31cb96e3b0395b0d4015a03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 23, 2026.

Transparency log

Release files / xmojo-0.0.2026082005.post3-py3-none-macosx_12_0_arm64.whl

Download URL xmojo-0.0.2026082005.post3-py3-none-macosx_12_0_arm64.whl
Size 47.7 MB
Tags Python 3 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
7b01de404282cd9f762e78f44e9431b65867d8b7ccc2e96b116e6d91c2fc4bd2
BLAKE2b-256 checksum
How to use checksums
3727053afda3eabcb2b523da5b2ef23b6eefb4787fdd7583e66df4b07be9a1f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 23, 2026.

Transparency log

Security for xmojo 0.0.2026082005.post3

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.

Full provenance

All 3 files in this release have been uploaded with provenance metadata.

Select from 3 files

Attestation for xmojo-0.0.2026082005.post3-py3-none-manylinux_2_35_x86_64.whl

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 Aug 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page