diff --git a/setup.cfg b/setup.cfg index 7f218b27b..66a81dd5a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -64,6 +64,7 @@ filterwarnings= error # 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:The built-in `WSGIMiddleware` will be deprecated in future versions, please use `a2wsgi.WSGIMiddleware` instead.:DeprecationWarning [coverage:run] omit = venv/* diff --git a/uvicorn/middleware/wsgi.py b/uvicorn/middleware/wsgi.py index 74bdfada4..7155652b3 100644 --- a/uvicorn/middleware/wsgi.py +++ b/uvicorn/middleware/wsgi.py @@ -2,6 +2,7 @@ import concurrent.futures import io import sys +import warnings from collections import deque from typing import Deque, Iterable, Optional, Tuple @@ -18,6 +19,12 @@ from uvicorn._types import Environ, ExcInfo, StartResponse, WSGIApp +warnings.warn( + "The built-in `WSGIMiddleware` will be deprecated in" + " future versions, please use `a2wsgi.WSGIMiddleware` instead.", + DeprecationWarning, +) + def build_environ(scope: HTTPScope, message: ASGIReceiveEvent, body: bytes) -> Environ: """