diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f594983f..e6ff37e9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Enhancements - Added possibility to use rich Text objects to set the description argument of a `Settable` + - Removed redundant `ipython` import which slowed application startup time ## 4.1.1 (July 9, 2026) diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index c8653d4e1..3bfb4574a 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -177,9 +177,6 @@ UnboundCompleter, ) -with contextlib.suppress(ImportError): - from IPython import start_ipython - try: if sys.platform == "win32": from prompt_toolkit.output.win32 import NoConsoleScreenBufferError # type: ignore[attr-defined] @@ -5151,13 +5148,7 @@ def do_ipy(self, _: argparse.Namespace) -> bool | None: # pragma: no cover # Detect whether IPython is installed try: import traitlets.config.loader as traitlets_loader - - # Allow users to install ipython from a cmd2 prompt when needed and still have ipy command work - try: - _dummy = start_ipython # noqa: F823 - except NameError: - from IPython import start_ipython - + from IPython import start_ipython from IPython.terminal.interactiveshell import TerminalInteractiveShell from IPython.terminal.ipapp import TerminalIPythonApp except ImportError: