-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add type annotations #341
Add type annotations #341
Conversation
- Annotate the package. - Annotate the tests. - Run mypy in CI (in both Python 2 and Python 3 modes). - Publish the types with `py.typed` files. Fixes python-trio#339.
Codecov Report
@@ Coverage Diff @@
## master #341 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 10 10
Lines 1166 1186 +20
Branches 48 47 -1
=========================================
+ Hits 1166 1186 +20
|
Thanks for tackling this! That's a lot of ignores. :) Can you please look into the Python 3 test failure? |
I also enabled https://github.blog/changelog/2021-07-01-github-actions-new-settings-for-maintainers/ so that you won't have to wait for me to see the CI results. |
I didn't think so. Most of the ignores are for
So the problem here is that mypy only runs on Python 3, so installs Python 3 dependencies, specifically pytest 6, but then
Thanks! |
Avoid syntax errors when running `mypy -2`.
I'm happy with mypy only working on Python 3 if that helps! |
For `mypy -2`.
I tried some more fixes but now there are two other problems:
Possible solutions are:
Since I already made the effort I'll go for 1, but we can do 2 as well in a (separate?) major release. |
I like that plan. 👍 |
OK, I moved mypy to a separate lint jobs and left the CI job as is, seems to work. For the coverage I added an exclude of |
Codecov timed out earlier but it's green now. I'll work on dropping Python 2 next when I get a chance. I'll leave it to you to decide whether to do a final py2 release with typing or just go straight to py3. |
Hey @bluetech, it looks like that was the first time we merged one of your PRs! Thanks so much! 🎉 🎂 If you want to keep contributing, we'd love to have you. So, I just sent you an invitation to join the python-trio organization on Github! If you accept, then here's what will happen:
If you want to read more, here's the relevant section in our contributing guide. Alternatively, you're free to decline or ignore the invitation. You'll still be able to contribute as much or as little as you like, and I won't hassle you about joining again. But if you ever change your mind, just let us know and we'll send another invitation. We'd love to have you, but more importantly we want you to do whatever's best for you. If you have any questions, well... I am just a humble Python script, so I probably can't help. But please do post a comment here, or in our chat, or on our forum, whatever's easiest, and someone will help you out! |
Thanks! I don't have a strong opinion on including Python 2 removal in the next release or not. I just might not get to it before you. |
@bluetech I just released 0.9.0 with this pull request |
@pquentin Thanks! @hramezani FYI - urllib3 should be able to remove the type ignores for trustme now if it installs trustme>=0.9.0. |
@bluetech Thanks for letting me know. Here is the PR urllib3/urllib3#2371 |
py.typed
files.Fixes #339.