Use of asgiref typing
See original GitHub issueChecklist
- There are no similar issues or pull requests for this yet.
- @JayH5 and @Kludex are positive about this idea, but it was not discussed on our Gitter channel.
Is your feature related to a problem? Please describe.
On uvicorn
we started a mypy
compliance goal since some time ago, and we’re about to accomplish it. On this road, we decided to use asgiref typing to annotate ASGI related types.
What I propose is that we do the same for Starlette
.
Describe the solution you would like.
Remove the types.py
module, and annotate everything that is needed with asgiref.typing
types.
There’s no matching type to Message
, as discussed on #1206 . So even if it would be more pleasant to our users, unfortunately it will be more troublesome to follow that path.
Describe alternatives you considered
Use Message
as Union[ASGISendCallable, ASGIReceiveCallable]
and solve the mypy
issues. It will be more pleasant to ours users.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top Results From Across the Web
asgiref
ASGI is a standard for Python asynchronous web apps and servers to communicate with each other, and positioned as an asynchronous successor to...
Read more >How to use the asgiref.sync function in ...
To help you get started, we've selected a few asgiref.sync examples, based on popular ways it is used in public projects.
Read more >fastapi uvicorn No module named 'asgiref.typing'
... simple fastapi application. Once I want to serve it with uvicron I got this error; ModuleNotFoundError: No module named 'asgiref.typing'.
Read more >Source code for asgiref.sync
This uses an asgiref # Local, not a threadlocal, so that tasks can work out what their ... __self__ # type: ignore except...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I helped with type-annotating Uvicorn, and I’m happy to help here as well.
I’ve already made some good progress, and I’m on step 3 now. I need to correct a few type errors, now that we’re importing from the more specific asgiref types.
Should have a PR up shortly.
@br3ndonland Cool! I’ll be happy to review it.
Just take in consideration that the steps mentioned were also a way to minimize the diff and make the review process easier. 🙏