Skip to content
This repository was archived by the owner on Jan 13, 2023. It is now read-only.

Commit dc0ab5f

Browse files
committed
Minor cosmetic improvements to REPL script.
- Vanilla Python no longer outputs "now exiting InteractiveConsole..." on exit. - IPython now respects profile settings. (`IPython.embed()` is meant for debugging purposes; `IPython.start_ipython()` is part of the public API; see https://ipython.readthedocs.io/en/stable/interactive/reference.html\#embedding for more info.)
1 parent d9d816b commit dc0ab5f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

iota/bin/repl.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,24 +89,26 @@ def _start_repl(api):
8989
"""
9090
Starts the REPL.
9191
"""
92-
_banner = (
92+
banner = (
9393
'IOTA API client for {uri} ({testnet}) initialized as variable `api`.\n'
9494
'Type `help(api)` for list of API commands.'.format(
9595
testnet = 'testnet' if api.testnet else 'mainnet',
9696
uri = api.adapter.get_uri(),
9797
)
9898
)
9999

100+
scope_vars = {'api': api}
101+
100102
try:
101103
# noinspection PyUnresolvedReferences
102104
import IPython
103105
except ImportError:
104106
# IPython not available; use regular Python REPL.
105107
from code import InteractiveConsole
106-
InteractiveConsole(locals={'api': api}).interact(_banner)
108+
InteractiveConsole(locals=scope_vars).interact(banner, '')
107109
else:
108-
# Launch IPython REPL.
109-
IPython.embed(header=_banner)
110+
print(banner)
111+
IPython.start_ipython(argv=[], user_ns=scope_vars)
110112

111113

112114
def main():

0 commit comments

Comments
 (0)