|
1 |
| -## 3.0.0 (TBD) |
| 1 | +## 3.0.0 (TBD, 2025) |
| 2 | + |
| 3 | +### Summary |
| 4 | + |
| 5 | +`cmd2` now has a dependency on [rich](https://github.com/Textualize/rich) for rich text and pretty |
| 6 | +formatting in the terminal. Previously, `cmd2` had a large amount of custom code for this purpose |
| 7 | +that predated the existence of `rich`. This opens the door to even more beautiful `cmd2` |
| 8 | +applications. To get the most out of the new capabilities, we encourage you to spend a little bit of |
| 9 | +time reading the [rich documentation](https://rich.readthedocs.io/). |
| 10 | + |
| 11 | +### Details |
2 | 12 |
|
3 | 13 | - Breaking Changes
|
4 |
| - - `cmd2` 3.0 supports Python 3.10+ (removed support for Python 3.9) |
5 |
| - - No longer setting parser's `prog` value in `with_argparser()` since it gets set in |
6 |
| - `Cmd._build_parser()`. This code had previously been restored to support backward |
7 |
| - compatibility in `cmd2` 2.0 family. |
8 |
| - - Removed table_creator.py in favor of `Rich` tables. |
9 |
| - - Moved string styling functionality from ansi.py to string_utils.py. |
10 |
| - - Moved all string-related functions from utils.py to string_utils.py. |
11 |
| - - Removed all text style Enums from ansi.py in favor of `Rich` styles. |
12 |
| - - Renamed ansi.py to terminal_utils.py to reflect the functions left in it. |
13 |
| - - Replaced `utils.Settable.get_value()` and `utils.Settable.set_value()` in favor of a Python |
14 |
| - property called `Settable.value`. |
15 |
| - |
16 |
| -- Enhancements |
17 |
| - - Simplified the process to set a custom parser for `cmd2's` built-in commands. See |
| 14 | + - Refactored and modernized styling and utility modules: |
| 15 | + - Removed the legacy `table_creator.py` module in favor of `rich` tables (see the |
| 16 | + [rich_tables.py](https://github.com/python-cmd2/cmd2/blob/main/examples/rich_tables.py) |
| 17 | + example for more info) |
| 18 | + - Moved all string-related functions from `utils.py` to a new `string_utils.py` module |
| 19 | + - Consolidated all string styling functions from `ansi.py` into `string_utils.py` |
| 20 | + - Replaced all text style enums from `ansi.py` with modern `rich` styles |
| 21 | + - Renamed `ansi.py` to `terminal_utils.py` to better reflect its purpose |
| 22 | + - Dropped support for Python 3.9. `cmd2` now requires Python 3.10 or later |
| 23 | + - Replaced `Settable.get_value()` and `Settable.set_value()` methods with a more Pythonic |
| 24 | + `value` property |
| 25 | + - Removed redundant setting of a parser's `prog` value in the `with_argparser()` decorator, as |
| 26 | + this is now handled centrally in `Cmd._build_parser()` |
| 27 | + |
| 28 | +- Enhancements |
| 29 | + - Enhanced all print methods (`poutput()`, `perror()`, `ppaged()`, etc.) to natively render |
| 30 | + `rich` objects, enabling beautiful and complex output |
| 31 | + - Simplified the process for setting a custom parser for `cmd2`'s built-in commands. See the |
18 | 32 | [custom_parser.py](https://github.com/python-cmd2/cmd2/blob/main/examples/custom_parser.py)
|
19 |
| - example for more details. |
20 |
| - - Added `Cmd.macro_arg_complete()` which tab completes arguments to a macro. Its default |
21 |
| - behavior is to perform path completion, but it can be overridden as needed. |
22 |
| - - All print methods (`poutput()`, `perror()`, `ppaged()`, etc.) have the ability to print Rich |
23 |
| - objects. |
24 |
| - - Added string_utils.py which contains all string utility functions. This includes quoting and |
25 |
| - alignment functions from utils.py. This also includes style-related functions from ansi.py. |
26 |
| - This also includes style-related functions from ansi.py. |
27 |
| - - Added colors.py which contains a StrEnum of all color names supported by Rich. |
28 |
| - - Added styles.py which contains a StrEnum of all cmd2-specific style names and their respective |
29 |
| - style definitions. |
30 |
| - |
31 |
| -- Bug Fixes |
32 |
| - - No longer redirecting `sys.stdout` if it's a different stream than `self.stdout`. This fixes |
33 |
| - issue where we overwrote an application's `sys.stdout` while redirecting. |
| 33 | + example for an updated guide |
| 34 | + - Introduced `Cmd.macro_arg_complete()` for tab-completing macro arguments, with default path |
| 35 | + completion that can be easily customized |
| 36 | + - Added `colors.py` and `styles.py` to provide easy access to `rich` color names and manage |
| 37 | + `cmd2`-specific style definitions using `StrEnum` (see the |
| 38 | + [colors.py](https://github.com/python-cmd2/cmd2/blob/main/examples/color.py) example for a |
| 39 | + demonstration of all colors available to your `cmd2` application) |
| 40 | + - Added ability to create a custom theme for a `cmd2` application using `rich_utils.set_theme` |
| 41 | + (see the [rich_theme.py](https://github.com/python-cmd2/cmd2/blob/main/examples/rich_theme.py) |
| 42 | + example for more info) |
| 43 | + - Consolidated multiple redundant examples into a few more comprehensive ones, see: |
| 44 | + - [argparse_example.py](https://github.com/python-cmd2/cmd2/blob/main/examples/argparse_example.py) |
| 45 | + - [command_sets.py](https://github.com/python-cmd2/cmd2/blob/main/examples/command_sets.py) |
| 46 | + - [getting_started.py](https://github.com/python-cmd2/cmd2/blob/main/examples/getting_started.py) |
| 47 | + |
| 48 | +- Bug Fixes |
| 49 | + - Fixed a redirection bug where `cmd2` could unintentionally overwrite an application's |
| 50 | + `sys.stdout` |
34 | 51 |
|
35 | 52 | ## 2.7.0 (June 30, 2025)
|
36 | 53 |
|
|
0 commit comments