Simplify debugger classes. #9731

Merged
merged 1 commit into from Jul 19, 2016

Projects

None yet

3 participants

@anntzer
Contributor
anntzer commented Jul 10, 2016

Directly get the color scheme from the interactive shell (which is
created if not already present, anyways). The goal is ultimately to
allow the IPython debugger to be a drop-in replacement of the stdlib pdb
with the same signature (in particular, this would obviate the need for
plugins such as nose-ipdb and pytest-ipdb; nose and pytest could instead
let their --pdb command line arg take an argument specifying the Pdb
(sub)class to use, e.g. py.test --pdb=IPython.core.debugger.Pdb).

Also deprecate the Tracer class (and related utilities), which can be
fairly trivially replaced by IPython.core.debugger.Pdb().set_trace()
(we can let Pdb catch BdbQuit itself).

It may be also possible to make color_scheme a kw-only arg to Pdb, but it would be awkward to do so while maintaining back-compatibility (because it is used positionally and as the first argument in a few places). So another option would be to break back-compatibility without a deprecation period, and directly make it a kw-only arg in IPython 6 (this is trivial to do in a Py3-only codebase).

@Carreau
Member
Carreau commented Jul 12, 2016

Great ! Thanks !

I don't think we'll do that in the 5.x branch but as soon as we release 5.1 and for master toward a 6.0 I'll be happy to get things like that in !

Unless @takluyver thinks the deprecation messages in 5.1 are worth it.

Thoughts ?

@Carreau Carreau and 1 other commented on an outdated diff Jul 12, 2016
IPython/core/debugger.py
@@ -62,6 +63,7 @@ def BdbQuit_excepthook(et, ev, tb, excepthook=None):
All other exceptions are processed using the `excepthook`
parameter.
"""
+ warnings.warn("`BdbQuit_excepthook` is deprecated", DeprecationWarning)
@Carreau
Carreau Jul 12, 2016 Member

Nitpicking, but once we agree on when to deprecate (5.1 or 6.0), I like to add ...deprecated since version X.y otherwise it's painful for user to figure out when they can remove potential shims , and for us to figure out when we can delete the code.

@anntzer
anntzer Jul 12, 2016 Contributor

Added deprecation as of 5.1 following @takluyver's comment.

@anntzer
Contributor
anntzer commented Jul 12, 2016

PS: pytest-dev/pytest#1712 seems on its way in. nose2 seems to directly call the pdb API (instead of instantiating a Pdb instance) so it would require a bit deeper refactoring.

@takluyver
Member

I kind of think that the colour stuff should be in the terminal subclass. But that would remove coloured output from debugging in Jupyter frontends, so probably not...

@takluyver
Member

I think I'd be OK with this going in for 5.1, but I don't feel strongly either way.

@anntzer anntzer Simplify debugger classes.
Directly get the color scheme from the interactive shell (which is
created if not already present, anyways).  The goal is ultimately to
allow the IPython debugger to be a drop-in replacement of the stdlib pdb
with the same signature (in particular, this would obviate the need for
plugins such as nose-ipdb and pytest-ipdb; nose and pytest could instead
let their `--pdb` command line arg take an argument specifying the Pdb
(sub)class to use, e.g. `py.test --pdb=IPython.core.debugger.Pdb`).

Also deprecate the `Tracer` class (and related utilities), which can be
fairly trivially replaced by `IPython.core.debugger.Pdb().set_trace()`
(we can let `Pdb` catch `BdbQuit` itself).
ec2d023
@Carreau Carreau added this to the 5.1 milestone Jul 12, 2016
@Carreau
Member
Carreau commented Jul 12, 2016

5.1 it will be then.

@Carreau
Member
Carreau commented Jul 19, 2016

Ok, let's merge this one.

@Carreau Carreau merged commit eece8e8 into ipython:master Jul 19, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@anntzer anntzer deleted the anntzer:simplify-debugger branch Jul 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment