Add type hints in python codebase
See original GitHub issue🚀 Feature Proposal
Type hints in Python are specified by PEP 484 and are of a great help when developing, thus proposing to add them to Python codebase. Would this be an option if I volunteer to (gradually) add them, assuming the types are validated in the CI by a checker tool like mypy
so the types are validated on each pull request?
I have noticed rudimentary type hints already exist here and there, for example
indicates that WebDriver().name
is a string. This offers better code completions in IDEs.
I have searched for similar issues, but it seems like this wasn’t discussed yet (at least not on Github). As far as I can see, the only issue mentioning type hints is #1917; however, type stubs were removed since then.
Another alternative would be maintaining a third-party stub package (as specified in PEP 561). However, I don’t want to start a third-party package if you are willing to keep the type hints along with the code (which is a much better option), or planning to add them already.
Motivation
Better code completion in IDEs is surely something the end users will appreciate. Another advantage is that type hints often intercept bugs, thus making the code more robust.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:15 (12 by maintainers)
Top GitHub Comments
I am all for this! Feel free to start adding PRs and then tagging me for review.
landed in e8e9389f6b793a51e9cf5989eab7b55982ccbf6d