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

MAINT Removes GitPython dependency #1966

Merged
merged 4 commits into from
Nov 17, 2023

Conversation

thomasjpfan
Copy link
Member

@thomasjpfan thomasjpfan commented Nov 16, 2023

This PR removes GitPython dependency and adds more unit tests to check the updated function.

Type

  • Bug Fix
  • Feature
  • Plugin
  • Maintenance

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

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

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>
Copy link

codecov bot commented Nov 16, 2023

Codecov Report

Attention: 15 lines in your changes are missing coverage. Please review.

Comparison is base (9681866) 62.67% compared to head (75e6093) 62.55%.
Report is 4 commits behind head on master.

Files Patch % Lines
flytekit/remote/remote.py 21.05% 15 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

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")
Copy link
Member Author

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.

eapolinario
eapolinario previously approved these changes Nov 16, 2023
Copy link
Collaborator

@eapolinario eapolinario left a 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:
Copy link
Collaborator

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?

@eapolinario
Copy link
Collaborator

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>
@eapolinario eapolinario merged commit 0b17806 into flyteorg:master Nov 17, 2023
72 of 74 checks passed
ringohoffman pushed a commit to ringohoffman/flytekit that referenced this pull request Nov 24, 2023
* 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>
mark-thm pushed a commit to mark-thm/flytekit that referenced this pull request Dec 8, 2023
* 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>
RRap0so pushed a commit to RRap0so/flytekit that referenced this pull request Dec 15, 2023
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants