]> git.ipfire.org Git - thirdparty/starlette.git/commitdiff
Deprecate `WSGIMiddleware` in favor of `a2wsgi` (#1504)
authorMarcelo Trylesinski <marcelotryle@gmail.com>
Fri, 11 Feb 2022 16:40:34 +0000 (13:40 -0300)
committerGitHub <noreply@github.com>
Fri, 11 Feb 2022 16:40:34 +0000 (16:40 +0000)
docs/middleware.md
setup.cfg
starlette/middleware/wsgi.py

index f053e97fa15340d409b82e066db69aa676bca71a..b219142913353c335a3d4e55c143cea7014d28a4 100644 (file)
@@ -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.
index 3089eaaf78a4bb22b2bfeac9fb7351f9696a1981..9f9c7b4eb679aee215c61d2dbc4749e7161cc8ba 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -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
index 7e69e1a6b2925e74818c6ca4079e0e6b712860c5..9dbd065284aaf903ef0153a20027f66e2530eb65 100644 (file)
@@ -2,11 +2,18 @@ import io
 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:
     """