Results 965 comments of Thomas Grainger

@GuntherRademacher you can use gist.github.com to host snips, see https://mypy-play.net/?mypy=latest&python=3.9&gist=093bbe811427f7a8a164311a9cd0efa1

some other ideas: ## A new event Perhaps there should be an additional event - `'lifespan.startup.acknowledge'` which can be sent at any time that signals acceptance of the lifespan scope...

I'd like to be able to propagate exceptions before startup complete too, but that's a bigger spec change. Eg if my task is cancelled I won't be able to send...

starlette `0.16.0` is now slightly violating the asgi spec here: https://github.com/encode/starlette/blob/e45c5793611bfec606cd9c5d56887ddc67f77c38/starlette/routing.py#L628 and will `send` `"lifespan.shutdown.complete"` or `"lifespan.shutdown.failed"` regardless of how `await receive()` completes. Eg if `await receive()` is completed with...

here's an issue where this spec violation bites: https://gitlab.com/pgjones/hypercorn/-/merge_requests/56/diffs

> This is a first pass draft, fairly sure it's broken for python versions lower than 3.8. typing_extensions.ParamSpec has been backported to python 3.6 so it should still work fine....

> Future is only generic in 3.9+ and will throw exceptions in previous versions, removed it for now You'll need to use a forward reference with `"Future[R]"`

> 3.9 Tests are passing and these are the mypy issues left. Most of which seem to be caused by mypy not recognizing Generic's can accept ParamSpecs. > > ```...

Sadly mypy 0.910 will choke on this. I think the work-around is to provide these aliases in a new module eg `asgiref.sync_paramspec`

mypy 0.930 is out with experimental support for ParamSpec! https://mypy-lang.blogspot.com/2021/12/mypy-0930-released.html?m=1 This is particularly good as it has support for `Generic[P, R]`