Skip to content
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

Document string types used by GitPython #312

Closed
ghost opened this issue Jul 10, 2015 · 8 comments
Closed

Document string types used by GitPython #312

ghost opened this issue Jul 10, 2015 · 8 comments

Comments

@ghost
Copy link

ghost commented Jul 10, 2015

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.

@Byron Byron added this to the v1.0.2 - Fixes milestone Jul 14, 2015
@Byron
Copy link
Member

Byron commented Jul 14, 2015

With the introduction of Python3 support, I believe all strings which are text became unicode in python 2, and str in python 3. Everything else is str in python 2 and bytes in 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.

@ghost
Copy link
Author

ghost commented Jul 14, 2015

Well, if you guarantee that even undocumented features (how you define a feature then?) won't change until GitPython 2.0 then there is really no reason to document it. Otherwise, the documentation provides users the definition of the features that are guaranteed to be compatible until next major release of GitPython.
I have no problem with writing a patch once I will have some free time.

@Byron
Copy link
Member

Byron commented 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 pip for example.

@ghost
Copy link
Author

ghost commented Jul 14, 2015

:-( Are you saying that GitPython is dead? :-( I find it much better than pygit2!

@Byron
Copy link
Member

Byron commented 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
Copy link
Member

Byron commented Feb 11, 2016

A new release was just made to pypi 😁 (see #298) !

@Byron Byron modified the milestones: v1.0.2 - Fixes, v1.0.3 - Fixes Feb 13, 2016
@Byron Byron modified the milestones: v2.0.0 - Features and Fixes, v2.0.1 - Bugfixes Apr 24, 2016
@Byron Byron removed this from the v2.0.8 - Bugfixes milestone Aug 3, 2016
@Byron Byron modified the milestones: v2.0.9 - Bugfixes, v2.0.10 - Bugfixes, v2.1.0 - proper windows support, v2.1.0 - better windows support, v2.1.1 - Bugfixes Oct 16, 2016
@Byron Byron modified the milestones: v2.1.1 - Bugfixes, v2.1.2 - Bugfixes Dec 8, 2016
@Byron Byron modified the milestones: v2.1.2 - Bugfixes, v2.1.3 - Bugfixes Mar 8, 2017
@stsewd
Copy link
Contributor

stsewd commented 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?)

@ghost ghost closed this as completed in dac619e Jul 20, 2019
@Byron
Copy link
Member

Byron commented Jul 20, 2019

Python 2 support was just dropped, which hopefully facilitates maintenance and additional bugfixes.

Screenshot 2019-07-20 at 17 34 49

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants