SIGN IN SIGN UP

fix(cli): honor --untar for cached model version downloads (#1165)

## Summary

When downloading a model instance version with `--untar`, the archive
was not extracted if it was already cached locally.

This happened because the untar logic only ran when the file was
downloaded during the current command. If the cached file was already up
to date, the download was skipped and the untar step was skipped along
with it.

This change makes `--untar` work for both newly downloaded and already
cached archives.

## Fix

Updated the extraction condition to also run when `--untar` is
requested.

This keeps the existing download and caching behavior unchanged while
allowing a cached archive to be extracted without downloading it again.

After this change:

* Cached downloads without `--untar` are still skipped normally.
* Fresh downloads with `--untar` continue to work as before.
* Cached downloads with `--untar` are now extracted correctly.

## Tests

Added a regression test to verify that a cached archive is extracted
when `untar=True` without downloading the file again.

Ran:

`pytest tests/unit/test_model_download.py -v`

`pytest tests/unit/test_dataset_download.py
tests/unit/test_cli_models.py -q`

`pytest tests/unit -q`

`black --check --diff <modified files>`

`mypy --install-types --non-interactive src/kaggle tests`

All checks pass, including the full unit test suite with 1238 tests
passing.
S
Sridip Basu committed
da08140e356bbb8b78741d2cd7ed2d3c1ff33671
Parent: 816cf99
Committed by GitHub <noreply@github.com> on 8/6/2026, 8:29:04 PM