Skip to content

Commit

Permalink
Deprecate WSGIMiddleware in favor of a2wsgi (#1504)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex authored Feb 11, 2022
1 parent e7c1858 commit 38185f3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,3 +305,7 @@ can be used to profile and monitor distributed applications.

A middleware class to emit timing information (cpu and wall time) for each request which
passes through it. Includes examples for how to emit these timings as statsd metrics.

#### [WSGIMiddleware](https://github.com/abersheeran/a2wsgi)

A middleware class in charge of converting a WSGI application into an ASGI one.
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ filterwarnings=
ignore: The 'variables' alias has been deprecated. Please use 'variable_values' instead\.:DeprecationWarning
# Workaround for Python 3.9.7 (see https://bugs.python.org/issue45097)
ignore:The loop argument is deprecated since Python 3\.8, and scheduled for removal in Python 3\.10\.:DeprecationWarning:asyncio
ignore: starlette\.middleware\.wsgi is deprecated and will be removed in a future release\.*:DeprecationWarning

[coverage:run]
source_pkgs = starlette, tests
Expand Down
7 changes: 7 additions & 0 deletions starlette/middleware/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@
import math
import sys
import typing
import warnings

import anyio

from starlette.types import Receive, Scope, Send

warnings.warn(
"starlette.middleware.wsgi is deprecated and will be removed in a future release. "
"Please refer to https://github.com/abersheeran/a2wsgi as a replacement.",
DeprecationWarning,
)


def build_environ(scope: Scope, body: bytes) -> dict:
"""
Expand Down

0 comments on commit 38185f3

Please sign in to comment.