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.

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.1.0.tar.gz (10.3 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.1.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for a2wsgi-1.1.0.tar.gz
Algorithm Hash digest
SHA256 ed2c25f0fd6ada9e329dc2cf33bdaa87be50732cd702d403cb0c99ba2de6ba08
MD5 68d533f3bf4a13ecc3878358d4b80df8
BLAKE2b-256 533911ebdd84c6cd113f782e4d23beae8ca862a96631a1fc3ef94bcbfd437a91

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for a2wsgi-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4431ccda3ce650123a0b8dd1f238dadc221e76b936bf7c1e6d6ea0bc6a7994cf
MD5 e01cd44569c29d79c216c1bf4ffff065
BLAKE2b-256 3804da56336d311c77f9546bb6581e9c35b7267ef28fe7ac3880d9423454a69b

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