Skip to main content

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

Project description

a2wsgi

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

Pure Python. No dependencies. High performance.

Install

pip install a2wsgi

How to use

Convert WSGI app to ASGI app:

from a2wsgi import WSGIMiddleware

ASGI_APP = WSGIMiddleware(WSGI_APP)

Convert ASGI app to WSGI app:

from a2wsgi import ASGIMiddleware

WSGI_APP = ASGIMiddleware(ASGI_APP)

Benchmark

Run pytest ./benchmark.py -s to compare the performance of a2wsgi and uvicorn.middleware.wsgi.WSGIMiddleware / asgiref.wsgi.WsgiToAsgi.

Why a2wsgi

Convert WSGI app to ASGI app

The performance of uvicorn-WSGIMiddleware is higher than a2wsgi. However, when dealing with large file uploads, it is easy to cause insufficient memory uvicorn/issue#371. a2wsgi uses asyncio.run_coroutine_threadsafe to regulate the pace of reading data, thus solving this problem.

Convert ASGI app to WSGI app

The HTTP trigger of Alibaba Cloud Serverless supports the WSGI interface but not the ASGI interface, which is very useful for deploying starlette/index.py to such services.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

a2wsgi-1.0.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

a2wsgi-1.0.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file a2wsgi-1.0.0.tar.gz.

File metadata

  • Download URL: a2wsgi-1.0.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.10 CPython/3.7.8 Linux/5.3.0-1032-azure

File hashes

Hashes for a2wsgi-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ec35abd17901d8b32b1592a00db6f0fe1da33f13e40fb6f70aac83bcc7694a55
MD5 32366f953bc94cafceade7066134b8f7
BLAKE2b-256 65822fee9c5ff33bad5163f8d1a29f4c01ec577b6bc81450c522f6c5559e5dde

See more details on using hashes here.

File details

Details for the file a2wsgi-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: a2wsgi-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.10 CPython/3.7.8 Linux/5.3.0-1032-azure

File hashes

Hashes for a2wsgi-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 077bb54d4dc68f589642dd02c7539f11e0ea1d415852a4faa6d2b9b40ff8f9dd
MD5 90330e1bce4630a095305aadae62c37a
BLAKE2b-256 d066070bffe53c8d57d08f66c84f7b4aceee160a5121c0e8ec40e87db9484fde

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page