-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better error messages #63
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #63 +/- ##
==========================================
+ Coverage 98.96% 99.12% +0.16%
==========================================
Files 23 23
Lines 1829 1953 +124
==========================================
+ Hits 1810 1936 +126
+ Misses 19 17 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
1ab9fe2
to
645075d
Compare
7605184
to
29f6a05
Compare
Makes sense! I added the help messages, so as an example if you write On the ordering, do you feel strongly about this? To me it's slightly more intuitive to have the most relevant (error) message on the bottom, since it reduces the likelihood that the user needs to scroll in order to see it. Kind of like a stack trace; it's also closer to the original In any case I'm going to let this PR stew for a few days before merging + releasing; I'd like to spend more time thinking about edge cases + test cases. |
Does it work with your original flag, |
Btw really good work! I am loving the changes.
I do like the fact that the error shows up in the bottom, but at the same time most of the messages do not feel useful. For example, I have the following with the latest PR. It's not until the end that I see the most useful message. Maybe as an alternative you can say "for usage info please run python xx.py --help` and just show the parse error message?
|
Nice! FYI absl does this:
Maybe the |
Interesting! To clarify, are you proposing both:
|
Just made a PR with these suggestions, thanks!
For now I just (did the equivalent of) setting N=0, for things like this (especially while I still feel like we're iterating) I'd prefer to err on the side of being prescriptive. It's hard to remove configurable parameters once they've been added. 🙂
I appreciate your help with making the CLI experience better! |
This PR takes an initial step in the direction of #62. I expect there's more work to be done; I'd also like to add tests before merging. @vwxyzjn if you have any thoughts or suggestions I'd also be interested!
(1)
We previously relied on
argparse
for most of the error messages reported bytyro
. We continue to do this, but the formatting now better emphasize the actual error.Before:
After:
(2)
When an invalid value is passed in, we show the argument's documentation + helptext.
Before:
After:
(3)
When an argument that doesn't exist is passed in, we now highlight similar arguments.
Before:
After:
(4)
Finally, when subcommands are used, similar arguments are coupled with the subcommands that they can be found in: