Skip to content

Commit

Permalink
add ptipython support
Browse files Browse the repository at this point in the history
  • Loading branch information
alok committed Aug 27, 2017
1 parent ffb803e commit 2cd3c25
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pudb/debugger.py
Expand Up @@ -1769,6 +1769,8 @@ def run_external_cmdline(w, size, key):
runner = shell.run_bpython_shell
elif CONFIG["shell"] == "ptpython" and shell.HAVE_PTPYTHON:
runner = shell.run_ptpython_shell
elif CONFIG["shell"] == "ptipython" and shell.HAVE_PTIPYTHON:
runner = shell.run_ptipython_shell
elif CONFIG["shell"] == "classic":
runner = shell.run_classic_shell
else:
Expand Down
2 changes: 1 addition & 1 deletion pudb/settings.py
Expand Up @@ -211,7 +211,7 @@ def _update_config(check_box, new_state, option_newvalue):

shell_info = urwid.Text("This is the shell that will be "
"used when you hit '!'.\n")
shells = ["internal", "classic", "ipython", "bpython", "ptpython"]
shells = ["internal", "classic", "ipython", "bpython", "ptpython", "ptipython"]
known_shell = conf_dict["shell"] in shells
shell_edit = urwid.Edit(edit_text=conf_dict["custom_shell"])
shell_edit_list_item = urwid.AttrMap(shell_edit, "value")
Expand Down
19 changes: 19 additions & 0 deletions pudb/shell.py
Expand Up @@ -11,6 +11,16 @@
else:
HAVE_BPYTHON = True



try:
from ptpython.ipython import embed as ptipython_embed, run_config
from ptpython.repl import run_config
except ImportError:
HAVE_PTIPYTHON = False
else:
HAVE_PTIPYTHON = True

try:
from ptpython.repl import embed as ptpython_embed, run_config
except ImportError:
Expand Down Expand Up @@ -237,4 +247,13 @@ def run_ptpython_shell(globals, locals):
configure=run_config)



def run_ptipython_shell(globals, locals):
# Use the default ptpython history
import os
history_filename = os.path.expanduser('~/.ptpython_history')
ptipython_embed(globals.copy(), locals.copy(),
history_filename=history_filename,
configure=run_config)

# vim: foldmethod=marker

0 comments on commit 2cd3c25

Please sign in to comment.