-
-
Notifications
You must be signed in to change notification settings - Fork 937
Use Python type annotations #591
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 horribly breaks all Python 3.5< so I think this is a bad idea. Maybe would be better to use mypy annotations, or perhaps even docstring type annotations? I know that PyCharm picks those up. For example I'm talking something like this: def clone(self, path, progress=None, **kwargs):
"""
:param str path:
:rtype: Repo
"""
# Define clone down here |
I believe you're wrong. Python annotation syntax goes back to 3.0, so it's available on all Python 3 versions. |
GitPython must support python 2.7, which makes this kind of syntax a breaking change. |
Since this library supports only Python 3.4+ now, @Byron would you be willing to re-open the issue? I come at this from a speed and correctness of development angle. It's hard to get interactions with a git repository correct, and difficult to test things like CI/CD or build system they are usually involved in. So having the ability for a type checker to find a lot of failure cases for you would be a big help. |
I use an IDE to work with GitPython, and if you'd used type annotations on your methods, it'll be able to give me autocompletion when working with GitPython. For example:
(The quotes are needed here because the class isn't defined yet when the method is being defined, in other cases you may use the class directly.)
The text was updated successfully, but these errors were encountered: