Thomas Grainger
Thomas Grainger
All versions of python support ParamSpec, even Python 2.7 all you need to do is import it in an "if TYPE_CHECKING:" block, or use the typing_extensions backport
how about introducing a new ASGI4Application interface? it would look like ```python ASGI4Application = Callable[[], AsyncContextManager[ASGI3Application]] ``` you'd use it with a taskgroup like this ```python import anyio.abc class SomeApp:...
asgi.rst states that: > ASGI attempts to preserve a simple application interface, while providing an abstraction that allows for data to be sent and received at any time, and from...
It's also possible to run two eventloops in one thread. Eg two asyncio eventloops using alternating .run_until_complete calls. or trio guest mode. A RunVar will also handle this scenario
Alternatively asgiref should specify that once a web server starts a lifespan task it *MUST NOT* call the asgi app from any other thread or event loop until the lifespan...
I'm using lifespan to manage a trio Nursery via anyio. This doc change would mean I and quart-trio would need to use a RunVar to store the Nursery in
Sure I'll see what I can do
consider an asgi app and threaded server: ```python from __future__ import annotations import sys import asyncio import anyio.abc import traceback import concurrent.futures async def background_async_fn(): print("processing") await anyio.sleep(1) print("done") class...
however I can fix the app by using an anyio.lowlevel.RunVar to store the task_group in: ```python from __future__ import annotations import sys import asyncio import anyio.abc import anyio.lowlevel import traceback...
`anyio.lowlevel.RunVar` is half-way between a threadlocal and a contextvar. It's driven by a `WeakKeyDict` keyed by the `asyncio.get_running_loop()` or `trio.lowlevel.current_token()`