Skip to content

feat(record): delete dataset from the Hub, not just local disk - #94

Merged
nicolas-rabault merged 3 commits into
huggingface:mainfrom
ravediamond:delete-dataset-from-hub
Oct 8, 2026
Merged

nicolas-rabault merged 3 commits into
huggingface:mainfrom
ravediamond:delete-dataset-from-hub

Conversation

@ravediamond

Copy link
Copy Markdown
Contributor

Problem

Delete Dataset in LeLab only wipes the local cache directory. If the dataset had already been pushed to the Hub, it's still there afterwards — you have to go delete the repo by hand on huggingface.co. There's no huggingface_hub.delete_repo() call anywhere in the codebase.

Fix

  • DatasetInfoRequest gets an optional delete_from_hub flag.
  • handle_delete_dataset calls huggingface_hub.delete_repo(repo_id, repo_type="dataset") when that flag is set, before removing the local copy. A missing Hub repo is treated as a no-op (nothing to delete); any other failure aborts before touching local disk.
  • On the Upload page, the delete dialog now shows a "also delete from the Hub" checkbox when the dataset is Hub-hosted. Checking it requires typing the repo id to confirm, since this is irreversible — same pattern GitHub itself uses for repo deletion.

Testing

  • Added unit tests in tests/test_record.py covering: hub delete called when requested, skipped by default, and local copy preserved if the Hub call fails.
  • pytest (204 passed), ruff check, ruff format --check clean.
  • tsc --noEmit, eslint, npm run build clean (one pre-existing react-hooks/exhaustive-deps warning on this file, unrelated to this change).
  • Manually tested against a dataset pushed to the Hub: unchecked box only removes local disk copy (Hub repo untouched), checked box + typed confirmation removes both.

frontend/dist not touched — CI rebuilds it on merge.

Opening as draft since I'd like a look at the confirm-by-typing UX before marking ready — happy to simplify to a plain checkbox if that's overkill for this.

@ravediamond ravediamond changed the title feat: delete dataset from the Hub, not just local disk feat(record): delete dataset from the Hub, not just local disk Jul 31, 2026
@ravediamond
ravediamond marked this pull request as ready for review August 4, 2026 15:32
@nicolas-rabault
nicolas-rabault force-pushed the delete-dataset-from-hub branch 2 times, most recently from 065cc13 to aa16688 Compare October 8, 2026 11:22
ravediamond and others added 3 commits October 8, 2026 22:31
…t picker

Extract the delete dialog so the dataset page reuses it, show View on the Hub instead of Upload for a dataset already pushed, and use the home page DatasetPicker on the dataset page.
@nicolas-rabault
nicolas-rabault force-pushed the delete-dataset-from-hub branch from ed014ad to ecdb647 Compare October 8, 2026 20:31
@nicolas-rabault
nicolas-rabault self-requested a review October 8, 2026 20:31

@nicolas-rabault nicolas-rabault left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you @ravediamond ,
I cleaned up a few things on the way.

@nicolas-rabault
nicolas-rabault merged commit 71bd284 into huggingface:main Oct 8, 2026
2 checks passed
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.

2 participants