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:
def clone(self, path, progress=None, **kwargs) -> 'Repo':
# ...
(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.)
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.
In case there are other syntaxes that are compatible with all python versions GitPython has to support, please feel free to provide an exhaustive PR to declare each and every type.
Since this library supports only Python 3.4+ now, @Byron would you be will 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 to 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.
Most helpful comment
Since this library supports only Python 3.4+ now, @Byron would you be will 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 to 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.