Closed kddubey closed 6 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 94.09%. Comparing base (
821c08c
) to head (ddd177d
).
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@martinjm97 Does Tap
ever result in positional arguments in the command line?
Given this, maybe it's too early to allow tapify
to support positional command line arguments (via the all_args_named=False
setting in this PR). But up to you and @swansonk14 to decide :-)
There are some complications in supporting positional command line arguments. Namely, handling a Tap
object where many arguments are collection types. And for tapify
: handling a class/function parameter which is positional-only but not required (i.e., it has a default value), or a parameter which is not positional-only but is required.
I lean towards keeping the current behavior for now: no positional command line arguments / all options. Maybe you can consider it in the future if many people want it.
Regardless, I'll make the fix to allow tapify
to work when class_or_function
has positional-only parameters.
Thank you! It looks like you solved the issue! --JK
You're welcome :-)
Though to be clear, this PR only addresses one part of #100: this PR makes tapify
work (instead of error out) when the input has positional-only parameters. It doesn't address the main part of the issue, which is having tapify
result in command line positional args.
Lmk if you'd like that feature/enhancement as well. I jotted down some of its complications in this comment.
I see. I think addressing the challenges you mentioned in https://github.com/swansonk14/typed-argument-parser/pull/133#issuecomment-2055672988 would be quite challenging. As a result, I'd advocate for stopping tapify
from erroring out when given a function with positional arguments and general support for positional arguments in tapify
as separate issues.
Kyle and I discussed some of the challenges and didn't have great ideas for what to do for positional arguments that are collections. It's not clear where one list ends and the next one starts! In general, it's not clear to me that we'd like Tap
classes to represent positional arguments natively (rather than specifying it explicitly in configure
).
There'd probably be additional complications with optional positional list arguments (argparse reference).
I lean towards keeping the current behavior for now: no positional command line arguments / all options. Maybe you can consider it in the future if many people want it.
I agree!
I think you've resolved the original issue to the level where tapify
is more generally usable. I think further improvement may not be worth it yet.
tapify
currently doesn't work when the signature contains positional-only arguments.For data models, AFAIK, there isn't such a thing as a positional-only argument. So the change only needs to be applied to (non-data-model) functions or classes.