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

Delete folder with commit endpoint #1163

Merged
merged 6 commits into from
Nov 8, 2022

Conversation

Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Nov 7, 2022

Resolves #1151 following server-side implementation (https://github.com/huggingface/moon-landing/pull/3826 (internal link)).

CommitOperationDelete has now a different behavior depending on if the path is a file or a folder. By default, it will try to guess it automatically by looking at a trainling "/" on the path. Otherwise, it is possible to explicitly set is_folder=True. In case of a "file not found error" (most likely due to a folder passed as a file), a custom message is added to the EntryNotFoundError.

Also implements a high-level delete_folder, same as existing delete_file.

Added tests and updated the documentation.

@Wauplin Wauplin marked this pull request as ready for review November 7, 2022 16:17
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Nov 7, 2022

The documentation is not available anymore as the PR was closed or merged.

@Wauplin Wauplin changed the title 1151 Delete folder with commit endpoint Delete folder with commit endpoint Nov 7, 2022
@codecov
Copy link

codecov bot commented Nov 7, 2022

Codecov Report

Base: 84.57% // Head: 84.62% // Increases project coverage by +0.05% 🎉

Coverage data is based on head (3f37b7a) compared to base (9ccdf02).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1163      +/-   ##
==========================================
+ Coverage   84.57%   84.62%   +0.05%     
==========================================
  Files          42       42              
  Lines        4182     4196      +14     
==========================================
+ Hits         3537     3551      +14     
  Misses        645      645              
Impacted Files Coverage Δ
src/huggingface_hub/_commit_api.py 93.18% <100.00%> (+0.32%) ⬆️
src/huggingface_hub/hf_api.py 87.69% <100.00%> (+0.12%) ⬆️

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.

Copy link
Member

@LysandreJik LysandreJik 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 to me

@Wauplin Wauplin merged commit 74bb506 into main Nov 8, 2022
@Wauplin Wauplin deleted the 1151-delete-folder-from-commit-endpoint branch November 8, 2022 08:02
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.

Support delete folder on the commit endpoint
4 participants