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

Annotate and remove support auto commit #290

Merged

Conversation

francesco086
Copy link
Contributor

Contributes to #25

@codecov-commenter
Copy link

codecov-commenter commented Oct 18, 2022

Codecov Report

Base: 86.10% // Head: 86.52% // Increases project coverage by +0.41% 🎉

Coverage data is based on head (666e7ed) compared to base (900610e).
Patch coverage: 98.61% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #290      +/-   ##
==========================================
+ Coverage   86.10%   86.52%   +0.41%     
==========================================
  Files          15       16       +1     
  Lines        1929     1996      +67     
==========================================
+ Hits         1661     1727      +66     
- Misses        268      269       +1     
Impacted Files Coverage Δ
gto/commit_message_generator.py 85.71% <85.71%> (ø)
gto/api.py 93.38% <100.00%> (+0.14%) ⬆️
gto/cli.py 72.93% <100.00%> (+0.08%) ⬆️
gto/git_utils.py 99.16% <100.00%> (+0.72%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@francesco086
Copy link
Contributor Author

francesco086 commented Oct 18, 2022

There are two things missing yet:

  1. (that I would like to discuss) what should be the commit message? I was thinking to use the command used, something like gto.api.annotate(repo=., name="new-type", auto_commit=True)
  2. raise a gto exception if trying to commit the changes on a file different from HEAD (as suggested in Make show and other commands work with remote repos #25 (comment))

Copy link
Contributor

@aguschin aguschin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@@ -472,6 +479,7 @@ def annotate(
),
label: List[str] = Option(None, "--label", help="Labels to add to artifact"),
description: str = Option("", "-d", "--description", help="Artifact description"),
auto_commit: bool = option_auto_commit,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about using just commit instead of auto_commit? For CLI and API. And push instead of auto_push. Looks like it's sufficient and shorter.

Copy link
Contributor Author

@francesco086 francesco086 Oct 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good idea!

However, may I suggest for this PR to stick to auto_commit, for consistency with the pre-existing auto_push?
After this PR is merged, I will create a separate PR to rename all of them :)

I don't like mixed up PRs, as you may have noticed :P

def remove(
repo: str = option_repo,
name: str = arg_name,
auto_commit: bool = option_auto_commit,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what should be the commit message? I was thinking to use the command used, something like gto.api.annotate(repo=., name="new-type", auto_commit=True)

To your first question. Sounds ok to me. It can also be something like "Annotated artifact 'new-type' with path='path/to/it', type='type-of-it', ...".

As a small side quest we could also add --message arg (like there is for gto register), to allow writing custom commit messages.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, will do that then.

Regarding the --message option though I am not 100% convinced: it adds complexity to a CLI which is already not that straightforward, and I wonder if it will ever be needed. If it is really needed in special circumstances, one can still commit manually with a git command.
I'd suggest to leave it out for now, and think of it only if some user request it. Do you agree?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, totally agree. Let's keep it out of the scope for now.

@francesco086 francesco086 force-pushed the annotate_and_remove_support_auto_commit branch from 7a35696 to 66c5728 Compare October 19, 2022 13:52
@francesco086
Copy link
Contributor Author

Hi @aguschin , I think it's ready, I covered the two points left.

Please have a look, in couple of points I had the impression that perhaps the code was getting difficult to read.
In fact I even added a docstring for gto.git-utils.commit_produced_changes_on_auto_commit, something I try to avoid as a general rule.
Looking forward to hear your feedback!

Oh, and a small thing: could you please assign this PR to me? I am not clear if this is important for the Hacktoberfest, but just in case... :P

Co-authored-by: Alexander Guschin <1aguschin@gmail.com>
@aguschin aguschin added hacktoberfest-accepted Merged PRs with external contributions good first issue Good for newcomers labels Oct 20, 2022
@aguschin
Copy link
Contributor

Awesome! Merging this. Thanks @francesco086!

@aguschin aguschin merged commit 86666cb into iterative:main Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers hacktoberfest-accepted Merged PRs with external contributions
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants