Thomas Grainger
Thomas Grainger
@euri10 I don't think this makes sense anymore, given `asyncio.get_event_loop().run_until_complete(...)` is no longer supported in python3.10+
florimondmanca (Florimond Manca) the important reason on_startup and on_shutdown don't work is that they're not yield safe, eg this thing: https://discuss.python.org/t/preventing-yield-inside-certain-context-managers/1091 Secondly lifespan is yield safe but it's run at...
the context manager interface allows easy use of task groups like this: ```python import uvicorn import anyio async def throw(): raise Exception class App: def __init__(self): self._task_group = anyio.create_task_group() async...
I think it's nicer with `@asynccontextmanager`: ```python import uvicorn import contextlib2 import anyio class MyException(Exception): pass async def throw(): raise MyException @contextlib2.asynccontextmanager async def create_app(): try: async with anyio.create_task_group() as...
I'm not very familiar with contextvars, so here's my attempt at a demo: ```python import contextvars import uvicorn import anyio g = contextvars.ContextVar('g') async def throw(): raise Exception async def...
`asyncio.get_event_loop().run_until_complete(new_app())` is not supported in python3.10+
I think this would be fixed by https://github.com/encode/uvicorn/issues/1151
https://bugs.python.org/issue21998 asyncio can't survive a fork, you have to start a new loop and make sure the old loop has finished before forking - or use spawn
@orsinium
> It's not hard to implement since it's just about reading ini-file. `tox.ini` is actually quite hard to parse, because it's got [factors and factor conditional settings](https://tox.readthedocs.io/en/latest/config.html#factors-and-factor-conditional-settings) and complex factor...