Skip to content

mojo-http 0.0.4

Choose a tag to compare

@drobertson-dev drobertson-dev released this 28 Nov 16:03
· 460 commits to main since this release

The first public release.

mojo-http is an HTTP server, async runtime and FastAPI-shaped framework written in Mojo, with an ASGI bridge that serves Python applications from it. It is built by the project's own toolchain: Mojo 1.2 with this project's fixes to the compiler and standard library, pinned in the repository and fetched by pixi run toolchain-install.

What it includes

  • The server: HTTP/1.1, HTTP/2 and HTTP/3 over QUIC, WebSockets over all three, gRPC, native TLS 1.3 on AWS-LC primitives, a reverse proxy, static files, templates.
  • The runtime: worker-local tasks with join, cancellation, timers and bounded channels, on epoll or io_uring.
  • The API layer: endpoint structs whose fields are their inputs, JSON and validation by reflection, FastAPI's error format, OpenAPI and Swagger UI, a TestClient.
  • Middleware: hooks around any application or one async wrapper; CORS, trusted hosts, an https redirect, signed sessions, rate limits, request ids and security fields ship with it.
  • Clients: outbound HTTP/1.1 and HTTPS, PostgreSQL and Redis.

The README has the whole list and the quick start; CHANGELOG.md has what changed in 0.0.4.

The ASGI wheel

mojo-http-asgi runs a FastAPI or Starlette application unchanged, as uvicorn does, on CPython 3.12, 3.13, 3.14 and free-threaded 3.14t:

pip install mojo-http-asgi
mojo-http main:app --port 8000 --workers 4

It is for Linux x86-64 (glibc 2.35 or later, a CPU with AVX2). The wheel is attached here with its SHA-256; it is the file on PyPI, built and checked on a runner from this tag.

Platforms

Linux x86-64. Linux ARM64 and Apple Silicon macOS follow when the toolchain is built for them.