Skip to content

Changes in Python 3.14.3 break cmd2 #1570

Closed

Description

@tleonhardt

Error:

______________________________ ERROR collecting tests/test_argparse_completer.py _______________________________
tests/test_argparse_completer.py:42: in <module>
    class ArgparseCompleterTester(cmd2.Cmd):
tests/test_argparse_completer.py:303: in ArgparseCompleterTester
    arg_tokens_subparser = arg_tokens_parser.add_subparsers(dest='subcommand')
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cmd2/argparse_custom.py:1509: in add_subparsers
    return super().add_subparsers(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../.local/share/uv/python/cpython-3.14.3-macos-aarch64-none/lib/python3.14/argparse.py:1968: in add_subparsers
    formatter.add_usage(None, positionals, groups, '')
.venv/lib/python3.14/site-packages/rich_argparse/_argparse.py:232: in add_usage
    usage_text = _strip_codes(self._format_usage(usage, actions, groups, prefix=prefix))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cmd2/argparse_custom.py:1172: in _format_usage
    format_actions = self._format_actions_usage
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: 'Cmd2HelpFormatter' object has no attribute '_format_actions_usage'
=========================================== short test summary info ============================================
ERROR tests/test_argparse_completer.py - AttributeError: 'Cmd2HelpFormatter' object has no attribute '_format_actions_usage'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=============================================== 1 error in 0.18s ===============================================

Activity

  1. github-actions commented on Feb 4, 2026

    @github-actions
    Contributor

    🤖 Hi @tleonhardt, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

  2. tleonhardt commented on Feb 4, 2026

    @tleonhardt
    MemberAuthor

    Whatever the fix is we'll have to make on both the main and 3.x branches.

  3. tleonhardt commented on Feb 5, 2026

    @tleonhardt
    MemberAuthor

    I'm thinking we actually need to create an issue for rich_argparse to make sure that module properly supports Python 3.14.3 in general and for the RichHelpFormatter in particular.

    Another option might be to remove some of our custom formatting.

  4. tleonhardt commented on Feb 5, 2026

    @tleonhardt
    MemberAuthor

    PR #1571 addresses this issue for the 3.x branch. Once that merges in, we'll need to cherry-pick changes to a branch intended to marge into main.

  5. changed the title [-]argparse changes in Python 3.14.3 break cmd2[/-] [+]Changes in Python 3.14.3 break cmd2[/+] on Feb 5, 2026
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

    bugmajorpythonPull requests that update Python code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions