mangum
AWS Lambda support for ASGI applications
What it is and what it does
Mangum is a bridge that lets you run ASGI-based web applications directly on AWS Lambda. It translates Lambda events from various AWS services—API Gateway, Application Load Balancer, Function URLs, and Lambda@Edge—into the ASGI protocol, then converts the ASGI response back into a Lambda-compatible format. This lets you write your application once using a standard ASGI framework and deploy it to Lambda without rewriting for Lambda's native event model.
The package handles practical deployment concerns: binary media types, payload compression (GZip or Brotli), and ASGI lifespan events for startup and shutdown. It integrates with standard deployment tools like Serverless Framework and AWS SAM, making it straightforward to incorporate into existing Lambda workflows. With a single runtime dependency and low install friction, it's designed to be a thin, transparent adapter.
Use it for:
- Deploy an ASGI REST API to Lambda behind API Gateway without rewriting the application.
- Migrate an existing ASGI web app from a traditional server to Lambda with minimal code changes.
- Build serverless web services that handle binary responses via API Gateway.
- Use Lambda@Edge to serve dynamic content from CloudFront with an ASGI application.
- Combine Lambda Function URLs with an ASGI framework for simple HTTP endpoints.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Mangum adapts ASGI applications to run on AWS Lambda, handling events from Function URLs, API Gateway (HTTP and REST), Application Load Balancer, and Lambda@Edge.
Yes. Mangum is actively maintained, permissively licensed, and carries no known vulnerabilities. Install it if you need to run an ASGI application on AWS Lambda or are considering Lambda for an existing ASGI codebase. The single dependency and low friction make adoption straightforward.
Install
mangum on PyPI
pip
pip install mangumuv
uv add mangumpoetry
poetry add mangumInstalling mangum
Before you install
Low friction: pure Python wheel with a single runtime dependency (typing-extensions). Actively maintained with recent commits and a large user base (6749932 monthly downloads).
License in practice
MIT license (permissive) imposes no restrictions on commercial or private use; you may modify and redistribute with attribution.
Quickstart
pip install mangum
from mangum import Mangum
async def app(scope, receive, send):
await send({
"type": "http.response.start",
"status": 200,
"headers": [[b"content-type", b"text/plain"]],
})
await send({"type": "http.response.body", "body": b"Hello, world!"})
handler = Mangum(app, lifespan="off")
Requires Python 3.9 or later; the ASGI application itself must be installed separately.
Verify before relying
- Performance characteristics under high concurrency or large payloads on Lambda.
- Compatibility matrix with specific versions of major ASGI frameworks.
- Cold-start overhead compared to native Lambda handlers.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — typing-extensions |
| Maintenance | actively maintained — 194 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 6,749,932/month — #1,858 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: mangum-0.21.0-py3-none-any.whl
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
apig-wsgiWraps a WSGI application to run as an AWS…
permissive · top 15,000 on PyPI
awslambdaricImplements the AWS Lambda Runtime API to make…
permissive · top 5,000 on PyPI
zappaZappa packages and deploys Python WSGI and ASGI…
permissive · top 15,000 on PyPI
asgi-lifespanProgrammatically trigger ASGI application…
permissive · top 5,000 on PyPI
aws-sam-cliAWS SAM CLI is a command-line tool for…
permissive · top 5,000 on PyPI
aws-sam-translatorTransforms AWS Serverless Application Model…
permissive · top 1,000 on PyPI
awsgi2Bridges WSGI-compatible web frameworks to AWS…
permissive · top 15,000 on PyPI
a2wsgiConverts between WSGI and ASGI applications…
permissive · top 5,000 on PyPI
aiohttp-asgi-connectorProvides an AIOHTTP connector that lets you…
permissive · top 15,000 on PyPI
piccolo-apiExposes Piccolo ORM tables as REST endpoints in…
permissive · top 15,000 on PyPI