From 04ac2f1490172df7e6366cc1e87612bebac8888b Mon Sep 17 00:00:00 2001 From: antazoey Date: Tue, 5 Nov 2024 08:48:51 -0600 Subject: [PATCH] perf: localize import for `ape console` (#2374) --- src/ape_console/_cli.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ape_console/_cli.py b/src/ape_console/_cli.py index c3eef924fa..a3d3431cac 100644 --- a/src/ape_console/_cli.py +++ b/src/ape_console/_cli.py @@ -9,7 +9,6 @@ from typing import TYPE_CHECKING, Any, Optional, cast import click -from IPython import InteractiveShell from ape.cli.commands import ConnectedProviderCommand from ape.cli.options import ape_cli_context, project_option @@ -195,6 +194,8 @@ def _launch_console( def _execute_code(code: list[str], **ipython_kwargs): + from IPython import InteractiveShell + shell = InteractiveShell.instance(**ipython_kwargs) # NOTE: Using `store_history=True` just so the cell IDs are accurate. for line in code: