-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
How to handle typechecker specific bugs #8403
Comments
I like this approach: it's practical and correct enough. Here are a couple examples of how we have done this in the past:
|
How does customize solution work for non stdlib stubs? Main stub I'm thinking of is google-protobuf stub. Current version of that stub/latest release does not work well with pyright and leads to many google packages being treated as Any because of Personal impact is low as I pin to only release where |
Cases where a correct typechecker is significantly impacted by a workaround for another typechecker are the most clear cut to me — we should obviously favour the correct typechecker. (Within a reasonable timeline) an incorrect typechecker will just have to deal with it, e.g. like mypy reverting LiteralString changes in its vendored copy. Regarding protobuf specifically, it appears several users were complaining about being broken by a "micro" release in types-protobuf. That's usually unavoidable due to typeshed's versioning scheme, but as it happens protobuf now has a v4 out: #8360 We could pragmatically take advantage of this timing to do the right thing and drop the But back to the original question. For stubs where we've received specific user complaints and typecheck quality isn't really compromised for other typecheckers, I'm still in favour of merging. This includes stuff like And yes, a huge +1 to working with typecheckers to fix things. Of course, with pyright we have the magical Beetlejuice thing going on where all bugs get instantly fixed, but I think things have been getting better recently with mypy as well. |
In the past, we've worked around typechecker bugs and missing features in typeshed. But as the amount of typecheckers grows and type stubs are used for more that just type checking, I don't think we can work around any bug or missing feature of every typechecker in typeshed, especially if this means regressing our stubs. Not only is this more maintainer work and it gets hard to remember which typechecker has which bug, it also means that users of bug-free typecheckers and other software will still be affected by those bugs.
I think that we should still accommodate very impactful bugs and missing major features (per our "tracking" bugs) for the "big four" mypy, pytype, pyright, and pyre. We also need to work around some bugs due to our tests. But apart from that, we should work with typecheck authors (and there is some overlap here, of course) to come up with a solution.
Regarding stdlib stubs, I believe one option is that typecheckers ship with a customized version of typeshed for major problems. Apart from that, it's always possible for users to
# type: ignore
a problem with a specific typechecker.The text was updated successfully, but these errors were encountered: