[issue46057] argparse: embedded groups may prevent options from being in help output

2022-01-10 Thread paul j3
paul j3 added the comment: "I tried to create a group hierarchy in a way that I can pass the responsibility of argument validation to the argument parser." I looked at your example in: https://bugs.python.org/issue46058 The many levels of nesting groups was confusing, but now I realize tha

[issue46057] argparse: embedded groups may prevent options from being in help output

2022-01-02 Thread László Attila Tóth
László Attila Tóth added the comment: I don't think I'm adventurous as I try to use its public API. If something is public in the pythonic terms (no underscore before it), but undocumented, that can obviously mean two things: either the documentation is outdated or the API published something

[issue46057] argparse: embedded groups may prevent options from being in help output

2022-01-01 Thread paul j3
paul j3 added the comment: Don't add an argument_group to another argument_group. While input allows this nesting, the formatting is not designed to handle it. Nor does the documentation illustrate such nesting. Nesting a mutually_exclusive_group in an argument_group works because the exc

[issue46057] argparse: embedded groups may prevent options from being in help output

2021-12-16 Thread Irit Katriel
Irit Katriel added the comment: Nesting argument groups and mutually exclusive groups is now deprecated (see issue22047). Thank you for the bug report. -- stage: -> resolved status: open -> closed ___ Python tracker

[issue46057] argparse: embedded groups may prevent options from being in help output

2021-12-13 Thread Irit Katriel
Irit Katriel added the comment: You’re right that the api should not be there. See issue22047. I don’t think it should be patches to call super/return self. That would just be confusing. -- resolution: -> duplicate superseder: -> argparse improperly prints mutually exclusive options

[issue46057] argparse: embedded groups may prevent options from being in help output

2021-12-13 Thread László Attila Tóth
László Attila Tóth added the comment: my idea regarding _ArgumentGroup,add_argument_group is in the attached file. This doesn't solve the complete help output issue, but addresses the incorrectly called _ArgumentGroup.add_argument_group - a warn() call and return self. As a result the help ou

[issue46057] argparse: embedded groups may prevent options from being in help output

2021-12-12 Thread László Attila Tóth
László Attila Tóth added the comment: According to the documentation only the ArgumentParser has add_argument_group option, which is not true, the code allows me to add a subgroup to any group. The complete example is in issue 4608: https://bugs.python.org/issue46058 If add_argument_group sho

[issue46057] argparse: embedded groups may prevent options from being in help output

2021-12-12 Thread Irit Katriel
Irit Katriel added the comment: According to the docs it should be >>> xgrp = parser.add_argument_group() rather than >>> xgrp = grp.add_argument_group() This seems to work: >>> parser = argparse.ArgumentParser() >>> grp = parser.add_argument_group('Database settings') >>> grp.add_argum

[issue46057] argparse: embedded groups may prevent options from being in help output

2021-12-12 Thread László Attila Tóth
László Attila Tóth added the comment: The fix is something like this for _ArgumentGroup, but as the container may not be an _ArgumentGroup, it breaks the tests. --- Lib/argparse.py +++ Lib/argparse.py @@ -1635,9 +1640,13 @@ def __init__(self, container, title=None, description=None, **kwargs)

[issue46057] argparse: embedded groups may prevent options from being in help output

2021-12-12 Thread László Attila Tóth
László Attila Tóth added the comment: And the leading part is the same for both the mutually exclusive and the argument groups: usage: test1.py [-h] [--db-config DB_CONFIG] [--db-password DB_PASSWORD] optional arguments: -h, --helpshow this help message and exit Database settin

[issue46057] argparse: embedded groups may prevent options from being in help output

2021-12-12 Thread László Attila Tóth
László Attila Tóth added the comment: Sorry, these are two bugs in fact. The current one, the help with minmal code: import argparse parser = argparse.ArgumentParser() grp = parser.add_argument_group('Database settings') grp.add_argument('--db-config') xgrp = grp.add_argument_group() xgrp.add_

[issue46057] argparse: embedded groups may prevent options from being in help output

2021-12-12 Thread Irit Katriel
Irit Katriel added the comment: Please complete the bug report: How did you run this function, what output did you get and what output did you expect? -- nosy: +iritkatriel ___ Python tracker __

[issue46057] argparse: embedded groups may prevent options from being in help output

2021-12-12 Thread László Attila Tóth
New submission from László Attila Tóth : I tried to use the following code where the --db-password is not shown in the --help output (Originally I wanted to use mutually exclusive groups but that feature also works strangely, so I changed them to regular groups). def register_db_args(parser: a