Skip to content

fix(cli): stop treating subcommand -v as version flag#1082

Open
aadi-joshi wants to merge 1 commit into
Kaggle:mainfrom
aadi-joshi:fix/1064-quota-duration-auth
Open

fix(cli): stop treating subcommand -v as version flag#1082
aadi-joshi wants to merge 1 commit into
Kaggle:mainfrom
aadi-joshi:fix/1064-quota-duration-auth

Conversation

@aadi-joshi

@aadi-joshi aadi-joshi commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix _is_help_or_version_command so subcommand -v (the CSV output alias on commands like quota) no longer skips authentication. Top-level kaggle -v / kaggle --version still skip auth as before.

The duration parsing crash from #1064 is handled separately in Kaggle/kaggle-sdk-python#58 (needs kapigen sync and a new kagglesdk release).

Root cause

authenticate() runs before argparse and joins sys.argv[1:] into a string. "quota -v".endswith("-v") matched the global version check even though -v here is the CSV flag, causing unauthenticated API calls and 401s.

Tests

Added tests/unit/test_help_version_auth.py covering top-level version/help, subcommand CSV -v, and subcommand help.

Test plan

  • pytest tests/unit/test_help_version_auth.py
  • Maintainer: please run /gcbrun for Cloud Build (fork PR)

Related to #1064

@aadi-joshi

Copy link
Copy Markdown
Contributor Author

could a maintainer please run the cloud build checks when convenient? happy to address any feedback.

@stevemessick

Copy link
Copy Markdown
Contributor

@aadi-joshi Thanks for the PR! I like the change to -v handling. Unfortunately, we're not making changes to kagglesdk in this repo. Actually, making changes to it is difficult, since it is entirely generated code. However, I think we can manage it with a little extra work. If you want to submit a change to https://github.com/Kaggle/kaggle-sdk-python/blob/main/kagglesdk/kaggle_object.py then also mark the PR as needing manual sync'ing with the kapigen base, I'll see that and make sure the change gets merged into the generator's code base. Once that's release in a new kagglesdk we can make the changes to actually fix the problem.

aadi-joshi added a commit to aadi-joshi/kaggle-cli that referenced this pull request Jun 30, 2026
@aadi-joshi aadi-joshi changed the title fix(cli): repair kaggle quota duration parsing and csv -v auth fix(cli): stop treating subcommand -v as version flag Jun 30, 2026
@aadi-joshi

Copy link
Copy Markdown
Contributor Author

Thanks for the guidance! I removed the kagglesdk compat shim from this PR. It now only contains the -v auth fix.

Opened the duration parsing fix in Kaggle/kaggle-sdk-python#58, marked for manual sync with the kapigen base. Happy to address any feedback on either PR.

@stevemessick

Copy link
Copy Markdown
Contributor

/gcbrun

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