Skip to main content

mojox

CLI and execution layer for Mojo build tooling.

mojox reads your pyproject.toml manifest (via mojox-core), discovers targets, builds an execution plan, and runs mojo commands with structured output. It handles profile resolution, local settings (.mojox/config.toml), diagnostic formatting, and a compiled-binary cache so unchanged tests and programs are not rebuilt.

Install

uv add mojox "mojo-compiler==1.0.0"    # in a project
uv tool install mojox                      # globally

Subcommands

test

Run test targets (dev profile by default). Each test file is built to a binary, then executed.

mojox test                                    # all test targets
mojox test -k "parse" tests/unit/             # filter by name + path
mojox test --output-format json               # NDJSON to stdout (CI)
mojox test --no-fail-fast                     # run all tests even after failures
mojox test --failure-output final             # show failing output after all tests
mojox test --bundle -k "parse"                # one harness binary, filter test functions
mojox test --examples                         # also compile-check examples/*/main.mojo

Test-specific flags:

Flag Default Description
--output-format {human,json} human Output format; json emits NDJSON to stdout
--fail-fast / --no-fail-fast --fail-fast Stop after first failure
--success-output {immediate,final,never} never When to show passing test output
--failure-output {immediate,final,never} immediate When to show failing test output
-k / --filter PATTERN Filter tests by name (case-insensitive substring); see --bundle
--bundle off Compile every test_* function into a single harness binary
--examples off Also compile-check examples/*/main.mojo
--no-cache off Always rebuild; cached test binaries are left untouched, precompiled packages are rebuilt in place and lose their cache entry
paths (positional) Filter tests by file or directory prefix

Examples are not checked unless you pass --examples or a path under examples/. They are compiled, never executed.

With --bundle, test files without test_* functions are left out of the bundle (with a note on stderr), and -k matches test function names inside the harness at runtime. Without it, -k matches test file paths.

Binary cache

Build outputs live under .mojox/cache/: test binaries in bin/, their cache keys in meta/, example builds in examples/. A test is rebuilt only when its key changes. The key covers the test source, the project's library and test trees, every include dir passed via -I, including dependency dirs and -I entries in manifest, profile or --flag flags (file size and mtime, not content), the compiler flags, the build environment and the compiler. mojox cache clean deletes .mojox/cache/.

Precompiled library packages (.mojox/build/pkg/) are cached too, by test, build and check alike: a lib is precompiled again only when its sources, the dependency include dirs, the precompile arguments, the environment or the compiler change, or when its package is missing.

Add .mojox/ to your .gitignore.

run

Build a single .mojo file, then execute the binary (dev profile by default).

mojox run src/main.mojo
mojox run --no-cache src/main.mojo            # always rebuild

The binary goes through the same .mojox/cache/bin cache as mojox test, so a second run of an unchanged file skips the build. Editing the file, a sibling module or a dependency triggers a rebuild. Output is captured and replayed once the program exits, not streamed. --timeout (or the profile's timeout) covers the build and the run.

Exit code: the program's own code; 128 + N if it is killed by signal N; 1 if the build fails (compiler crash included) or the timeout is hit.

build

Compile binary targets (release profile by default).

mojox build

check

Validate the manifest, run lints, and compile library packages when a compiler is available (manifest-only otherwise). Exits 1 on a compile failure, 2 on an invalid manifest.

mojox check

metadata

Output the build plan as JSON.

mojox metadata

cache clean

Delete .mojox/cache/ (cached binaries and their metadata). Safe to run when there is no cache.

mojox cache clean

Common flags

These flags are available on every subcommand except cache:

Flag Description
--profile PROFILE Build profile (dev, release, or user-defined)
-j / --jobs N Maximum concurrent compilations
--timeout SECONDS Per-target timeout
--dry-run Show planned commands without executing
-v / --verbose Expand grouped output
--no-config Disable .mojox/config.toml discovery
--config-file PATH Explicit config file path
-D / --define KEY=VALUE Define a compile-time variable (repeatable)
--flag VALUE Extra flag passed through to the compiler (repeatable; use --flag=VALUE for dash-prefixed flags)

How it works

  1. Parses pyproject.toml via mojox-core (manifest model layer)
  2. Reads .mojox/config.toml local settings, if present (TOCTOU-safe via openat)
  3. Resolves policy: profile, defines, flags, CLI overrides
  4. Discovers targets and builds a plan (pure -- returns commands as data)
  5. Executes the plan: runs mojo commands, collects outcomes, formats output
  6. For tests and run, builds each file to a binary (reusing a cached one when its key matches), then executes it

Exit codes

mojox test:

Code Meaning
0 Success
1 Test failure(s), including a test file that fails to build
2 Library or example compilation failure, or configuration error
130 Interrupted (Ctrl+C)

mojox run:

Code Meaning
any The program's own exit code
128 + N The program was killed by signal N
1 Build failure or timeout
2 Toolchain not found

See also

  • mojox-core -- manifest parsing, target discovery, and build planning (pure model layer)
  • mojox-build -- PEP 517 build backend for packaging Mojo libraries as wheels

License

MIT

Metadata

Release files for mojox 0.6.3

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

Source distribution (sdist)

Source distribution for mojox 0.6.3
File Size Uploaded
mojox-0.6.3.tar.gz 72.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mojox 0.6.3
File Interpreter ABI Platform
mojox-0.6.3-py3-none-any.whl Python 3 none any Details

Total release size: 115.0 kB

Release files / mojox-0.6.3.tar.gz

Download URL mojox-0.6.3.tar.gz
Size 72.2 kB
Tags Source
SHA-256 checksum
How to use checksums
fd959139156d1e80361702042182a260f777156e85d9cc1b25b3eab57090a3dc
BLAKE2b-256 checksum
How to use checksums
52ed64cc7bb42cb0e992c64d5e8c6ffa0f7719092206a5f3dbc7650e415837b2
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 Oct 4, 2026.

Transparency log

Release files / mojox-0.6.3-py3-none-any.whl

Download URL mojox-0.6.3-py3-none-any.whl
Size 42.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c6101a726686aff2bdbd7eda15aad949ef1aadb10b301c31a4943b28b27b676
BLAKE2b-256 checksum
How to use checksums
970d48a7d65b32a6e9df05fff0e6fc5b2728b317b354e6508e2f3191dbbaffe7
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 Oct 4, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.6.3 This release

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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