Releases: python-cmd2/cmd2
4.0.0b1 (2026-03-03)
Summary
cmd2 now has a dependency on prompt-toolkit which serves as a pure-Python cross-platform replacement for GNU Readline. Previously, cmd2 had used different readline dependencies on each Operating System (OS) which was at times a very frustrating developer and user experience due to small inconsistencies in these different readline libraries. Now we have consistent cross platform support for tab-completion, user terminal input, and history. Additionally, this opens up some cool advanced features such as support for syntax highlighting of user input while typing, auto-suggestions similar to those provided by the fish shell, and the option for a persistent bottom bar that can display realtime status updates while the prompt is displayed.
Details
- Breaking Changes
- Removed all use of
readlinebuilt-in module and underlying platform libraries - Deleted
cmd2.rl_utilsmodule which dealt with importing the properreadlinemodule for
each platform and provided utility functions related toreadline - Added a dependency on
prompt-toolkitand a newcmd2.pt_utilsmodule with supporting
utilities - Removed Transcript Testing feature set along with the
history -toption for generating
transcript files and thecmd2.transcriptmodule- This was an extremely brittle regression testing framework which should never have been
built into cmd2 - We recommend using pytest for unit and integration tests and
Robot Framework for acceptance tests. Both of these
frameworks can be used to create tests which are far more reliable and less brittle.
- This was an extremely brittle regression testing framework which should never have been
- Async specific:
prompt-toolkitstarts its ownasyncioevent loop in everycmd2
application- Removed
cmd2.Cmd.terminal_lockas it is no longer required to support things like
cmd2.Cmd.async_alert - Removed
cmd2.Cmd.async_refresh_promptandcmd2.Cmd.need_prompt_refreshas they are no
longer needed
- Removed
completerfunctions must now return acmd2.Completionsobject instead oflist[str].choices_providerfunctions must now return acmd2.Choicesobject instead oflist[str].- An argparse argument's
descriptive_headersfield is now calledtable_header. CompletionItem.descriptive_datais now calledCompletionItem.table_row.Cmd.default_sort_keymoved toutils.DEFAULT_STR_SORT_KEY.- Moved completion state data, which previously resided in
Cmd, into other classes.Cmd.matches_sorted->Completions.is_sortedandChoices.is_sortedCmd.completion_hint->Completions.completion_hintCmd.formatted_completions->Completions.completion_tableCmd.allow_appended_space/allow_closing_quote->Completions.allow_finalization
- Removed
Cmd.matches_delimitedsince it's no longer used. - Removed
flag_based_completeandindex_based_completefunctions since their functionality
is already provided in arpgarse-based completion. - Changed
Statement.multiline_commandfrom a string to a bool. - Made
Statement.arg_lista property which generates the list on-demand. - Renamed
Statement.outputtoStatement.redirector. - Renamed
Statement.output_totoStatement.redirect_to. - Removed
Statement.pipe_tosince it can be handled byStatement.redirectorand
Statement.redirect_to. - Changed
StatementParser.parse_command_only()to return aPartialStatementobject. - Renamed
Macro.arg_listtoMacro.args. - Removed
terminal_utils.pysinceprompt-toolkitprovides this functionality. - Replaced
async_alert()andasync_update_prompt()with a single function called
add_alert(). This new function is thread-safe and does not require you to acquire a mutex
before calling it like the previous functions did. - Removed
Cmd.default_to_shell.
- Removed all use of
- Enhancements
- New
cmd2.Cmdparameters- auto_suggest: (boolean) if
True, provide fish shell style auto-suggestions. These
are grayed-out hints based on history. User can press right-arrow key to accept the
provided suggestion. - bottom toolbar: (boolean) if
True, present a persistent bottom toolbar capable of
displaying realtime status information while the prompt is displayed, see the
cmd2.Cmd2.get_bottom_toolbarmethod that can be overridden as well as the updated
getting_started.pyexample
- auto_suggest: (boolean) if
- New
cmd2.Cmdmethods- get_bottom_toolbar: populates bottom toolbar if
bottom_toolbarisTrue - get_rprompt: override to populate right prompt
- pre_prompt: hook method that is called before the prompt is displayed, but after
prompt-toolkitevent loop has started
- get_bottom_toolbar: populates bottom toolbar if
- New settables:
- max_column_completion_results: (int) the maximum number of completion results to
display in a single column
- max_column_completion_results: (int) the maximum number of completion results to
- New
3.4.0 (March 3, 2026)
-
Enhancements
- Moved cmd2-specific printing logic from
Cmd.print_to()intoCmd2BaseConsole.print()andCmd2BaseConsole.log(). This removes need to pass a console object toCmd.print_to(). - Addressed a bug in
rich.console.Consolewhere complex renderables (likeTableandRule) may not receive formatting settings passed toconsole.print()andconsole.log().
- Moved cmd2-specific printing logic from
-
Breaking Changes
- Renamed the
destinationparameter ofCmd.print_to()back tofilesince you can no longer pass in a console.
- Renamed the
3.3.0 (March 1, 2026)
-
Enhancements
- Added ability to pass a console object to
Cmd.print_to(). This provides support for things
like wrapping aprint_to()call in aconsole.status()orconsole.capture()context
manager.
- Added ability to pass a console object to
-
Breaking Changes
- Renamed the
fileparameter ofCmd.print_to()todestinationto support file-like objects
and console objects. Cmd2BaseConsole(file)argument is now a keyword-only argument to be consistent with the
rich.console.Consoleclass.
- Renamed the
3.2.2 (February 21, 2026)
- Bug Fixes
- Updated
rich_utils.ANSI_STYLE_SEQUENCE_REto only match ANSI SGR (Select Graphic Rendition) sequences for text styling. It previously also matched DEC Private Mode sequences.
- Updated
3.2.1 (February 21, 2026)
- Bug Fixes
- The
async_alertandasync_prompt_updatemethods ofcmd2.Cmdnow respect the current
value of theallow_stylesettable- If
allow_styleisNEVER, all style-related ANSI escape codes will be stripped to ensure plain text
output
- If
- The
3.2.0 (February 5, 2026)
-
Bug Fixes
- Fixed incompatibilities with Python 3.14.3.
-
Potentially Breaking Changes
- To avoid future incompatibilities with argparse, we removed most of our overridden help functions. This should not break an application, but it could affect unit tests which parse help text.
3.1.3 (February 3, 2026)
- Bug Fixes
- Fixed issue where
delimiter_complete()could cause more matches than display matches - Fixed issue where
CommandSetregistration did not respect disabled categories
- Fixed issue where
3.1.2 (January 26, 2026)
- Bug Fixes
- Fixed missing
typing-extensionsdependency for Python 3.10
- Fixed missing
3.1.1 (January 26, 2026)
- Bug Fixes
- Fixed bug where
rich-argparsewas not coloring cmd2's customnargsformatting
- Fixed bug where
3.1.0 (December 25, 2025)
- Potentially Breaking Changes
cmd2no longer has a dependency oncmdandcmd2.Cmdno longer inherits fromcmd.Cmd- We don't think this should impact users, but there is theoretically a possibility
- This opens the door for more impactful changes in the next major release