Skip to content

Why does --verifytypes want an explicit type annotation on some variables? #2272

Answered by erictraut
Pyprohly asked this question in Q&A
Discussion options

You must be logged in to vote

If your library is marked "py.typed", all public symbols (those that represent the public interface contract for your library) should be annotated. If a symbol is not annotated, its type needs to be inferred by a type checker. Type inference rules are not specified in the typing standards, and they vary by type checker. Inference can also be quite slow depending on the complexity of the expression. For these reasons, it's important for all public symbols to have type annotations.

For more details, please refer to this documentation.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Pyprohly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants