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. Only depend on the standard library.

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 uvicorn-WSGIMiddleware 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.2.0.tar.gz (10.1 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.2.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: a2wsgi-1.2.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.3 CPython/3.7.9 Linux/5.4.0-1026-azure

File hashes

Hashes for a2wsgi-1.2.0.tar.gz
Algorithm Hash digest
SHA256 bac7c77d6564f410bef017a09dd744305b5735e0a9a81b06a48a54102f717ab2
MD5 610b8e7a904c9ae5e0054010dfc034ed
BLAKE2b-256 8e3391da462707789d61462322c346bd485f4b4a14779e97e4f8ab17ea392af4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: a2wsgi-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.3 CPython/3.7.9 Linux/5.4.0-1026-azure

File hashes

Hashes for a2wsgi-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad8590bdd9238f53af4f96dda1bc03438a6f83a88cfc2889db96cf894e490dc9
MD5 ace549c077712be44db11259fd38b7de
BLAKE2b-256 4cef3712b0ac4f199fa4e9bb32392281f6fe14a464ff0d99b66fff106291d3dd

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