Metadata-Version: 2.4
Name: mojo-http-asgi
Version: 0.0.4
Summary: Serve an ASGI application (FastAPI, Starlette, ...) with mojo-http, from its own Python environment
License-Expression: Apache-2.0 WITH LLVM-exception
Project-URL: Homepage, https://github.com/drobertson-dev/mojo-http
Project-URL: Documentation, https://github.com/drobertson-dev/mojo-http/blob/main/docs/ASGI.md
Project-URL: Changelog, https://github.com/drobertson-dev/mojo-http/blob/main/CHANGELOG.md
Project-URL: Issues, https://github.com/drobertson-dev/mojo-http/issues
Keywords: asgi,http,http2,websocket,server,fastapi,starlette,mojo
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# mojo-http-asgi

The `mojo-http` command: serve an ASGI application (FastAPI, Starlette, ...)
with [mojo-http](https://github.com/drobertson-dev/mojo-http), an HTTP
server written in Mojo, from the Python environment the application is
installed in. It is run as uvicorn is:

```sh
pip install mojo-http-asgi                    # once, into the application's environment
mojo-http main:app --port 8000 --workers 4    # instead of: uvicorn main:app --port 8000 --workers 4
```

The application and its packages are unchanged: its middleware, sessions
and dependencies run in CPython as they do under any ASGI server, and
mojo-http carries HTTP/1.1, HTTP/2 and WebSockets to it. `mojo-http --help`
lists the options (HTTPS, worker processes or free-threaded worker threads,
proxy headers, a Unix socket);
[the ASGI bridge's guide](https://github.com/drobertson-dev/mojo-http/blob/main/docs/ASGI.md)
has the details and the differences from uvicorn.

**What it needs:**

- Linux on x86-64 with glibc 2.35 or later (Ubuntu 22.04, Debian 12,
  Fedora 36 and later), and a CPU with AVX2 (x86-64-v3: Intel from 2013,
  AMD from 2015). The launcher says so on an older CPU.
- CPython 3.12 or later with a shared libpython, which the server loads:
  Python from uv, python.org, pyenv with `--enable-shared`, or a
  distribution's `libpython3.X` package. Free-threaded CPython (3.14t)
  works, with `--worker-mode thread`.

The wheel carries the server program and the libraries it loads (Mojo's
runtime, AWS-LC's libcrypto), with their license files; it needs no Mojo
toolchain. In a checkout of mojo-http, `pixi run package-wheel` builds it
and `pip install -e python/` uses the server `pixi run build-examples`
builds.
