You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Intended way to define a mutually exclusive group inside a normal argument group with with_annotated #1687
Is there an intended way to define a mutually exclusive argument group inside a normal argument group when using the with_annotated decorator?
I think this is supported by builtin argparse, while nested argument groups and normal argument groups inside mutually exclusive argument groups are not supported at least since Python 3.11. See argparse
My current thinking is to keep supporting it and align it with argparse. However, I also think we should ban it, since this is never the intended use case for argparse. What is your thought @tleonhardt ?
I'd say as long as we have a way of supporting a mutually exclusive group I think that is fine. I don't see the need to support a mutually exclusive group inside a normal argument group. But perhaps I am missing something?
To my understanding, argparse is intended to support any number of arguments and/or mutually exclusive groups within an argument group. This makes sense to me: normal argument groups label arguments, while mutually exclusive groups change the behavior of the parser.
Activity
KelvinChung2000 commentedon Jun 10, 2026
My current thinking is to keep supporting it and align it with argparse. However, I also think we should ban it, since this is never the intended use case for
argparse. What is your thought @tleonhardt ?tleonhardt commentedon Jun 10, 2026
I'd say as long as we have a way of supporting a mutually exclusive group I think that is fine. I don't see the need to support a mutually exclusive group inside a normal argument group. But perhaps I am missing something?
neoniobium commentedon Jun 10, 2026
I think this is the intended way to use a mutually exclusive group. This example is taken directly from the
argparsedocumentation.KelvinChung2000 commentedon Jun 10, 2026
For your specific example, you can do it in the following way
KelvinChung2000 commentedon Jun 10, 2026
I just noticed the
titleanddescriptionare not propagating to the help correctly. I will have this fixed.neoniobium commentedon Jun 11, 2026
To my understanding,
argparseis intended to support any number of arguments and/or mutually exclusive groups within an argument group. This makes sense to me: normal argument groups label arguments, while mutually exclusive groups change the behavior of the parser.