Document string types used by GitPython #312
Copy link
Copy link
Closed
Labels
Milestone
Description
I noticed that starting with GitPython 0.3.4 hexadecimal SHAs are no longer strs but unicodes. Since the expected type is not documented anywhere (assuming that changelog is not a documentation), users have to guess. A wrong guess may lead to errors in programs. E.g. GitPython 0.3.4 + Python 2.7:
>>> commit.hexsha + '\xc5\x99'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 0: ordinal not in range(128)...this used to work before GitPython 0.3.4. This change also complicated writing programs that needs to be compatible with both GitPython < 0.3.4 and GitPython >= 0.3.4.
Reactions are currently unavailable
Activity
Byron commentedon Jul 14, 2015
With the introduction of Python3 support, I believe all strings which are text became
unicodein python 2, andstrin python 3. Everything else isstrin python 2 andbytesin python 3.With the answer provided in #311 it should be possible to adjust code to deal with both versions of GitPython.
Documenting the types might help those who read documentation, all others will most certainly make things work by trial and error. As python is dynamically typed and string/text handling is inherently difficult in this ecosystem, I feel like I am fighting windmills at best.
Considering the issue was first discovered by you, I'd be glad if you could add the documentation that would help people in a similar situation, and would be glad to merge any PR that make improvements in that matter.
Byron commentedon Jul 14, 2015
Great to hear. From my point of view, I don't think there will ever be a version 2.0 of GitPython, and as Pypi locked me out by simply not maintaining the oauth-based authentication mode, I don't think there will be an additional patch release either.
Thus it's very safe to assume that v1.0.1 on Pypi is the definitive and last release, whereas the master branch on GitHub may contain some fixes that interested parties can install using
pipfor example.Byron commentedon Jul 14, 2015
I will keep it maintained, but there will be no new features unless these are provided by interested parties via PRs.
It's now as stable as it gets and works everywhere, which can be an advantage.
Byron commentedon Feb 11, 2016
A new release was just made to pypi 😁 (see #298) !
40 remaining items
stsewd commentedon May 5, 2019
Probably It's time to drop python 2 support? I think there are some places that aren't compatible with python 2 right now anyway (test didn't catch them).
If python 2 support is dropped, then this issue can be closed or it still needs documentation? (Or maybe type annotations?)
Byron commentedon Jul 20, 2019
Python 2 support was just dropped, which hopefully facilitates maintenance and additional bugfixes.
Drop python 2.7 support and help with encodings