Repository navigation
[argparse] Add required argument to add_subparsers #70697
Copy link
Copy link
Closed
Labels
3.7 (EOL)end of lifeend of lifestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Description
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = 'https://github.com/merwok'
closed_at = <Date 2017-09-20.21:36:42.299>
created_at = <Date 2016-03-08.13:56:01.475>
labels = ['3.7', 'type-feature', 'library']
title = '[argparse] Add required argument to add_subparsers'
updated_at = <Date 2019-10-15.07:30:26.268>
user = 'https://bugs.python.org/memeplex'bugs.python.org fields:
activity = <Date 2019-10-15.07:30:26.268>
actor = 'ned.deily'
assignee = 'eric.araujo'
closed = True
closed_date = <Date 2017-09-20.21:36:42.299>
closer = 'eric.araujo'
components = ['Library (Lib)']
creation = <Date 2016-03-08.13:56:01.475>
creator = 'memeplex'
dependencies = []
files = []
hgrepos = []
issue_num = 26510
keywords = []
message_count = 12.0
messages = ['261358', '261535', '300282', '302660', '317500', '317512', '319265', '319267', '354060', '354061', '354062', '354700']
nosy_count = 7.0
nosy_names = ['bethard', 'ned.deily', 'eric.araujo', 'memeplex', 'paul.j3', 'Anthony Sottile', 'miss-islington']
pr_nums = ['3027', '6919', '7089', '7609', '7610', '16588', '16608', '16609']
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue26510'
versions = ['Python 3.7']Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.7 (EOL)end of lifeend of lifestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Activity
memeplex commentedon Mar 8, 2016
It's useful in combination with dest. Currently you have to set required as an attribute. This is not only inconsistent but not even documented as a valid usage (in general, it's not clear from the docs whether attribute setting -vs argument passing- is a valid usage).
[-]Add required argument to add_subparsers[/-][+][argparse] Add required argument to add_subparsers[/+]paulj3 commentedon Mar 11, 2016
This has been raised before. I think
http://bugs.python.org/issue9253
is the correct issue.
It used to be that 'subparsers' were required. But there was a change in how 'required' arguments were tested, and 'subparsers' fell through the cracks. Now subparsers are optional (at least the parser doesn't raise an error). The temporary fix is to set the 'required' attribute after creation.
I proposed that the default be 'required=True', and that we be allowed to set the parameter. But that patch, like many others, has languished.
asottile commentedon Aug 15, 2017
I've added a patch for this #3027
Would love to get a review so it could be included
merwok commentedon Sep 20, 2017
New changeset aaf6fc0 by Éric Araujo (Anthony Sottile) in branch 'master':
bpo-26510: make argparse subparsers required by default (bpo-3027)
aaf6fc0
ned-deily commentedon May 24, 2018
New changeset 8ebf5ce by Ned Deily in branch 'master':
bpo-33109: argparse subparsers are once again not required by default (GH-6919)
8ebf5ce
ned-deily commentedon May 24, 2018
New changeset dd7a255 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)
dd7a255
ned-deily commentedon Jun 11, 2018
New changeset ef057bf by Ned Deily in branch 'master':
bpo-33109: Remove now-obsolete What's New entry for bpo-26510. (GH-7609)
ef057bf
ned-deily commentedon Jun 11, 2018
New changeset a73399d 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)
a73399d
miss-islington commentedon Oct 7, 2019
New changeset 9e71917 by Miss Islington (bot) (Adam J. Stewart) in branch 'master':
bpo-26510: Add versionchanged for required arg of add_subparsers (GH-16588)
9e71917
miss-islington commentedon Oct 7, 2019
New changeset 50b8d57 by Miss Islington (bot) in branch '3.7':
bpo-26510: Add versionchanged for required arg of add_subparsers (GH-16588)
50b8d57
miss-islington commentedon Oct 7, 2019
New changeset f19b4d7 by Miss Islington (bot) in branch '3.8':
bpo-26510: Add versionchanged for required arg of add_subparsers (GH-16588)
f19b4d7
ned-deily commentedon Oct 15, 2019
New changeset f168c17 by Ned Deily (Miss Islington (bot)) in branch '3.7':
bpo-26510: Add versionchanged for required arg of add_subparsers (GH-16588)
f168c17