[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2021-05-21 Thread Lucas Cimon
Lucas Cimon added the comment: Sorry, the fix was by Mathias Ettinger: elif isinstance(argument, _SubParsersAction): return '{%s}' % ','.join(map(str, argument.choices)) I submitted a PR with this patch and a corresponding unit test: https://github.com/python/cpython/pull/26278

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2021-05-21 Thread Lucas Cimon
Lucas Cimon added the comment: Reporting a duplicate / superseder with the following bug: parser = argparse.ArgumentParser() subparsers = parser.add_subparsers(required=True) subparsers.add_parser('foo') parser.parse_args() Raising: TypeError: sequence item 0: expected str instance,

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-06-10 Thread Ned Deily
Ned Deily added the comment: New changeset a73399d5963d6b1639d935968f4a8baa868c39d3 by Ned Deily (Miss Islington (bot)) in branch '3.7': bpo-33109: Remove now-obsolete What's New entry for bpo-26510. (GH-7609) (GH-7610)

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-06-10 Thread miss-islington
Change by miss-islington : -- pull_requests: +7234 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-06-10 Thread Ned Deily
Ned Deily added the comment: New changeset ef057bfb06cae0718e6d708061649d2e3983e2ef by Ned Deily in branch 'master': bpo-33109: Remove now-obsolete What's New entry for bpo-26510. (GH-7609) https://github.com/python/cpython/commit/ef057bfb06cae0718e6d708061649d2e3983e2ef --

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-06-10 Thread Ned Deily
Change by Ned Deily : -- pull_requests: +7232 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-23 Thread Ned Deily
Ned Deily added the comment: > Is there then no pathway for actually fixing the bug? aka how can I get > `required=True` to be the default. There may very well be but, unfortunately, dealing with this newly-identified 3.x compatibility issue takes precedence for 3.7.0. In

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-23 Thread Ned Deily
Ned Deily added the comment: New changeset dd7a255911f364cf521676082a89d4cac307737e by Ned Deily (Miss Islington (bot)) in branch '3.7': bpo-33109: argparse subparsers are once again not required by default (GH-6919) (GH-7089)

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-23 Thread miss-islington
Change by miss-islington : -- pull_requests: +6723 stage: commit review -> patch review ___ Python tracker ___

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-23 Thread Ned Deily
Ned Deily added the comment: New changeset 8ebf5ceb0f5408d1ebc26c19702ac0762ef5ea04 by Ned Deily in branch 'master': bpo-33109: argparse subparsers are once again not required by default (GH-6919)

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Please ignore the last paragraph. It was my mistake, all add_subparsers() parameters are keyword-only, and _SubParsersAction is a privale class. -- ___ Python tracker

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-22 Thread Anthony Sottile
Anthony Sottile added the comment: The bug is orthogonal, you can trigger it without the `required=` keyword argument via the (currently suggested) monkeypatch workaround which restores the pre-3.3 behaviour: import argparse parser = argparse.ArgumentParser() subp =

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Wouldn't be better to first fix this bug, and only after that add the 'required' parameter? Adding it introduced yet one bug: when pass arguments as positional, the 'help' argument will be swallowed. You can add new parameters

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-22 Thread Anthony Sottile
Anthony Sottile added the comment: That's a separate issue (also a bug introduced by the bad 3.3 patch): https://bugs.python.org/issue29298 I have an open PR to fix it as well but it has not seen review action: https://github.com/python/cpython/pull/3680 --

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I tried to use add_subparsers() with required=True and have found it not usable. import argparse parser = argparse.ArgumentParser(prog='PROG') subparsers = parser.add_subparsers(required=True) parser_a =

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-22 Thread Anthony Sottile
Anthony Sottile added the comment: Is there then no pathway for actually fixing the bug? aka how can I get `required=True` to be the default. -- ___ Python tracker

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-22 Thread Ned Deily
Ned Deily added the comment: > Considering the huge popularity of these SO questions, I don't think this > should be reverted [...] As I understand it (and, again, I make no claim to be an argparse expert), there does not seem to be one absolutely correct answer here; there

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-16 Thread Anthony Sottile
Anthony Sottile added the comment: Considering the huge popularity of these SO questions, I don't think this should be reverted: - https://stackoverflow.com/questions/23349349/argparse-with-required-subparser -

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-16 Thread Ned Deily
Ned Deily added the comment: Several of the core developers here at the PyCon US sprints in Cleveland have discussed this issue. It seems like there legitimate arguments for either behavior. But, while none of us are argparse experts, we all were persuaded by Wolfgang's

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-16 Thread Ned Deily
Change by Ned Deily : -- keywords: +patch pull_requests: +6587 stage: -> patch review ___ Python tracker ___

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-16 Thread Wolfgang Maier
Wolfgang Maier added the comment: Try to think of it this way: By choosing a default of True, every new project with subparsers that aims for Python <3.7 compatibility will have to take some measures (either overwrite the default or special-case

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-15 Thread Anthony Sottile
Anthony Sottile added the comment: According to the other bugs, the change in 3.3 was an inadvertent regression. The fact that it didn't get fixed for so long is mostly due to the unmaintained state of argparse in the stdlib. The change in behaviour here is the _fix_ of

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-15 Thread Gregory P. Smith
Gregory P. Smith added the comment: If the behavior was consistent from 3.3 through 3.6, that is the behavior we should keep going forward in 3.7+ without a deprecation period. (and this does not seem worth deprecating, lets just keep the behavior the same as it was in

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-15 Thread Éric Araujo
Change by Éric Araujo : -- Removed message: https://bugs.python.org/msg316703 ___ Python tracker ___

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-15 Thread Éric Araujo
Change by Éric Araujo : -- Removed message: https://bugs.python.org/msg316702 ___ Python tracker ___

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-15 Thread Éric Araujo
Éric Araujo added the comment: I'm sorry I don't have the time to study this and make a judgment call. Bringing this to the release manager's attention. -- ___ Python tracker

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-05-07 Thread Brian Skinn
Brian Skinn added the comment: I second Wolfgang's recommendation to change the default back to `False`. I started developing CLI apps in Python ~4yrs ago; I dabbled briefly in 2.7, then switched firmly to Python 3. When I started, I was aimed at supporting 3.3 to 3.5;

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-03-20 Thread Wolfgang Maier
Wolfgang Maier added the comment: _wants_ is a bit a strong word, but, at least, you can do a bit a nicer job than the default error, like printing a nicely formatted list of subcommands as you would get it with the main parsers help. In fact, in my

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-03-20 Thread Anthony Sottile
Anthony Sottile added the comment: Yeah, I picked the default value `True` because I couldn't actually find a user of subparsers that _wanted_ optional subparsers. ¯\_(ツ)_/¯ -- ___ Python tracker

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-03-20 Thread Wolfgang Maier
Wolfgang Maier added the comment: On 03/20/2018 04:38 PM, Anthony Sottile wrote: > > Anthony Sottile added the comment: > > The intention of the change in issue 26510 was to pick the least surprising > behaviour for the default

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-03-20 Thread Anthony Sottile
Anthony Sottile added the comment: Grabbed the wrong SO link, I believe this is the one I meant to link to: https://stackoverflow.com/a/18283730/812183 -- ___ Python tracker

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-03-20 Thread Anthony Sottile
Anthony Sottile added the comment: The intention of the change in issue 26510 was to pick the least surprising behaviour for the default value of subparsers -- the compatiblity with the behaviour before the regression was introduced in 3.3 was a nice side-effect. As with

[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-03-20 Thread Wolfgang Maier
New submission from Wolfgang Maier : I find the True default for 'required' quite cumbersome introduced as a result of issue 26510. With existing parsers it can unnecessarily break compatibility between Python3.x versions only to make porting a bit