skillfed

a2wsgi

Convert WSGI app to ASGI app or ASGI app to WSGI app.

a2wsgi v1.10.10 12.2M downloads/30d#1,333 on PyPI283
Permissive license Apache-2.0 Active released

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 a2wsgi

uv

uv add a2wsgi

poetry

poetry add a2wsgi

Installing 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

Programming Language :: Python :: 3

Tags

wsgi to asgi converterasgi to wsgi adapterwsgi asgi bridgeconvert wsgi app to asgiasgi middleware wsgistreaming wsgi asgilow memory wsgi conversion
wsgi-asgi-bridgestreaming-middlewareframework-migration

More WWW/HTTP packages