Skip to content

Does not work with Python 3.14, breaking changes to Argparse #434

Description

@mmrwoods

All CLI commands are broken when using Python 3.14 due to changes in Argparse, adding nested mutually exclusive groups is now an error:

$ aws-encryption-cli --version --verbosity 4
Encountered unexpected error: increase verbosity to see details.
ValueError("mutually exclusive groups cannot be nested")

Exception traceback:

  File "/Users/xxxxxx/.local/bin/aws-encryption-cli", line 7, in <module>
    sys.exit(cli())
             ~~~^^
  File "/Users/xxxxxx/.local/pipx/venvs/aws-encryption-sdk-cli/lib/python3.14/site-packages/aws_encryption_sdk_cli/__init__.py", line 270, in cli
    args = parse_args(raw_args)
  File "/Users/xxxxxx/.local/pipx/venvs/aws-encryption-sdk-cli/lib/python3.14/site-packages/aws_encryption_sdk_cli/internal/arg_parsing.py", line 636, in parse_args
    parser = _build_parser()
  File "/Users/xxxxxx/.local/pipx/venvs/aws-encryption-sdk-cli/lib/python3.14/site-packages/aws_encryption_sdk_cli/internal/arg_parsing.py", line 186, in _build_parser
    operating_action = version_or_action.add_mutually_exclusive_group()
  File "/opt/homebrew/Cellar/python@3.14/3.14.0_1/Frameworks/Python.framework/Versions/3.14/lib/python3.14/argparse.py", line 1816, in add_mutually_exclusive_group
    raise ValueError('mutually exclusive groups cannot be nested')
ValueError: mutually exclusive groups cannot be nested

In Python 3.14 the relevant code in argparse.py is:

class _MutuallyExclusiveGroup(_ArgumentGroup):
    ...
    def add_mutually_exclusive_group(self, **kwargs):
        raise ValueError('mutually exclusive groups cannot be nested')

At a glance, I'm not sure how to fix this, it looks to require a bit of an overhaul of argument parsing. Nesting mutually exclusive groups has been deprecated since Python 3.11 though.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions