From 3f6d4f5969d8c153477c534a31fc50925843f7b0 Mon Sep 17 00:00:00 2001 From: Marcelo Trylesinski Date: Mon, 14 Feb 2022 12:41:58 -0300 Subject: [PATCH] Deprecate run_until_first_complete (#1443) Co-authored-by: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com> Co-authored-by: Tom Christie --- setup.cfg | 1 + starlette/concurrency.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/setup.cfg b/setup.cfg index 9f9c7b4eb..f1a5c9929 100644 --- 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: run_until_first_complete is deprecated and will be removed in a future version.:DeprecationWarning ignore: starlette\.middleware\.wsgi is deprecated and will be removed in a future release\.*:DeprecationWarning [coverage:run] diff --git a/starlette/concurrency.py b/starlette/concurrency.py index ac2ce6eb7..5c76cb3df 100644 --- a/starlette/concurrency.py +++ b/starlette/concurrency.py @@ -1,6 +1,7 @@ import functools import sys import typing +import warnings import anyio @@ -15,6 +16,12 @@ async def run_until_first_complete(*args: typing.Tuple[typing.Callable, dict]) -> None: + warnings.warn( + "run_until_first_complete is deprecated " + "and will be removed in a future version.", + DeprecationWarning, + ) + async with anyio.create_task_group() as task_group: async def run(func: typing.Callable[[], typing.Coroutine]) -> None: