-
-
Notifications
You must be signed in to change notification settings - Fork 754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type Annotation and mypy support #998
Comments
@Kludex are the files without a PR associated "up for grabs"? |
Yes. But I think both h11 and httptools implementation files need others to be merged before (not sure). But yeah, you can go for it. Ping me on that PR once you've finished so I can update the list above, please. Also, be aware that we're trying to match this: https://github.com/django/asgiref/blob/main/asgiref/typing.py, which is on the main branch, but it was not released yet. EDIT: Looks like there will be a release on |
Thanks for initiating this, @Kludex! 👏 It would be great to have type annotations in this project, and I'm happy to help. I'll start contributing PRs and code reviews as time allows. |
This blog post by @tomchristie inspired me to be more diligent about using type annotations (and asyncio): Python async frameworks - Beyond developer tribalism
I would include unit testing as a third entry in this category. After consistently working at unit testing, type annotations, and asyncio, a developer's understanding of their code will be in a completely different realm than before. |
ADDED tests:
|
Uvicorn is very close to implementing typing at which point we can upgrade and remove the ignore. encode/uvicorn#998 Signed-off-by: Joshua Hesketh <[email protected]>
(would be great to have a py.typed file as well) |
Yes. |
Only 3 missing... I'm excited! We are almost there! |
Only 2 missing 🤩 |
One missing. One... 🙏 😭 🎉 🏃 |
Are we there yet? |
You'll see a GIF with fireworks when we finish here... 😅 There's still one file missing. The thing is that while adding type annotations we usually find small bugs, and those need to fixed separately before the file gets fully type annotated. We are getting there. |
This is awesome |
Maybe a dumb question, but will this allow mypyc compilation? |
It's on my plans to study the possibility, but I know nothing about @abersheeran knows stuff. 👀 |
mypyc requires stricter type annotations and has little support for dynamic features. uvicorn may not be ready yet. By the way, In baize, mypyc improves performance by about 30%. It may not improve uvicorn as expected. |
It will be available from |
We finish the package code. Now let's finish the test files. 😅 |
Checklist
Summary
I've seen somewhere here that we want to have mypy. To be more organized, I've created the table below, so we can divide and conquer 😎 👍
I'll be creating the PRs for those files in the following days.
All files
✅: Merged.
➖: PR available / WIP.
❌: Available to pick.
EDIT: I've simplified the report.
The text was updated successfully, but these errors were encountered: