-
Notifications
You must be signed in to change notification settings - Fork 613
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
Add delete_patterns
option to upload_folder
#1370
Conversation
The documentation is not available anymore as the PR was closed or merged. |
delete_patterns
option to upload_folder
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1370 +/- ##
==========================================
+ Coverage 84.49% 84.54% +0.04%
==========================================
Files 48 48
Lines 4812 4814 +2
==========================================
+ Hits 4066 4070 +4
+ Misses 746 744 -2
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. |
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.
Looks great to me!
>>> from huggingface_hub import HfApi | ||
>>> api = HfApi() | ||
>>> api.upload_folder( |
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.
(nit) Depending on how you test this (or if you use doctests at all, which I don't think is the case), you may need to still redeclare the previous if you want to isolate each statement. Still clean this way so no need to change.
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.
We are not using doctests for now. I tend to prefer not redefining similar lines just to be more "straight to the point". At least when it's obvious what is api
like here.
No strong opinion though. Might use doctests at some point but I have not seeing a big need for now.
Co-authored-by: Lysandre Debut <[email protected]>
Thanks for the careful review 👍 |
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. |
Step 1 for #1352: add a
delete_patterns
parameter toupload_folder
. It makes sense in a lot of cases to delete remote files before uploading new ones.The workflow is:
delete_patterns
is provided, list remote files (can be optimized once https://github.com/huggingface/moon-landing/pull/5580 is deployed)Included in PR:
_prepare_upload_folder_additions
(fixed a bug) + implement_prepare_upload_folder_deletions
upload_folder
to check the CommitOperation list is correctStep 2 for #1352 will be adding the possibility for automatic "chained commits" in
create_commit
using a PR if the list of operations is too big (see description there).