From 55866283e89acbf2f9e1ea047e98e16fad5e732c 2016-05-20 18:17:26 From: Matthias Bussonnier Date: 2016-05-20 18:17:26 Subject: [PATCH] Remove Pydb integration as Pydb is unmaintained and not ion PyPI Closes # 9482 --- diff --git a/IPython/core/completer.py b/IPython/core/completer.py index 21c9110..f0ed4b3 100644 --- a/IPython/core/completer.py +++ b/IPython/core/completer.py @@ -657,8 +657,7 @@ class IPCompleter(Completer): def all_completions(self, text): """ - Wrapper around the complete method for the benefit of emacs - and pydb. + Wrapper around the complete method for the benefit of emacs. """ return self.complete(text)[1] diff --git a/IPython/core/debugger.py b/IPython/core/debugger.py index 0f0c78a..cf4fdcd 100644 --- a/IPython/core/debugger.py +++ b/IPython/core/debugger.py @@ -37,25 +37,10 @@ from IPython.utils import coloransi, py3compat from IPython.core.excolors import exception_colors from IPython.testing.skipdoctest import skip_doctest -# See if we can use pydb. -has_pydb = False prompt = 'ipdb> ' + #We have to check this directly from sys.argv, config struct not yet available -if '--pydb' in sys.argv: - try: - import pydb - if hasattr(pydb.pydb, "runl") and pydb.version>'1.17': - # Version 1.17 is broken, and that's what ships with Ubuntu Edgy, so we - # better protect against it. - has_pydb = True - except ImportError: - print("Pydb (http://bashdb.sourceforge.net/pydb/) does not seem to be available") - -if has_pydb: - from pydb import Pdb as OldPdb - prompt = 'ipydb> ' -else: - from pdb import Pdb as OldPdb +from pdb import Pdb as OldPdb # Allow the set_trace code to operate outside of an ipython instance, even if # it does so with some limitations. The rest of this support is implemented in @@ -220,14 +205,9 @@ class Pdb(OldPdb): except (TypeError, ValueError): raise ValueError("Context must be a positive integer") - if has_pydb and completekey is None: - OldPdb.__init__(self,stdin=stdin,stdout=sys.stdout) - else: - OldPdb.__init__(self,completekey,stdin,stdout) + OldPdb.__init__(self,completekey,stdin,stdout) # IPython changes... - self.is_pydb = has_pydb - self.shell = get_ipython() if self.shell is None: @@ -236,26 +216,6 @@ class Pdb(OldPdb): TerminalInteractiveShell self.shell = TerminalInteractiveShell.instance() - if self.is_pydb: - - # interactiveshell.py's ipalias seems to want pdb's checkline - # which located in pydb.fn - import pydb.fns - self.checkline = lambda filename, lineno: \ - pydb.fns.checkline(self, filename, lineno) - - self.curframe = None - self.do_restart = self.new_do_restart - - self.old_all_completions = self.shell.Completer.all_completions - self.shell.Completer.all_completions=self.all_completions - - self.do_list = decorate_fn_with_doc(self.list_command_pydb, - OldPdb.do_list) - self.do_l = self.do_list - self.do_frame = decorate_fn_with_doc(self.new_do_frame, - OldPdb.do_frame) - self.aliases = {} # Create color table: we copy the default one from the traceback @@ -482,12 +442,6 @@ class Pdb(OldPdb): return tpl_line % (bp_mark_color + bp_mark, num, line) - def list_command_pydb(self, arg): - """List command to use if we have a newer pydb installed""" - filename, first, last = OldPdb.parse_list_cmd(self, arg) - if filename is not None: - self.print_list_lines(filename, first, last) - def print_list_lines(self, filename, first, last): """The printing (as opposed to the parsing part of a 'list' command.""" diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index 6a18ecd..c6e913a 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -31,7 +31,7 @@ from io import open as io_open from pickleshare import PickleShareDB from traitlets.config.configurable import SingletonConfigurable -from IPython.core import debugger, oinspect +from IPython.core import oinspect from IPython.core import magic from IPython.core import page from IPython.core import prefilter @@ -974,7 +974,7 @@ class InteractiveShell(SingletonConfigurable): 'Control auto-activation of pdb at exceptions') def debugger(self,force=False): - """Call the pydb/pdb debugger. + """Call the pdb debugger. Keywords: @@ -991,15 +991,9 @@ class InteractiveShell(SingletonConfigurable): error('No traceback has been produced, nothing to debug.') return - # use pydb if available - if debugger.has_pydb: - from pydb import pm - else: - # fallback to our internal debugger - pm = lambda : self.InteractiveTB.debugger(force=True) with self.readline_no_record: - pm() + self.InteractiveTB.debugger(force=True) #------------------------------------------------------------------------- # Things related to IPython's various namespaces diff --git a/IPython/core/shellapp.py b/IPython/core/shellapp.py index 9bc99af..a1d2554 100644 --- a/IPython/core/shellapp.py +++ b/IPython/core/shellapp.py @@ -22,7 +22,7 @@ from IPython.utils import py3compat from IPython.utils.contexts import preserve_keys from IPython.utils.path import filefind from traitlets import ( - Unicode, Instance, List, Bool, CaselessStrEnum, default, observe, + Unicode, Instance, List, Bool, CaselessStrEnum, observe, ) from IPython.lib.inputhook import guis @@ -50,14 +50,6 @@ addflag('pdb', 'InteractiveShell.pdb', "Enable auto calling the pdb debugger after every exception.", "Disable auto calling the pdb debugger after every exception." ) -# pydb flag doesn't do any config, as core.debugger switches on import, -# which is before parsing. This just allows the flag to be passed. -shell_flags.update(dict( - pydb = ({}, - """Use the third party 'pydb' package as debugger, instead of pdb. - Requires that pydb is installed.""" - ) -)) addflag('pprint', 'PlainTextFormatter.pprint', "Enable auto pretty printing of results.", "Disable auto pretty printing of results." @@ -321,7 +313,7 @@ class InteractiveShellApp(Configurable): def _exec_file(self, fname, shell_futures=False): try: full_filename = filefind(fname, [u'.', self.ipython_dir]) - except IOError as e: + except IOError: self.log.warning("File not found: %r"%fname) return # Make sure that the running script gets a proper sys.argv as if it diff --git a/docs/source/whatsnew/pr/incompat-remove-pydb.rst b/docs/source/whatsnew/pr/incompat-remove-pydb.rst new file mode 100644 index 0000000..4fe0fa5 --- /dev/null +++ b/docs/source/whatsnew/pr/incompat-remove-pydb.rst @@ -0,0 +1 @@ +Integration with pydb has been removed since pydb development has been stopped since 2012, and pydb is not installable from PyPI