Skip to content

4.0.0-b3 (2026-04-18)

Pre-release
Pre-release

Choose a tag to compare

@kmvanbrunt kmvanbrunt released this 19 Apr 01:21
· 10 commits to main since this release
143a99e

What's Changed

Same as 4.0.0b2 other than:

  • Breaking Changes
    • All parsers used with cmd2 commands must be an instance of Cmd2ArgumentParser or a child
      class of it.
    • Removed set_ap_completer_type() and get_ap_completer_type() since ap_completer_type is
      now a public member of Cmd2ArgumentParser.
    • Moved set_parser_prog() to Cmd2ArgumentParser.update_prog().
    • Renamed cmd2_handler to cmd2_subcmd_handler in the argparse.Namespace for clarity.
    • Removed Cmd2AttributeWrapper class. argparse.Namespace objects passed to command functions
      now contain direct attributes for cmd2_statement and cmd2_subcmd_handler.
    • Renamed cmd2/command_definition.py to cmd2/command_set.py.
    • Removed Cmd.doc_header and the with_default_category decorator. Help categorization is now
      driven by the DEFAULT_CATEGORY class variable (see Simplified command categorization in
      the Enhancements section below for details).
    • Removed Cmd.undoc_header since all commands are now considered categorized.
    • Renamed Cmd.cmd_func() to Cmd.get_command_func().
    • cmd2 no longer sets a default title for a subparsers group. If you desire a title, you will
      need to pass one in like this parser.add_subparsers(title="subcommands"). This is standard
      argparse behavior.
    • TextGroup is now a standalone Rich renderable.
      • Removed formatter_creator parameter from TextGroup.__init__().
      • Removed Cmd2ArgumentParser.create_text_group() method.
    • argparse and Rich integration refactoring:
      • Renamed argparse_custom module to argparse_utils.
      • Moved the following classes from argparse_utils to rich_utils:
        • Cmd2HelpFormatter
        • ArgumentDefaultsCmd2HelpFormatter
        • MetavarTypeCmd2HelpFormatter
        • RawDescriptionCmd2HelpFormatter
        • RawTextCmd2HelpFormatter
        • TextGroup
      • Replaced the global APP_THEME constant in rich_utils.py with get_theme() and
        set_theme() functions to support lazy initialization and safer in-place updates of the
        theme.
  • Enhancements
    • New cmd2.Cmd methods
      • ppretty: a cmd2-compatible replacement for rich.pretty.pprint()
    • Simplified command categorization:
      • By default, all commands in a class are grouped under its DEFAULT_CATEGORY.
      • Individual commands can still be manually moved using the with_category() decorator.
      • For more details and examples, see the Help documentation and the
        examples/default_categories.py file.
    • CommandSet is now a generic class, which allows developers to parameterize it with their
      specific cmd2.Cmd subclass (e.g.,class MyCommandSet(CommandSet[MyApp]):). This provides
      full type hints and IDE autocompletion for self._cmd without needing to override and cast
      the property.

Full Changelog: 4.0.0-b2...4.0.0-b3