Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-asgiref for openSUSE:Factory checked in at 2023-01-08 21:25:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-asgiref (Old) and /work/SRC/openSUSE:Factory/.python-asgiref.new.1563 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-asgiref" Sun Jan 8 21:25:07 2023 rev:8 rq:1056748 version:3.6.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-asgiref/python-asgiref.changes 2022-06-06 11:10:43.195324766 +0200 +++ /work/SRC/openSUSE:Factory/.python-asgiref.new.1563/python-asgiref.changes 2023-01-08 21:25:08.631106073 +0100 @@ -1,0 +2,24 @@ +Sat Jan 7 09:11:28 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 3.6.0: + * Two new functions are added to the ``asgiref.sync`` module: + ``iscoroutinefunction()`` and ``markcoroutinefunction()``. + * Python 3.12 deprecates ``asyncio.iscoroutinefunction()`` as an alias for + ``inspect.iscoroutinefunction()``, whilst also removing the + ``_is_coroutine`` marker. The latter is replaced with the + ``inspect.markcoroutinefunction`` decorator. + * The new ``asgiref.sync`` functions are compatibility shims for these + functions that can be used until Python 3.12 is the minimum supported + version. + * The ``loop`` argument to ``asgiref.timeout.timeout`` is deprecated. As per + other ``asyncio`` based APIs, the running event loop is used by default. + Note that ``asyncio`` provides timeout utilities from Python 3.11, and + these should be preferred where available. + * Support for the ``ASGI_THREADS`` environment variable, used by + ``SyncToAsync``, is removed. In general, a running event-loop is not + available to `asgiref` at import time, and so the default thread pool + executor cannot be configured. Protocol servers, or applications, should set + the default executor as required when configuring the event loop at + application startup. + +------------------------------------------------------------------- Old: ---- asgiref-3.5.2.tar.gz New: ---- asgiref-3.6.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-asgiref.spec ++++++ --- /var/tmp/diff_new_pack.QCfac7/_old 2023-01-08 21:25:09.491111183 +0100 +++ /var/tmp/diff_new_pack.QCfac7/_new 2023-01-08 21:25:09.499111230 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-asgiref # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %define skip_python2 1 %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-asgiref -Version: 3.5.2 +Version: 3.6.0 Release: 0 Summary: ASGI specs, helper code, and adapters License: BSD-3-Clause ++++++ asgiref-3.5.2.tar.gz -> asgiref-3.6.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asgiref-3.5.2/PKG-INFO new/asgiref-3.6.0/PKG-INFO --- old/asgiref-3.5.2/PKG-INFO 2022-05-16 22:39:02.462978600 +0200 +++ new/asgiref-3.6.0/PKG-INFO 2022-12-20 10:06:25.459167200 +0100 @@ -1,11 +1,11 @@ Metadata-Version: 2.1 Name: asgiref -Version: 3.5.2 +Version: 3.6.0 Summary: ASGI specs, helper code, and adapters Home-page: https://github.com/django/asgiref/ Author: Django Software Foundation Author-email: foundat...@djangoproject.com -License: BSD +License: BSD-3-Clause Project-URL: Documentation, https://asgi.readthedocs.io/ Project-URL: Further Documentation, https://docs.djangoproject.com/en/stable/topics/async/#async-adapter-functions Project-URL: Changelog, https://github.com/django/asgiref/blob/master/CHANGELOG.txt @@ -21,6 +21,7 @@ Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 Classifier: Topic :: Internet :: WWW/HTTP Requires-Python: >=3.7 Provides-Extra: tests diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asgiref-3.5.2/asgiref/__init__.py new/asgiref-3.6.0/asgiref/__init__.py --- old/asgiref-3.5.2/asgiref/__init__.py 2022-05-16 22:29:01.000000000 +0200 +++ new/asgiref-3.6.0/asgiref/__init__.py 2022-12-20 09:57:26.000000000 +0100 @@ -1 +1 @@ -__version__ = "3.5.2" +__version__ = "3.6.0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asgiref-3.5.2/asgiref/compatibility.py new/asgiref-3.6.0/asgiref/compatibility.py --- old/asgiref-3.5.2/asgiref/compatibility.py 2022-01-22 17:43:01.000000000 +0100 +++ new/asgiref-3.6.0/asgiref/compatibility.py 2022-12-15 10:04:51.000000000 +0100 @@ -1,6 +1,7 @@ -import asyncio import inspect +from .sync import iscoroutinefunction + def is_double_callable(application): """ @@ -18,10 +19,10 @@ if hasattr(application, "__call__"): # We only check to see if its __call__ is a coroutine function - # if it's not, it still might be a coroutine function itself. - if asyncio.iscoroutinefunction(application.__call__): + if iscoroutinefunction(application.__call__): return False # Non-classes we just check directly - return not asyncio.iscoroutinefunction(application) + return not iscoroutinefunction(application) def double_to_single_callable(application): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asgiref-3.5.2/asgiref/sync.py new/asgiref-3.6.0/asgiref/sync.py --- old/asgiref-3.5.2/asgiref/sync.py 2022-05-16 22:28:11.000000000 +0200 +++ new/asgiref-3.6.0/asgiref/sync.py 2022-12-15 10:04:51.000000000 +0100 @@ -26,19 +26,41 @@ cvar.set(context.get(cvar)) +# Python 3.12 deprecates asyncio.iscoroutinefunction() as an alias for +# inspect.iscoroutinefunction(), whilst also removing the _is_coroutine marker. +# The latter is replaced with the inspect.markcoroutinefunction decorator. +# Until 3.12 is the minimum supported Python version, provide a shim. +# Django 4.0 only supports 3.8+, so don't concern with the _or_partial backport. + +# Type hint: should be generic: whatever T it takes it returns. (Same id) +def markcoroutinefunction(func: Any) -> Any: + if hasattr(inspect, "markcoroutinefunction"): + return inspect.markcoroutinefunction(func) + else: + func._is_coroutine = asyncio.coroutines._is_coroutine # type: ignore + return func + + +def iscoroutinefunction(func: Any) -> bool: + if hasattr(inspect, "markcoroutinefunction"): + return inspect.iscoroutinefunction(func) + else: + return asyncio.iscoroutinefunction(func) + + def _iscoroutinefunction_or_partial(func: Any) -> bool: # Python < 3.8 does not correctly determine partially wrapped # coroutine functions are coroutine functions, hence the need for # this to exist. Code taken from CPython. if sys.version_info >= (3, 8): - return asyncio.iscoroutinefunction(func) + return iscoroutinefunction(func) else: while inspect.ismethod(func): func = func.__func__ while isinstance(func, functools.partial): func = func.func - return asyncio.iscoroutinefunction(func) + return iscoroutinefunction(func) class ThreadSensitiveContext: @@ -314,15 +336,6 @@ a TypeError will be raised. """ - # If they've set ASGI_THREADS, update the default asyncio executor for now - if "ASGI_THREADS" in os.environ: - # We use get_event_loop here - not get_running_loop - as this will - # be run at import time, and we want to update the main thread's loop. - loop = asyncio.get_event_loop() - loop.set_default_executor( - ThreadPoolExecutor(max_workers=int(os.environ["ASGI_THREADS"])) - ) - # Maps launched threads to the coroutines that spawned them launch_map: "Dict[threading.Thread, asyncio.Task[object]]" = {} @@ -365,7 +378,7 @@ self.func = func functools.update_wrapper(self, func) self._thread_sensitive = thread_sensitive - self._is_coroutine = asyncio.coroutines._is_coroutine # type: ignore + markcoroutinefunction(self) if thread_sensitive and executor is not None: raise TypeError("executor must not be set when thread_sensitive is True") self._executor = executor @@ -445,7 +458,8 @@ """ Include self for methods """ - return functools.partial(self.__call__, parent) + func = functools.partial(self.__call__, parent) + return functools.update_wrapper(func, self.func) def thread_handler(self, loop, source_task, exc_info, func, *args, **kwargs): """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asgiref-3.5.2/asgiref/timeout.py new/asgiref-3.6.0/asgiref/timeout.py --- old/asgiref-3.5.2/asgiref/timeout.py 2022-01-22 17:43:01.000000000 +0100 +++ new/asgiref-3.6.0/asgiref/timeout.py 2022-12-15 19:33:28.000000000 +0100 @@ -7,8 +7,10 @@ import asyncio +import warnings from types import TracebackType -from typing import Any, Optional, Type +from typing import Any # noqa +from typing import Optional, Type class timeout: @@ -34,7 +36,11 @@ ) -> None: self._timeout = timeout if loop is None: - loop = asyncio.get_event_loop() + loop = asyncio.get_running_loop() + else: + warnings.warn( + """The loop argument to timeout() is deprecated.""", DeprecationWarning + ) self._loop = loop self._task = None # type: Optional[asyncio.Task[Any]] self._cancelled = False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asgiref-3.5.2/asgiref/typing.py new/asgiref-3.6.0/asgiref/typing.py --- old/asgiref-3.5.2/asgiref/typing.py 2022-01-22 17:53:53.000000000 +0100 +++ new/asgiref-3.6.0/asgiref/typing.py 2022-12-15 10:04:51.000000000 +0100 @@ -16,6 +16,7 @@ "HTTPRequestEvent", "HTTPResponseStartEvent", "HTTPResponseBodyEvent", + "HTTPResponseTrailersEvent", "HTTPServerPushEvent", "HTTPDisconnectEvent", "WebSocketConnectEvent", @@ -99,6 +100,7 @@ type: Literal["http.response.start"] status: int headers: Iterable[Tuple[bytes, bytes]] + trailers: bool class HTTPResponseBodyEvent(TypedDict): @@ -107,6 +109,12 @@ more_body: bool +class HTTPResponseTrailersEvent(TypedDict): + type: Literal["http.response.trailers"] + headers: Iterable[Tuple[bytes, bytes]] + more_trailers: bool + + class HTTPServerPushEvent(TypedDict): type: Literal["http.response.push"] path: str @@ -202,6 +210,7 @@ ASGISendEvent = Union[ HTTPResponseStartEvent, HTTPResponseBodyEvent, + HTTPResponseTrailersEvent, HTTPServerPushEvent, HTTPDisconnectEvent, WebSocketAcceptEvent, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asgiref-3.5.2/asgiref.egg-info/PKG-INFO new/asgiref-3.6.0/asgiref.egg-info/PKG-INFO --- old/asgiref-3.5.2/asgiref.egg-info/PKG-INFO 2022-05-16 22:39:02.000000000 +0200 +++ new/asgiref-3.6.0/asgiref.egg-info/PKG-INFO 2022-12-20 10:06:25.000000000 +0100 @@ -1,11 +1,11 @@ Metadata-Version: 2.1 Name: asgiref -Version: 3.5.2 +Version: 3.6.0 Summary: ASGI specs, helper code, and adapters Home-page: https://github.com/django/asgiref/ Author: Django Software Foundation Author-email: foundat...@djangoproject.com -License: BSD +License: BSD-3-Clause Project-URL: Documentation, https://asgi.readthedocs.io/ Project-URL: Further Documentation, https://docs.djangoproject.com/en/stable/topics/async/#async-adapter-functions Project-URL: Changelog, https://github.com/django/asgiref/blob/master/CHANGELOG.txt @@ -21,6 +21,7 @@ Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 Classifier: Topic :: Internet :: WWW/HTTP Requires-Python: >=3.7 Provides-Extra: tests diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asgiref-3.5.2/setup.cfg new/asgiref-3.6.0/setup.cfg --- old/asgiref-3.5.2/setup.cfg 2022-05-16 22:39:02.462978600 +0200 +++ new/asgiref-3.6.0/setup.cfg 2022-12-20 10:06:25.459771600 +0100 @@ -6,7 +6,7 @@ author_email = foundat...@djangoproject.com description = ASGI specs, helper code, and adapters long_description = file: README.rst -license = BSD +license = BSD-3-Clause classifiers = Development Status :: 5 - Production/Stable Environment :: Web Environment @@ -20,6 +20,7 @@ Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 Topic :: Internet :: WWW/HTTP project_urls = Documentation = https://asgi.readthedocs.io/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asgiref-3.5.2/tests/test_server.py new/asgiref-3.6.0/tests/test_server.py --- old/asgiref-3.5.2/tests/test_server.py 2022-05-16 22:28:11.000000000 +0200 +++ new/asgiref-3.6.0/tests/test_server.py 2022-12-15 10:04:51.000000000 +0100 @@ -61,10 +61,10 @@ async def register(self, server_addr, name=None): name = name or self.name - self._sock.sendto(f"Register {name}".encode("utf-8"), server_addr) + self._sock.sendto(f"Register {name}".encode(), server_addr) async def send(self, server_addr, to, msg): - self._sock.sendto(f"To {to} {msg}".encode("utf-8"), server_addr) + self._sock.sendto(f"To {to} {msg}".encode(), server_addr) async def get_msg(self): msg, server_addr = await sock_recvfrom(self._sock, 4096) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asgiref-3.5.2/tests/test_sync.py new/asgiref-3.6.0/tests/test_sync.py --- old/asgiref-3.5.2/tests/test_sync.py 2022-05-16 22:28:11.000000000 +0200 +++ new/asgiref-3.6.0/tests/test_sync.py 2022-12-15 10:04:51.000000000 +0100 @@ -10,7 +10,12 @@ import pytest -from asgiref.sync import ThreadSensitiveContext, async_to_sync, sync_to_async +from asgiref.sync import ( + ThreadSensitiveContext, + async_to_sync, + iscoroutinefunction, + sync_to_async, +) from asgiref.timeout import timeout @@ -645,8 +650,8 @@ def sync_func(): return - assert not asyncio.iscoroutinefunction(sync_to_async) - assert asyncio.iscoroutinefunction(sync_to_async(sync_func)) + assert not iscoroutinefunction(sync_to_async) + assert iscoroutinefunction(sync_to_async(sync_func)) async def async_process(queue):