-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add return_unknown_args
to tyro.cli
#35
Conversation
Is there a reason you were casting the return from |
That was fast, thanks! One thing: could you check the logic in On using overloads for |
Codecov ReportBase: 99.19% // Head: 99.20% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #35 +/- ##
=======================================
Coverage 99.19% 99.20%
=======================================
Files 21 21
Lines 1624 1642 +18
=======================================
+ Hits 1611 1629 +18
Misses 13 13
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Could there be some compromise on this fix args feature? This will be a problem. What I'm thinking is the following: Instead of fixing the arguments like this could we instead have a kwarg where option strings would either have:
It's not really feasible to add option strings for every possible combination of dash and underscore for each part of the prefix so a compromise that's all or none or both might be fine. I already have this implemented by passing around a tuple of strings for the field paths instead of converting the field path to a string at each step of the recursion. This just gives more flexibility w.r.t. option strings when lowering the argument definition. If you're okay with this change I can either make a different PR or add it to this PR. |
Thanks for looking into that! On adding a kwarg: I'd prefer to be conservative about adding things to the public API; my feeling is this hyphen vs underscore preference isn't something that enough people will care enough to justify adding. It won't be pretty, but for the sake of this PR maybe we can just track a Either way the tuple change sounds like it could be useful if we want to add support for aliases, which I know people have expressed interest in. -- Aside: probably we need a better name than "fix" for the hyphen / underscore conversion here, I keep getting it confused with the concept of "fixed args" as in |
Good call on the kwarg, I'd generally agree with this. I implemented a simple mapping as you suggested. In the case where two options are ambiguous, e.g., |
Can I get you to approve the CI workflows again? If they all pass we should be in good shape. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great; just a few last things, thanks for being so responsive!!
Rebased on main with #37. |
Thanks @JesseFarebro! Appreciate your help on this. |
As per #34.