Skip to content

Commit 34f61e8

Browse files
authored
Merge pull request #702 from kafai-lam/feat/ipython-console
[Feature] Add ipython support for console interaction
2 parents 763a82e + c86fba6 commit 34f61e8

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

scripts/shopify_api.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,18 @@
1616
def start_interpreter(**variables):
1717
# add the current working directory to the sys paths
1818
sys.path.append(os.getcwd())
19-
console = type("shopify " + shopify.version.VERSION, (code.InteractiveConsole, object), {})
20-
import readline
19+
try:
20+
from IPython import start_ipython
21+
from traitlets.config.loader import Config
2122

22-
console(variables).interact()
23+
config = Config(TerminalInteractiveShell={"banner2": "(shopify %s)" % shopify.version.VERSION})
24+
start_ipython(argv=[], user_ns=variables, config=config)
25+
26+
except ImportError:
27+
console = type("shopify " + shopify.version.VERSION, (code.InteractiveConsole, object), {})
28+
import readline
29+
30+
console(variables).interact()
2331

2432

2533
class ConfigFileError(Exception):

0 commit comments

Comments
 (0)