-
Notifications
You must be signed in to change notification settings - Fork 608
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
Push to hub/commit with branches #282
Conversation
LGTM, thanks for improving the API! |
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.
Overall seems good, but the tests are failing at the moment.
I was also wondering if we should add some documentation in https://github.com/huggingface/huggingface_hub/tree/main/src/huggingface_hub#managing-a-repository-with-repository, but this could be a follow up as well
LGTM, thank you for adding this! |
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.
nice implementation, and I like the thoroughness of the tests
Completes the
revision
-based API by adding branches management topush_to_hub
and thecommit
context manager.Examples of usage:
Using
revision
fromRepository.__init__
Using
git_checkout
fromRepository
Note that the
push_to_hub
method interacts in a complex manner:Using the
Repository.commit
context managerTherefore, I would instead recommend using the
Repository.commit
context manager as I find it has a better API, as can be seen below. I think the two could eventually be merged into a singlewith Repository.push_to_hub
. See details of the API with usage below:A caveat with
git_checkout
is that it may result in a fatal error if some files are added/modified as the changes would be overridden by the checkout.