Skip to content

submit_to_kaggle: readable result + graceful auth handling#2

Merged
gereonelvers merged 1 commit into
mainfrom
refactor
Jul 2, 2026
Merged

submit_to_kaggle: readable result + graceful auth handling#2
gereonelvers merged 1 commit into
mainfrom
refactor

Conversation

@gereonelvers

Copy link
Copy Markdown
Collaborator

The kaggle CLI exits 0 and prints "Successfully submitted ..." buried under a version-upgrade warning, so the raw CompletedProcess repr didn't make success obvious; a missing token produced an ugly traceback.

  • Return a KaggleSubmissionResult (truthy on success, clean repr, Kaggle's response on .detail, raw process on .process/.stdout/.stderr) and print a one-line ✅/❌ status (verbose=True).
  • Detect success from the "Successfully submitted" marker, not just the exit code (the CLI can exit 0 on some errors), and drop the version warning noise.
  • Fail fast with actionable guidance when no credentials are configured; give a clean auth message when the CLI rejects them.
  • Check installation with importlib.util.find_spec instead of import kaggle, which authenticates eagerly and would raise just from the availability check.
  • tests/test_competition_submission.py: offline coverage (subprocess mocked).
  • examples/submit_pnpl2026.ipynb: display the result object; use the real pnpl-competition-2026 slug.

The kaggle CLI exits 0 and prints "Successfully submitted ..." buried under a
version-upgrade warning, so the raw CompletedProcess repr didn't make success
obvious; a missing token produced an ugly traceback.

- Return a KaggleSubmissionResult (truthy on success, clean __repr__, Kaggle's
  response on .detail, raw process on .process/.stdout/.stderr) and print a
  one-line ✅/❌ status (verbose=True).
- Detect success from the "Successfully submitted" marker, not just the exit
  code (the CLI can exit 0 on some errors), and drop the version warning noise.
- Fail fast with actionable guidance when no credentials are configured; give a
  clean auth message when the CLI rejects them.
- Check installation with importlib.util.find_spec instead of `import kaggle`,
  which authenticates eagerly and would raise just from the availability check.
- tests/test_competition_submission.py: offline coverage (subprocess mocked).
- examples/submit_pnpl2026.ipynb: display the result object; use the real
  pnpl-competition-2026 slug.
@gereonelvers gereonelvers merged commit 9d96530 into main Jul 2, 2026
1 check 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.

1 participant