fix(cli): honor --unzip for cached dataset downloads#1086
Merged
Conversation
Contributor
Author
Contributor
|
/gcbrun |
stevemessick
approved these changes
Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Fixes a bug where
kaggle datasets download --unzipdid not extract a dataset if the ZIP archive was already cached locally.Root Cause
The extraction logic in
dataset_download_files()was executed only when a new download occurred (downloaded == True).If the local ZIP was already up to date,
download_needed()returnedFalse, causing the extraction block to be skipped entirely, even when the user explicitly requested--unzip.Fix
Decouple the extraction step from the download step by allowing the unzip logic to execute whenever
--unzipis requested, regardless of whether the ZIP was freshly downloaded or already cached.This preserves the existing download and caching behavior while ensuring cached ZIP files can still be extracted.
Reproduction
Before this change:
Download a dataset:
Run:
Observed
The CLI reports:
The existing ZIP archive is not extracted.
Expected
The cached ZIP should be extracted without requiring a re-download.
Testing
Added regression tests covering:
--unzipextracts the existing archive without downloading again.--unzipcontinues to work as before.Also manually verified the following scenarios:
--unzip--unzipNotes
This is a minimal, localized change that preserves the existing caching logic while ensuring the
--unzipflag behaves consistently for cached dataset downloads.