-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
We need a policy for undocumented attributes #1902
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
Comments
This issue is why I think we need more than just a type checker. Warnings against deprecations, use of dangerous APIs, invalid combinations of arguments, etc., is something that mypy could do, even though this functionality is not related to typing. My pet example is warning against instantiating coroutines without With all the above said, typeshed documents types and mypy checks types. We are generally working pretty hard to not raise false positives because they undermine trust in the tool. "Hey, mypy is saying there's no function like that but I can see it in So, my position is this:
If we decide that mypy should indeed allow for additional warnings that aren't type errors, then extending the .pyi syntax with a standard way to mark functions/classes that should not be used, would be nice. It could be as simple as |
I talked briefly with @JukkaL about this and he agrees with you. I propose that while we ponder how mypy can be improved to warn about the use of undocumented attributes, we add a standardized comment |
So can we close this now? Actually we should do something similar for deprecated APIs perhaps? |
|
In the past week alone I've seen several issues where well-meaning contributors wanted to add undocumented attributes to typeshed:
I think we should have a standard policy on these. I know in the past we've sometimes added such attributes, with the argument that there's existing working code that uses them. But AFAIK there's no other tool that is capable of flagging the use of undocumented attributes, so I'm kind of leaning towards seeing this as a valuable service mypy (or rather, typeshed) provides, rather than a deficiency in the stubs. For example, if we were to add these attributes to the stubs, IDEs like PyCharm would start suggesting auto-completion for undocumented attributes, which I definitely think is a bad idea. If there's something that's commonly used, it should just be included in the docs first -- the process for that is clear (file an issue on bugs.python.org).
The text was updated successfully, but these errors were encountered: