classification
Title: [argparse] Add required argument to add_subparsers
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: Anthony Sottile, bethard, eric.araujo, memeplex, miss-islington, ned.deily, paul.j3
Priority: normal Keywords:

Created on 2016-03-08 13:56 by memeplex, last changed 2019-10-15 07:30 by ned.deily. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 3027 merged Anthony Sottile, 2017-08-08 18:02
PR 6919 merged ned.deily, 2018-05-16 19:51
PR 7089 merged miss-islington, 2018-05-24 01:56
PR 7609 merged ned.deily, 2018-06-11 02:08
PR 7610 merged miss-islington, 2018-06-11 02:19
PR 16588 closed ajstewart, 2019-10-04 20:58
PR 16608 merged miss-islington, 2019-10-07 02:09
PR 16609 merged miss-islington, 2019-10-07 02:09
Messages (12)
msg261358 - (view) Author: Memeplex (memeplex) Date: 2016-03-08 13:56
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).
msg261535 - (view) Author: paul j3 (paul.j3) * (Python triager) Date: 2016-03-11 00:01
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.
msg300282 - (view) Author: Anthony Sottile (Anthony Sottile) * Date: 2017-08-15 03:23
I've added a patch for this https://github.com/python/cpython/pull/3027

Would love to get a review so it could be included
msg302660 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2017-09-20 21:35
New changeset aaf6fc0982c916cb71d9e0afcd7dda4ba495793b by Éric Araujo (Anthony Sottile) in branch 'master':
bpo-26510: make argparse subparsers required by default (#3027)
https://github.com/python/cpython/commit/aaf6fc0982c916cb71d9e0afcd7dda4ba495793b
msg317500 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-05-24 01:55
New changeset 8ebf5ceb0f5408d1ebc26c19702ac0762ef5ea04 by Ned Deily in branch 'master':
bpo-33109: argparse subparsers are once again not required by default (GH-6919)
https://github.com/python/cpython/commit/8ebf5ceb0f5408d1ebc26c19702ac0762ef5ea04
msg317512 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-05-24 02:22
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)
https://github.com/python/cpython/commit/dd7a255911f364cf521676082a89d4cac307737e
msg319265 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-06-11 02:17
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
msg319267 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-06-11 02:31
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)
https://github.com/python/cpython/commit/a73399d5963d6b1639d935968f4a8baa868c39d3
msg354060 - (view) Author: miss-islington (miss-islington) Date: 2019-10-07 02:08
New changeset 9e71917e0290972f65711f75510078f799cf0b59 by Miss Islington (bot) (Adam J. Stewart) in branch 'master':
 bpo-26510: Add versionchanged for required arg of add_subparsers (GH-16588)
https://github.com/python/cpython/commit/9e71917e0290972f65711f75510078f799cf0b59
msg354061 - (view) Author: miss-islington (miss-islington) Date: 2019-10-07 02:14
New changeset 50b8d579421e621130806e62d6108f5f83d4be7f by Miss Islington (bot) in branch '3.7':
bpo-26510: Add versionchanged for required arg of add_subparsers (GH-16588)
https://github.com/python/cpython/commit/50b8d579421e621130806e62d6108f5f83d4be7f
msg354062 - (view) Author: miss-islington (miss-islington) Date: 2019-10-07 02:15
New changeset f19b4d7474973236e63d3d8260bfb8072acfff9d by Miss Islington (bot) in branch '3.8':
bpo-26510: Add versionchanged for required arg of add_subparsers (GH-16588)
https://github.com/python/cpython/commit/f19b4d7474973236e63d3d8260bfb8072acfff9d
msg354700 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2019-10-15 07:30
New changeset f168c17b075b4103eaf1f619acd3bca3890fbac7 by Ned Deily (Miss Islington (bot)) in branch '3.7':
bpo-26510: Add versionchanged for required arg of add_subparsers (GH-16588)
https://github.com/python/cpython/commit/f168c17b075b4103eaf1f619acd3bca3890fbac7
History
Date User Action Args
2019-10-15 07:30:26ned.deilysetmessages: + msg354700
2019-10-07 02:15:47miss-islingtonsetmessages: + msg354062
2019-10-07 02:14:53miss-islingtonsetmessages: + msg354061
2019-10-07 02:09:26miss-islingtonsetpull_requests: + pull_request16197
2019-10-07 02:09:17miss-islingtonsetpull_requests: + pull_request16196
2019-10-07 02:08:55miss-islingtonsetnosy: + miss-islington
messages: + msg354060
2019-10-04 20:58:02ajstewartsetpull_requests: + pull_request16178
2018-06-11 02:31:01ned.deilysetmessages: + msg319267
2018-06-11 02:19:12miss-islingtonsetpull_requests: + pull_request7235
2018-06-11 02:18:00ned.deilysetmessages: + msg319265
2018-06-11 02:08:16ned.deilysetpull_requests: + pull_request7233
2018-05-24 02:22:48ned.deilysetmessages: + msg317512
2018-05-24 01:56:26miss-islingtonsetpull_requests: + pull_request6724
2018-05-24 01:55:18ned.deilysetnosy: + ned.deily
messages: + msg317500
2018-05-16 19:51:40ned.deilysetpull_requests: + pull_request6588
2017-09-20 21:37:05eric.araujolinkissue9253 dependencies
2017-09-20 21:36:42eric.araujosetstatus: open -> closed
resolution: fixed
stage: commit review -> resolved
2017-09-20 21:35:29eric.araujosetmessages: + msg302660
2017-09-20 17:26:40eric.araujosetassignee: eric.araujo
stage: commit review

nosy: + eric.araujo
versions: + Python 3.7, - Python 3.5
2017-08-15 03:23:46Anthony Sottilesetnosy: + Anthony Sottile
messages: + msg300282
2017-08-08 18:02:02Anthony Sottilesetpull_requests: + pull_request3061
2016-03-11 00:01:03paul.j3setnosy: + paul.j3
messages: + msg261535
2016-03-08 13:58:22memeplexsetnosy: + bethard
2016-03-08 13:56:53memeplexsettitle: Add required argument to add_subparsers -> [argparse] Add required argument to add_subparsers
2016-03-08 13:56:01memeplexcreate