feat(cli): make errors and help friendlier for new users - #1171
Conversation
Three small, output-compatible usability fixes aimed at people running the CLI for the first time. None of them change the output of a successful command. Errors: API failures printed the raw requests error, so a mistyped reference produced a bare "404 Client Error for url: ..." with no indication of what to do next. Add a hint under the original message for the statuses a user can act on (403 rules, 404 reference/search, 429 backoff) and attribute 5xx to Kaggle rather than to the user's command. The message itself is preserved. Unexpected errors: only HTTPError/IOError/ValueError were caught, so an internal KeyError or AttributeError surfaced as a Python traceback that reads like the user did something wrong. Catch the rest, print a one-line summary plus a pointer to the issue tracker, and add --debug to get the traceback back for bug reports. Help: `kaggle --help` listed commands but showed no examples. Add an epilog with the handful of commands a new user actually starts with (log in, list, download, submit).
|
Hello, @latiefdole I am an external reviewer I went through the PR and tested a few of the error cases. I noticed two things that I think might be worth fixing: 1. Some normal user errors are being shown as a CLI bug For example, when authentication fails, the new message says:
But authentication failure isn't necessarily a CLI bug. There are also some dataset errors where the API already gives a proper user-facing message, but they end up going through this same catch-all and get labelled as a CLI bug. I feel this could be a bit confusing for users, and might also lead to unnecessary bug reports. Maybe these cases could be handled separately, or the message could be worded a little less strongly. 2. Small issue with the The error message tells the user to re-run with kaggle config view --debuggives an It actually needs to be: kaggle --debug config viewSince a new user will probably just add Apart from these, the changes looked good to me and the tests were passing. Just thought these two cases were worth pointing out before merging. |
|
@sridipbasu Thanks for the review! I've updated the error message to be less strong about it being a CLI bug, and fixed the --debug suggestion to use the correct \kaggle --debug [command]\ format. |
| help="Disable out-of-date API version warning", | ||
| ) | ||
| parser.add_argument( | ||
| "--debug", |
There was a problem hiding this comment.
We might want better log/debug support. See line 967 of kaggle_api_extended.py.
|
/gcbrun |
Description
Three small usability fixes aimed at people running the CLI for the first time. None of them change the output of a successful command, so existing scripts are unaffected.
1. Actionable API error messages
API failures printed the raw
requestserror, so a mistyped reference produced a bare404 Client Error for url: ...with no indication of what to do next.A hint is now printed under the original message for the statuses a user can act on:
kaggle search <query>The original error text is preserved in every case, and statuses without a hint are left exactly as they were.
2. Internal errors no longer surface as tracebacks
Only
HTTPError/IOError/ValueErrorwere caught inmain(), so an internalKeyErrororAttributeErrorreached the user as a Python traceback that reads like they did something wrong.These are now caught and reported as a one-line summary plus a pointer to the issue tracker. A new
--debugflag restores the full traceback for bug reports.3. Examples in
kaggle --helpkaggle --helplisted the available commands but showed no examples. Added an epilog with the handful of commands a new user actually starts with: log in, list, download, submit.Testing
1265 passed, 0 failedblack --check .cleanmypyclean on the changed filesNew tests in
tests/unit/test_cli_errors.pycover the hint text per status, the preserved message for statuses without a hint, the--debugbehaviour (including that it is not forwarded to command functions), and thatValueErroris still reported without the bug notice.