m0serve
Realtime from a synchronous Python app, with no added infrastructure.
A WSGI/ASGI server written in Mojo. Point it at a Django, Flask, FastHTML or Starlette app and it serves it — no Mojo toolchain required, no compilation step, nothing to configure:
pip install m0serve
m0serve myproject.wsgi:application
What it adds over gunicorn or uvicorn is that a plain synchronous view can hold a Server-Sent Events stream or a WebSocket, by answering with two response headers — and reach every subscriber on every worker with one function call. No Channels, no Redis, no daphne, no Pushpin, no second process:
from m0serve import m0pub
def events(request): # an ordinary synchronous view
r = HttpResponse(": connected\n\n", content_type="text/event-stream")
r["M0-Hold"] = "stream" # m0serve holds the connection open
r["M0-Channel"] = "news" # ...subscribed to this channel
return r # Django's part in it ends here
def announce(request): # any view, command, or cron job
m0pub.publish("news", "deploy finished")
return HttpResponse("ok")
Run it with m0serve myproject.wsgi --realtime. The view runs first, with
sessions and permissions in hand — which is where your auth belongs. Under
gunicorn the two headers are ignored and the same view degrades to a short
plain response, so adopting this is not a fork of your codebase.
The ten-minute quickstart goes from pip install to live multi-tab sync
from one synchronous Django file:
https://github.com/codetalcott/mojo-http/blob/main/QUICKSTART.md — every
command in it is executed by CI on every pull request.
It also hosts several applications in one process, each in its native
execution mode: m0serve --mount /=shop.wsgi --mount /app=live.asgi runs
sync Django on handler threads and async FastHTML on an asyncio executor,
behind one listener with one shutdown.
The protocol is detected from the object, so the same command serves WSGI and
ASGI. m0serve --help lists the flags; --workers N, --threads N (on
free-threaded CPython) and --blocking-threads N are the topology ones.
When it is up it prints one line per worker — 🔥 m0serve: myproject.wsgi: application on http://0.0.0.0:8000 (protocol=wsgi workers=4) — after the
application has been imported, so "it printed" means "it is serving". For an
orchestrator use --health-path /health or a TCP check rather than the log
line.
If something will not start, m0serve --doctor myproject.wsgi prints a JSON
report — the interpreter it resolved and the virtualenv it came from, the
spec it discovered, the topology it settled on, and every startup check with
the fix for the ones that failed — and exits with the code the server itself
would have used. It binds nothing and imports nothing twice.
What is in the wheel
One compiled binary and the Mojo runtime it loads. No CPython — m0serve resolves libpython at run time from the interpreter it is installed beside, which is why there is no ABI tag and one wheel per platform covers CPython 3.10 through 3.14, free-threaded builds included. It has no Python dependencies and fetches nothing at install time.
Install it into the same virtual environment as your application, the way you would gunicorn or uvicorn; the console script points the embedded interpreter at that environment.
Platforms
| platform | status |
|---|---|
| macOS arm64 (Apple Silicon) | supported |
| Linux x86_64 (glibc) | supported |
| Linux aarch64 (Graviton, Ampere, arm64 Docker) | supported |
| macOS x86_64 (Intel) | not possible — Modular ships no Intel Mac toolchain |
| musl / Alpine, Windows | not supported |
The wheel's filename carries the exact macOS and glibc floors it was built
against. On an older system pip declines to install it rather than
installing something that crashes.
Status
Pre-1.0 and deliberately small: HTTP/1.1 only, no TLS, no HTTP/2 — terminate at a proxy, which is gunicorn's answer too. The API will change before 1.0.
The full capability matrix, with the CI gate behind each row, is docs/SPEC.md.
Source, documentation and issues: https://github.com/codetalcott/mojo-http
Licence
MIT, and the wheel redistributes third-party components under their own
terms — the Mojo runtime (Apache-2.0 with LLVM Exceptions) and a fork of
lightbug_http (MIT). Full text and attribution ship inside the wheel; see
NOTICE.txt beside the installed package.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file m0serve-0.16.0-py3-none-manylinux_2_35_x86_64.whl.
File metadata
- Download URL: m0serve-0.16.0-py3-none-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 1.5 MB
- Tags: Python 3, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbd1b40ae76f2e93bd3dd0c44f1fac448aef6f44918435c4e2109356948ff997
|
|
| MD5 |
3950b0fc491567565fe1e71c2317ece5
|
|
| BLAKE2b-256 |
c01c37dcf9f8635bf04fe3ad41502568063250e410a6f856770dc1d67bec6090
|
Provenance
The following attestation bundles were made for m0serve-0.16.0-py3-none-manylinux_2_35_x86_64.whl:
Publisher:
release.yml on codetalcott/mojo-http
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
m0serve-0.16.0-py3-none-manylinux_2_35_x86_64.whl -
Subject digest:
bbd1b40ae76f2e93bd3dd0c44f1fac448aef6f44918435c4e2109356948ff997 - Sigstore transparency entry: 2665402266
- Sigstore integration time:
-
Permalink:
codetalcott/mojo-http@9a30ffc718c6888d01f88a4132834aed732cd5c5 -
Branch / Tag:
refs/tags/v0.16.0 - Owner: https://github.com/codetalcott
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9a30ffc718c6888d01f88a4132834aed732cd5c5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file m0serve-0.16.0-py3-none-manylinux_2_35_aarch64.whl.
File metadata
- Download URL: m0serve-0.16.0-py3-none-manylinux_2_35_aarch64.whl
- Upload date:
- Size: 1.4 MB
- Tags: Python 3, manylinux: glibc 2.35+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ddb325bce922d11af1df7a5956c331b345a79b41933d264eb9f6375257225a35
|
|
| MD5 |
28db6acc3237d3ef84a7881c0061e640
|
|
| BLAKE2b-256 |
440e2b4b98069fa219bb6d7ce1a2ed94ea40320e2616ac5499cae64b8c42fc07
|
Provenance
The following attestation bundles were made for m0serve-0.16.0-py3-none-manylinux_2_35_aarch64.whl:
Publisher:
release.yml on codetalcott/mojo-http
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
m0serve-0.16.0-py3-none-manylinux_2_35_aarch64.whl -
Subject digest:
ddb325bce922d11af1df7a5956c331b345a79b41933d264eb9f6375257225a35 - Sigstore transparency entry: 2665402194
- Sigstore integration time:
-
Permalink:
codetalcott/mojo-http@9a30ffc718c6888d01f88a4132834aed732cd5c5 -
Branch / Tag:
refs/tags/v0.16.0 - Owner: https://github.com/codetalcott
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9a30ffc718c6888d01f88a4132834aed732cd5c5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file m0serve-0.16.0-py3-none-macosx_13_0_arm64.whl.
File metadata
- Download URL: m0serve-0.16.0-py3-none-macosx_13_0_arm64.whl
- Upload date:
- Size: 1.2 MB
- Tags: Python 3, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
056936454d9f4236e373b8029aecc0ac48a263e1e8181cbefe6a5f707e39aeac
|
|
| MD5 |
0a04c418ed0d8ae133d54b6cb06ee9b4
|
|
| BLAKE2b-256 |
c231ef5b7c89189ae19cc348b07518999c5395ad25af51bcc455c29623e924f5
|
Provenance
The following attestation bundles were made for m0serve-0.16.0-py3-none-macosx_13_0_arm64.whl:
Publisher:
release.yml on codetalcott/mojo-http
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
m0serve-0.16.0-py3-none-macosx_13_0_arm64.whl -
Subject digest:
056936454d9f4236e373b8029aecc0ac48a263e1e8181cbefe6a5f707e39aeac - Sigstore transparency entry: 2665402225
- Sigstore integration time:
-
Permalink:
codetalcott/mojo-http@9a30ffc718c6888d01f88a4132834aed732cd5c5 -
Branch / Tag:
refs/tags/v0.16.0 - Owner: https://github.com/codetalcott
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9a30ffc718c6888d01f88a4132834aed732cd5c5 -
Trigger Event:
push
-
Statement type: