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

feat: add --sort arg to delete-cache to sort by size #2815

Merged
merged 13 commits into from
Mar 14, 2025

Conversation

AlpinDale
Copy link
Contributor

@AlpinDale AlpinDale commented Jan 30, 2025

This PR adds the --sort flag to the delete-cache command. This should allow users to sort the repos by size, including all revisions. The default mode is in descending order, but this behaviour can be changed by passing the ascending argument to the flag.

The flag takes 4 arguments: size, alphabetical, lastUpdated, and lastUsed. The size is currently in descending order.

@Wauplin
Copy link
Contributor

Wauplin commented Jan 31, 2025

x-linking #1065

Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

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

Hi @AlpinDale thank you for this very clean PR! I appreciate the code quality and having tests already implemented 🤗 I've left a high-level comment about the CLI interface. I'd prefer something like this:

huggingface-cli delete-cache --sort=size

Let me know what you think !

@AlpinDale
Copy link
Contributor Author

Thanks for the review, @Wauplin. I've added the requested changes, including the alphabetical, lastUpdated, lastUsed sorting options. Please take a look again.

Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

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

Thank you @AlpinDale ! Didn't expect that much but it makes the PR really great! :) I've left some minor comments to address.

@AlpinDale
Copy link
Contributor Author

Thanks for the re-review, I'll address your comments tonight!

@hanouticelina hanouticelina requested a review from Wauplin March 14, 2025 14:53
Copy link
Contributor

@hanouticelina hanouticelina left a comment

Choose a reason for hiding this comment

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

Thank you @AlpinDale for your contribution, this is a nice feature to have!
I addressed @Wauplin's comments so the PR should be in good shape to be merged 🤗

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

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

Thanks for getting this to the finish line! 🔥

@AlpinDale
Copy link
Contributor Author

I totally forgot about this PR, sorry! Thank you for finishing it up. 😅

@hanouticelina
Copy link
Contributor

Merging!

@hanouticelina hanouticelina merged commit 4ad0d9a into huggingface:main Mar 14, 2025
16 checks passed
@AlpinDale AlpinDale deleted the feat/sorting branch March 14, 2025 17:19
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.

4 participants