mojox-build
PEP 517 + PEP 660 build backend that compiles Mojo libraries into platform-tagged wheels.
Declare it in [build-system] and let uv build or pip wheel handle the rest.
Quickstart
# pyproject.toml
[project]
name = "boucle"
version = "0.2.0"
description = "Async event loop primitives for Mojo"
readme = "README.md"
license = "Apache-2.0"
requires-python = ">=3.10"
dependencies = ["mojox", "mojo-compiler>=1.0,<2"]
[build-system]
requires = ["mojox-build>=0.4", "mojo-compiler>=1.0,<2"]
build-backend = "mojox_build"
[tool.mojox]
packages = ["boucle"]
uv build # -> dist/boucle-0.2.0-py3-none-manylinux_2_43_x86_64.whl
uv publish # uploads to PyPI
The wheel places compiled .mojoc packages under mojo_packages/, which mojox discovers at runtime.
[tool.mojox] reference
The full [tool.mojox] table is owned by mojox-core and shared with the CLI. Keys relevant to the build backend:
| Key | Type | Default | Purpose |
|---|---|---|---|
package-root |
str | "src" |
Directory containing top-level package dirs to compile |
packages |
list[str] | (auto-scan package-root) |
Explicit list of source directories. Each becomes one .mojoc |
build-profile |
str | "release" |
Profile for wheel builds and mojox build (--profile overrides) |
native-libs |
list[str] | [] |
Pre-built .so/.dylib files to copy into mojo_packages/lib/ |
defines |
table | {} |
-D KEY=VALUE flags passed to mojo precompile |
flags |
list[str] | [] |
Extra flags appended to every compile invocation |
source-include |
list[str] | (sensible default) | Glob patterns of files to include in the sdist |
source-exclude |
list[str] | [] |
Glob patterns to exclude from the sdist |
wheel-exclude |
list[str] | [] |
Glob patterns to exclude from the wheel |
Unknown keys print a warning during builds instead of failing, so a project using a newer key still builds with an older mojox-build.
How it works
- A PEP 517 frontend (
uv build,pip wheel) callsbuild_wheel(),build_sdist(), orbuild_editable(). - The hook reads
pyproject.tomlviamojox-core's manifest parser. - Policy is resolved from the active build profile (defaults to
release). mojo precompileruns for each package directory, producing.mojocfiles.- The compiled packages, native libs, and metadata are assembled into a wheel tagged with the host platform.
Architecture
Five modules, roughly 1100 lines total:
__init__.pyre-exports the PEP 517 hook surface._hooks.pyimplements PEP 517 + PEP 660 hooks (thin glue that wires config, preflight, and build together)._build.pyhandles compilation, wheel assembly, sdist assembly, and editable installs._metadata.pyrenders PEP 621 / PEP 643 METADATA and PEP 427 WHEEL files._preflight.pyvalidates the build environment before compilation starts.
Config parsing, policy resolution, and toolchain detection live in mojox-core (0.7.x required, installed automatically). The only other runtime dependency beyond the stdlib is packaging (for platform tags).
Features
- Platform-tagged wheels. Compiled packages are native code. Wheels are tagged with the host platform (
manylinux_2_34_x86_64,macosx_13_0_arm64, etc.), so cross-platform installs are correctly rejected by the resolver. - Native lib bundling. List
.so/.dylibpaths innative-libs. They ship inmojo_packages/lib/, wheremojoxadds them toLD_LIBRARY_PATHat runtime. - PEP 660 editable installs.
uv pip install -e .works. For rebuild-on-change semantics, addcache-keys = [{ file = "pyproject.toml" }, { file = "**/*.mojo" }]to[tool.uv]. - Per-distribution editable files. Two mojox projects installed editable into the same venv do not clobber each other.
- Reproducible builds. ZIP and tar timestamps respect
SOURCE_DATE_EPOCH. - Parallel compilation. Multi-package repos compile concurrently, capped at 8 workers.
- Preflight checks. Missing
mojo, missing dirs, missing native libs, bad config -- one clean error message, not a compiler stderr dump. - Full PEP 621 / PEP 639 metadata. Authors, maintainers, urls, keywords, classifiers, optional-dependencies, license-files all flow into wheel METADATA.
- Compiler pin. When packages are compiled,
Requires-Dist: mojo-compiler==<version>is emitted in the wheel METADATA so the resolver enforces compiler compatibility. - Content-based platform tags. Wheels with native libs or binaries get a platform tag; pure-metadata wheels stay
any. --config-setting verbose=true. Streams compiler output during builds for debugging.
Limitations
- Dynamic
project.versionis not supported. Declare it statically. - Editable installs rebuild the full wheel on every invocation. There is no source-import fast path because the package is compiled bytecode.
- Cross-compilation is not exposed. Wheels are host-platform only.
See also
- mojox-core -- manifest parsing, policy resolution, toolchain detection
- mojox -- CLI for running, testing, and managing Mojo projects
License
MIT
Metadata
Release files for mojox-build 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mojox_build-0.7.0.tar.gz | 18.2 kB | With provenance | Details for mojox_build-0.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mojox_build-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for mojox_build-0.7.0-py3-none-any.whl |
Total release size: 33.2 kB
Release files / mojox_build-0.7.0.tar.gz
| Download URL | mojox_build-0.7.0.tar.gz |
|---|---|
| Size | 18.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab5d33291cccb5a3d86d3ee8419a64a1ed3125454d7ae68abb9077fde0941cc3
|
|
BLAKE2b-256 checksum How to use checksums |
4052dddbb4c7963d6d6ee37418166f5b617e87274dd4acffdf93710e97860c1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 18, 2026.
Transparency logRelease files / mojox_build-0.7.0-py3-none-any.whl
| Download URL | mojox_build-0.7.0-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c74312dfaa0129110a465aa1e2c25adeac56f43e104cdf5a0336ab75448047a5
|
|
BLAKE2b-256 checksum How to use checksums |
d512c196988aad548be1d127bdf15f1b654d4e9030266ecf901e884a3dfa76ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 18, 2026.
Transparency logSecurity for mojox-build 0.7.0
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
Both files in this release have been uploaded with provenance metadata.
Attestation for mojox_build-0.7.0.tar.gz
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 Nov 18, 2026.
Transparency logA 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.