-
Notifications
You must be signed in to change notification settings - Fork 297
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
MAINT Removes GitPython dependency #1966
Conversation
Signed-off-by: Thomas J. Fan <thomasjpfan@gmail.com>
Signed-off-by: Thomas J. Fan <thomasjpfan@gmail.com>
Signed-off-by: Thomas J. Fan <thomasjpfan@gmail.com>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1966 +/- ##
==========================================
- Coverage 62.67% 62.55% -0.12%
==========================================
Files 313 313
Lines 23193 23247 +54
Branches 3514 3523 +9
==========================================
+ Hits 14537 14543 +6
- Misses 8234 8283 +49
+ Partials 422 421 -1 ☔ View full report in Codecov by Sentry. |
from git import Repo | ||
git_config = source_path / ".git" / "config" | ||
if not git_config.exists(): | ||
raise ValueError(f"{source_path} is not a git repo") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added tests to check these code paths. It's strange that codecov is not picking it up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great start. I fear that we're going to have to support more exoteric url formats (e.g. explicit ssh urls instead of the nice git@
).
elif url.startswith("https://"): | ||
prefix_len = len("https://") | ||
return url[prefix_len:] | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we throw in support for http
also?
just to expand on my previous comment, here are the tests for url parsing in git itself: https://github.com/git/git/blob/77bd3ea9f54f1584147b594abc04c26ca516d987/t/t0110-urlmatch-normalization.sh. Parsing urls is itself a can of worms. Having basic support for ssh + https/http covers more than the 90% of the cases. We can always expand later if necessary. |
Signed-off-by: Thomas J. Fan <thomasjpfan@gmail.com>
* MAINT Removes GitPython dependency Signed-off-by: Thomas J. Fan <thomasjpfan@gmail.com> * MAINT Remove GitPython from requirements Signed-off-by: Thomas J. Fan <thomasjpfan@gmail.com> * STY Run linter Signed-off-by: Thomas J. Fan <thomasjpfan@gmail.com> * ENH Adds support for http Signed-off-by: Thomas J. Fan <thomasjpfan@gmail.com> --------- Signed-off-by: Thomas J. Fan <thomasjpfan@gmail.com>
* MAINT Removes GitPython dependency Signed-off-by: Thomas J. Fan <thomasjpfan@gmail.com> * MAINT Remove GitPython from requirements Signed-off-by: Thomas J. Fan <thomasjpfan@gmail.com> * STY Run linter Signed-off-by: Thomas J. Fan <thomasjpfan@gmail.com> * ENH Adds support for http Signed-off-by: Thomas J. Fan <thomasjpfan@gmail.com> --------- Signed-off-by: Thomas J. Fan <thomasjpfan@gmail.com>
* MAINT Removes GitPython dependency Signed-off-by: Thomas J. Fan <thomasjpfan@gmail.com> * MAINT Remove GitPython from requirements Signed-off-by: Thomas J. Fan <thomasjpfan@gmail.com> * STY Run linter Signed-off-by: Thomas J. Fan <thomasjpfan@gmail.com> * ENH Adds support for http Signed-off-by: Thomas J. Fan <thomasjpfan@gmail.com> --------- Signed-off-by: Thomas J. Fan <thomasjpfan@gmail.com> Signed-off-by: Rafael Raposo <rafaelraposo@spotify.com>
This PR removes GitPython dependency and adds more unit tests to check the updated function.
Type
Are all requirements met?
Complete description
GitPython
was only used to read the remote url. This configuration is located in.git/config
, which we can parse directly.Tracking Issue
Towards flyteorg/flyte#4418