Skip to content

[argparse] Add required argument to add_subparsers #70697

Description

@memeplex
mannequin
BPO 26510
Nosy @ned-deily, @merwok, @asottile, @miss-islington
PRs
  • bpo-26510: Allow argparse add_subparsers to take required kwarg. #3027
  • bpo-33109: argparse subparsers are once again not required by default #6919
  • [3.7] bpo-33109: argparse subparsers are once again not required by default (GH-6919) #7089
  • bpo-33109: Remove now-obsolete What's New entry for bpo-26510. #7609
  • [3.7] bpo-33109: Remove now-obsolete What's New entry for bpo-26510. (GH-7609) #7610
  • bpo-26510: Add versionchanged for required arg of add_subparsers #16588
  • [3.8] bpo-26510: Add versionchanged for required arg of add_subparsers (GH-16588) #16608
  • [3.7] bpo-26510: Add versionchanged for required arg of add_subparsers (GH-16588) #16609
  • 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']

    Activity

    1. memeplex commented on Mar 8, 2016

      memeplexmannequin
      MannequinAuthor

      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).

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-featureA feature request or enhancement
      on Mar 8, 2016
    3. changed the title [-]Add required argument to add_subparsers[/-] [+][argparse] Add required argument to add_subparsers[/+] on Mar 8, 2016
    4. paulj3 commented on Mar 11, 2016

      paulj3mannequin
      Mannequin

      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.

    5. asottile commented on Aug 15, 2017

      asottilemannequin
      Mannequin

      I've added a patch for this #3027

      Would love to get a review so it could be included

    6. self-assigned this
      on Sep 20, 2017
    7. merwok commented on Sep 20, 2017

      @merwok
      Member

      New changeset aaf6fc0 by Éric Araujo (Anthony Sottile) in branch 'master':
      bpo-26510: make argparse subparsers required by default (bpo-3027)
      aaf6fc0

    8. ned-deily commented on May 24, 2018

      @ned-deily
      Member

      New changeset 8ebf5ce by Ned Deily in branch 'master':
      bpo-33109: argparse subparsers are once again not required by default (GH-6919)
      8ebf5ce

    9. ned-deily commented on May 24, 2018

      @ned-deily
      Member

      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

    10. ned-deily commented on Jun 11, 2018

      @ned-deily
      Member

      New changeset ef057bf by Ned Deily in branch 'master':
      bpo-33109: Remove now-obsolete What's New entry for bpo-26510. (GH-7609)
      ef057bf

    11. ned-deily commented on Jun 11, 2018

      @ned-deily
      Member

      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

    12. miss-islington commented on Oct 7, 2019

      @miss-islington
      Contributor

      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

    13. miss-islington commented on Oct 7, 2019

      @miss-islington
      Contributor

      New changeset 50b8d57 by Miss Islington (bot) in branch '3.7':
      bpo-26510: Add versionchanged for required arg of add_subparsers (GH-16588)
      50b8d57

    14. miss-islington commented on Oct 7, 2019

      @miss-islington
      Contributor

      New changeset f19b4d7 by Miss Islington (bot) in branch '3.8':
      bpo-26510: Add versionchanged for required arg of add_subparsers (GH-16588)
      f19b4d7

    15. ned-deily commented on Oct 15, 2019

      @ned-deily
      Member

      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

    16. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    3.7 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions