-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 to urllib3 #867
Comments
I personally have no objection, although it'd probably be best for us to double-check the annotation when complete. |
I'll write some and let you know when I open the PR, thanks! |
I also have no objection, though part of me wonders: if the type checker is now good enough, should we just have stub files here and make them part of our CI? |
Function annotation are only available in python 3, you may want to keep compatibility with python 2 then. |
@tharvik That's why I'm suggesting stub files: stub files can be distributed with the library without breaking Python 2. |
Ho, misread, yup, that would be better this way, I'll do you a pull request soon then (and by design of typeshed, also copy it there). |
My understanding of typeshed is that actually they'd rather we distributed it than they did. They shouldn't really need a copy if we ship one. |
Correct, I'm reading PEP 484 again. From it, we can either have stubs in |
From what I just saw, it would be easier to split it by python version, because of much conditional imports and behaviour. |
I'm happy to split by Python version, at least in the first instance. |
mypy-lang supports using the magical comment annotations, why not use that instead? |
@Lukasa mypy-lang is good, yes. But the |
(No objections here) |
@sigmavirus24 we can also do that, but for now, mypy is still quite bad at handling conditional imports, so if we want it to be useful now, it would be better to have splitted stubs. |
At the current moment mypy is mature and should be considered stable. There are alternative type checkers available such as pyright and pyre. I believe overall Python typing ecosystem is developed enough. Of course there are still some questions to be answered.
As far as I can see there was an attempt (#880) to add type hints. I think that we should take one more attempt to include it here. I can try to do it for my own or help someone who wants to coordinate the process. What do you think? @tharvik? |
I'm 100% on adding type-hints, just needs someone to execute the work. :) |
I'm also 100% in favor of adding type annotations now. I'd suggest that we do so progressively on our external interfaces ( |
(Still no objections here) |
There are no annotations for it, see urllib3/urllib3#867 This should make the mypy check happy.
Should this be closed in favor of #1897? |
Yeah, closing this one :) |
Would that be okay if type annotations of urllib3 were added to the typeshed repo?
It would be nice to have your explicit consent, as stated in PEP 484.
The text was updated successfully, but these errors were encountered: