Type Annotations
I was thinking of adding type annotations to some of the APIs to assist IDEs in parsing them and providing useful completion.
Since it currently does not exist in the code, I preferred asking before coding. Due to supporting both Python 2 and 3, I think the way to do it is to use syntax present here.
There are some drawbacks:
- Adding a new dependency - the
typingpackage - Annotation comments are not the prettiest thing
But if we only the do the required minimum, we get more clarity when using the library, and can also use mypy as a verification step for new code.
@jdavid what is your opinion?
+1 if integration with Travis is added
Typing hints for the API are sorely missed and would be great to have. Please, add them as separate .pyi file(s) with Python 3 typing hints.
We don't support Python 2 any more, so this should be easier. The minimum required version is Python 3.5
Anyway this should be contributed (PR), or funded (sponsored).
For reference, about .pyi files see https://mypy.readthedocs.io/en/stable/stubs.html
If Python 2 is no longer supported - any reason to use stubs and not just add annotations to the code?
Any status update on this? Would a PR that annotate the code be accepted?
Yes, but instead of 1 big PR, I'd prefer a number of smaller PRs
(Today the minimum supported version of Python is 3.7)
Since this issue was opened type hints have been added to the C extension. For further improvements please open a PR.