a2wsgi
Convert WSGI app to ASGI app or ASGI app to WSGI app.
What it is and what it does
a2wsgi is a bidirectional converter between WSGI and ASGI application interfaces. It wraps a WSGI app to run as ASGI (using a thread pool of up to 10 threads by default) or wraps an ASGI app to run as WSGI (with optional timeout for background tasks). The core design avoids accumulating request or response content in memory, streaming data instead—a difference from converters in uvicorn, startlette, or hypercorn that may buffer entire payloads.
The package is pure Python, depends only on typing_extensions at runtime, and requires Python 3.8 or later. It exposes the original WSGI environ or ASGI scope through special keys, allowing applications to access protocol-level details when needed. Typical use is migrating legacy WSGI projects to ASGI frameworks or deploying ASGI apps in WSGI-only hosting environments.
Use it for:
- Migrate a Flask or Django WSGI app to run on an ASGI server like Starlette or FastAPI without rewriting the application.
- Deploy a FastAPI or Starlette ASGI app on traditional WSGI-only hosting (e.g., Apache with mod_wsgi).
- Handle large file uploads or streaming responses without memory overhead in WSGI-to-ASGI conversion.
- Bridge WSGI and ASGI middleware in a single application stack for gradual framework migration.
- Access original protocol details (WSGI environ or ASGI scope) from the opposite protocol layer.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts between WSGI and ASGI applications bidirectionally without buffering request or response content in memory.
Yes. a2wsgi solves a real problem—bidirectional WSGI/ASGI conversion without memory buffering—with low install friction, active maintenance, no known vulnerabilities, and a permissive license. Install it when you need to bridge WSGI and ASGI applications or migrate between them.
Install
a2wsgi on PyPI
pip
pip install a2wsgiuv
uv add a2wsgipoetry
poetry add a2wsgiInstalling a2wsgi
Before you install
Low friction: pure Python with only typing_extensions as a runtime dependency. Active maintenance with recent releases; last commit 2026-03-22 and latest release 2025-06-18.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most deployment scenarios.
Quickstart
# Convert WSGI app to ASGI
from a2wsgi import WSGIMiddleware
ASGI_APP = WSGIMiddleware(WSGI_APP)
# Or convert ASGI app to WSGI
from a2wsgi import ASGIMiddleware
WSGI_APP = ASGIMiddleware(ASGI_APP)
Requires Python 3.8 or later. WSGIMiddleware uses a thread pool (default 10 threads) and queue (default size 10) which may need tuning for high-concurrency workloads.
Verify before relying
- Performance characteristics compared to uvicorn/startlette/hypercorn converters beyond memory buffering claims
- Thread pool behavior under high concurrency or with workers parameter tuning
- Queue size tuning guidance for different workload profiles
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.8.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — typing_extensions |
| Maintenance | actively maintained — 422 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 12,244,758/month — #1,333 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: a2wsgi-1.10.10-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
asgirefProvides ASGI base libraries including…
permissive · top 1,000 on PyPI
uvicornUvicorn is an ASGI web server that runs async…
permissive · top 100 on PyPI
zappaZappa packages and deploys Python WSGI and ASGI…
permissive · top 15,000 on PyPI
brotli-asgiBrotliMiddleware adds Brotli compression to…
permissive · top 15,000 on PyPI
async-asgi-testclientProvides an async test client for ASGI web…
permissive · top 15,000 on PyPI
gunicornGunicorn is a WSGI and ASGI HTTP server for…
permissive · top 1,000 on PyPI
apig-wsgiWraps a WSGI application to run as an AWS…
permissive · top 15,000 on PyPI
servestaticServeStatic serves static files efficiently…
permissive · top 15,000 on PyPI
multipartParses multipart/form-data submissions with…
permissive · top 5,000 on PyPI
mangumMangum adapts ASGI applications to run on AWS…
permissive · top 5,000 on PyPI