Skip to content

Releases: python-cmd2/cmd2

3.0.0rc1 Release Candidate (2025-09-26)

26 Sep 16:34
Compare
Choose a tag to compare
Pre-release

Summary

cmd2 now has a dependency on rich for rich text and pretty
formatting in the terminal. Previously, cmd2 had a large amount of custom code for this purpose
that predated the existence of rich. This opens the door to even more beautiful cmd2
applications. To get the most out of the new capabilities, we encourage you to spend a little bit of
time reading the rich documentation.

Details

  • Breaking Changes

    • Refactored and modernized styling and utility modules:
      • Removed the legacy table_creator.py module in favor of rich tables (see the
        rich_tables.py
        example for more info)
      • Moved all string-related functions from utils.py to a new string_utils.py module
      • Consolidated all string styling functions from ansi.py into string_utils.py
      • Replaced all text style enums from ansi.py with modern rich styles
      • Renamed ansi.py to terminal_utils.py to better reflect its purpose
    • Dropped support for Python 3.9. cmd2 now requires Python 3.10 or later
    • Replaced Settable.get_value() and Settable.set_value() methods with a more Pythonic
      value property
    • Removed redundant setting of a parser's prog value in the with_argparser() decorator, as
      this is now handled centrally in Cmd._build_parser()
    • The auto_load_commands argument to cmd2.Cmd.__init__ now defaults to False
  • Enhancements

    • Enhanced all print methods (poutput(), perror(), ppaged(), etc.) to natively render
      rich objects, enabling beautiful and complex output
    • Simplified the process for setting a custom parser for cmd2's built-in commands. See the
      custom_parser.py
      example for an updated guide
    • Introduced Cmd.macro_arg_complete() for tab-completing macro arguments, with default path
      completion that can be easily customized
    • Added colors.py and styles.py to provide easy access to rich color names and manage
      cmd2-specific style definitions using StrEnum (see the
      colors.py example for a
      demonstration of all colors available to your cmd2 application)
    • Added ability to create a custom theme for a cmd2 application using rich_utils.set_theme
      (see the rich_theme.py
      example for more info)
    • Consolidated multiple redundant examples into a few more comprehensive ones, see:
    • Optimized performance of terminal fixup during command finalization by replacing stty sane
      with termios.tcsetattr
  • Bug Fixes

    • Fixed a redirection bug where cmd2 could unintentionally overwrite an application's
      sys.stdout
  • Migration Aids - these will help you iteratively migrate to cmd2 3.x in stages

    • Published new cmd2-ansi module which is a backport of
      the cmd2.ansi module present in cmd2 2.7.0
    • Published new cmd2-table module which is a backport of
      the cmd2.table_creator module present in cmd2 2.7.0

3.0.0b2 (2025-09-17)

17 Sep 12:59
21657a6
Compare
Choose a tag to compare
3.0.0b2 (2025-09-17) Pre-release
Pre-release

Same as 3.0.0b1 other than:

  • Breaking Changes
    • The auto_load_commands argument to cmd2.Cmd.__init__ now defaults to False

3.0.0b1 (2025-09-16)

16 Sep 21:02
Compare
Choose a tag to compare
3.0.0b1 (2025-09-16) Pre-release
Pre-release

Summary

cmd2 now has a dependency on rich for rich text and pretty formatting in the terminal. Previously, cmd2 had a large amount of custom code for this purpose that predated the existence of rich. This opens the door to even more beautiful cmd2 applications. To get the most out of the new capabilities, we encourage you to spend a little bit of time reading the rich documentation.

Details

  • Breaking Changes

    • Refactored and modernized styling and utility modules:
      • Removed the legacy table_creator.py module in favor of rich tables (see the rich_tables.py example for more info)
      • Moved all string-related functions from utils.py to a new string_utils.py module
      • Consolidated all string styling functions from ansi.py into string_utils.py
      • Replaced all text style enums from ansi.py with modern rich styles
      • Renamed ansi.py to terminal_utils.py to better reflect its purpose
    • Dropped support for Python 3.9. cmd2 now requires Python 3.10 or later
    • Replaced Settable.get_value() and Settable.set_value() methods with a more Pythonic value property
    • Removed redundant setting of a parser's prog value in the with_argparser() decorator, as this is now handled centrally in Cmd._build_parser()
  • Enhancements

    • Enhanced all print methods (poutput(), perror(), ppaged(), etc.) to natively render rich objects, enabling beautiful and complex output
    • Simplified the process for setting a custom parser for cmd2's built-in commands. See the custom_parser.py example for an updated guide
    • Introduced Cmd.macro_arg_complete() for tab-completing macro arguments, with default path completion that can be easily customized
    • Added colors.py and styles.py to provide easy access to rich color names and manage cmd2-specific style definitions using StrEnum (see the colors.py example for a demonstration of all colors available to your cmd2 application)
    • Added ability to create a custom theme for a cmd2 application using rich_utils.set_theme (see the rich_theme.py example for more info)
    • Consolidated multiple redundant examples into a few more comprehensive ones, see:
    • Optimized performance of terminal fixup during command finalization by replacing stty sane with termios.tcsetattr
  • Bug Fixes

    • Fixed a redirection bug where cmd2 could unintentionally overwrite an application's sys.stdout

2.7.0 (June 30, 2025)

30 Jun 16:55
Compare
Choose a tag to compare
  • Enhancements
    • Integrated rich-argparse with cmd2's default argparse help formatter (Cmd2HelpFormatter).

2.6.2 (June 26, 2025)

26 Jun 17:14
Compare
Choose a tag to compare
  • Enhancements

    • Added explicit support for free-threaded versions of Python, starting with version 3.14
  • Bug Fixes

    • Restored code to set a parser's prog value in the with_argparser decorator. This is to
      preserve backward compatibility in the cmd2 2.0 family. This functionality will be removed
      in cmd2 3.0.0.

2.6.1 (June 8, 2025)

08 Jun 22:21
Compare
Choose a tag to compare
  • Bug Fixes
    • Fixed bug that prevented cmd2 from working with from __future__ import annotations

2.6.0 (May 31, 2025)

31 May 16:01
28f226a
Compare
Choose a tag to compare
  • Breaking Change
    • cmd2 2.6 supports Python 3.9+ (removed support for Python 3.8)
  • Enhancements
    • Added support for Python 3.14
    • Added new Cmd.ppretty() method for pretty printing arbitrary Python data structures
    • Clarified help text for -t/--transcript argument to the history command

2.5.11 (January 25, 2025)

25 Jan 16:22
Compare
Choose a tag to compare
  • Bug Fixes
    • Fixed duplicated parameter tables in API documentation.

2.5.10 (January 25, 2025)

25 Jan 15:55
Compare
Choose a tag to compare
  • Bug Fixes
    • Fixed docstring style for MkDocs API documentation so parameters are displayed properly.

2.5.9 (January 17, 2025)

18 Jan 00:04
Compare
Choose a tag to compare
  • Bug Fixes
    • Fixed 'index out of range' error when passing no arguments to an argparse-based command function.