Skip to content

Commit 499d9ba

Browse files
committed
Merge branch 'master' into 3.0.0
2 parents 5ce8407 + 0b4e8b0 commit 499d9ba

13 files changed

+33
-8
lines changed

.github/workflows/mypy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
mypy:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v4 # https://github.com/actions/checkout
15-
- uses: actions/setup-python@v5 # https://github.com/actions/setup-python
14+
- uses: actions/checkout@v4 # https://github.com/actions/checkout
15+
- uses: actions/setup-python@v5 # https://github.com/actions/setup-python
1616
with:
1717
python-version: 3.13
1818
allow-prereleases: true

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
See [custom_parser.py](https://github.com/python-cmd2/cmd2/blob/master/examples/custom_parser.py)
77
example for more details.
88

9+
# 2.5.1 (November 2, 2024)
10+
* Bug Fixes
11+
* Fixed readline bug when using `ipy` command with `gnureadline` and Python 3.13
12+
913
## 2.5.0 (October 23, 2024)
1014
* Breaking Change
1115
* `cmd2` 2.5 supports Python 3.8+ (removed support for Python 3.6 and 3.7)

cmd2/cmd2.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,13 @@
126126
StatementParser,
127127
shlex_split,
128128
)
129+
130+
# NOTE: When using gnureadline with Python 3.13, start_ipython needs to be imported before any readline-related stuff
131+
try:
132+
from IPython import start_ipython # type: ignore[import]
133+
except ImportError:
134+
pass
135+
129136
from .rl_utils import (
130137
RlType,
131138
rl_escape_prompt,
@@ -4331,9 +4338,13 @@ def do_ipy(self, _: argparse.Namespace) -> Optional[bool]: # pragma: no cover
43314338
# Detect whether IPython is installed
43324339
try:
43334340
import traitlets.config.loader as TraitletsLoader # type: ignore[import]
4334-
from IPython import ( # type: ignore[import]
4335-
start_ipython,
4336-
)
4341+
4342+
# Allow users to install ipython from a cmd2 prompt when needed and still have ipy command work
4343+
try:
4344+
start_ipython # noqa F823
4345+
except NameError:
4346+
from IPython import start_ipython # type: ignore[import]
4347+
43374348
from IPython.terminal.interactiveshell import ( # type: ignore[import]
43384349
TerminalInteractiveShell,
43394350
)

cmd2/parsing.py

100755100644
File mode changed.

docs/features/prompt.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ attribute. This contains the string which should be printed as a prompt
1111
for user input. See the Pirate_ example for the simple use case of statically
1212
setting the prompt.
1313

14-
.. _Pirate: https://github.com/python-cmd2/cmd2/blob/master/examples/pirate.py#L33
14+
.. _Pirate: https://github.com/python-cmd2/cmd2/blob/master/examples/pirate.py#L39
1515

1616
Continuation Prompt
1717
-------------------
@@ -24,7 +24,7 @@ subsequent lines of input is defined by the
2424
:attr:`cmd2.Cmd.continuation_prompt` attribute.See the Initialization_ example
2525
for a demonstration of customizing the continuation prompt.
2626

27-
.. _Initialization: https://github.com/python-cmd2/cmd2/blob/master/examples/initialization.py#L33
27+
.. _Initialization: https://github.com/python-cmd2/cmd2/blob/master/examples/initialization.py#L42
2828

2929
Updating the prompt
3030
-------------------
@@ -34,7 +34,7 @@ the :ref:`Application Lifecycle Hooks <features/hooks:Hooks>` such as a
3434
:ref:`Postcommand hook <features/hooks:Postcommand Hooks>`. See
3535
PythonScripting_ for an example of dynamically updating the prompt.
3636

37-
.. _PythonScripting: https://github.com/python-cmd2/cmd2/blob/master/examples/python_scripting.py#L34-L48
37+
.. _PythonScripting: https://github.com/python-cmd2/cmd2/blob/master/examples/python_scripting.py#L38-L55
3838

3939
Asynchronous Feedback
4040
---------------------

examples/argparse_completion.py

100644100755
File mode changed.

examples/default_categories.py

100644100755
File mode changed.

examples/modular_commands_basic.py

100644100755
File mode changed.

examples/modular_commands_dynamic.py

100644100755
File mode changed.

examples/modular_commands_main.py

100644100755
File mode changed.

0 commit comments

Comments
 (0)