Skip to content

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

Draft
ravediamond wants to merge 1 commit into
huggingface:mainfrom
ravediamond:delete-dataset-from-hub
Draft

feat(record): delete dataset from the Hub, not just local disk#94
ravediamond wants to merge 1 commit into
huggingface:mainfrom
ravediamond:delete-dataset-from-hub

Conversation

@ravediamond

Copy link
Copy Markdown

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
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.

1 participant