[IPython-dev] making %pydb be more pythonic (was: Extensions/pydb_ipy.py added)

Ville M. Vainio vivainio at gmail.com
Thu Nov 23 13:48:05 CST 2006


On 11/23/06, R. Bernstein <rocky at panix.com> wrote:

>  >  > Would it make sense to import pydb.pydb module in pydb_ipy.py, and
>  >  > inject the ipython version of Pdb class to the pydb module namespace?
>  >  > That way main() would instantiate the ipython version...
>  >
>  > Good idea! That's be great!
>
> Nothing has happened on this and I suspect because it wasn't
> doable. (At least I couldn't figure out how it would be done. But I
> figured if it could that *could* it would be a great thing to do.)

This could have worked (in ipy_pydb - untried code):

-----
import pydb.pydb
import Debugger

pydb.pydb.Pdb = Debugger.Pdb
------

I didn't try it myself because I figured you could have given it more
testing mileage. Additionally, I was off the net for a long while due
to moving.

> So recently, I've added a parameter to pydb so that runv() can get
> passed with an Pdb object extended in the way that ipython wants to
> extend it. That will be in the next release of pydb (which again can
> be timed so that it is no later than the next ipython release).
>
> I've modified ipy_pydb.py so that it now passes in such a Pdb
> object. This was the debug session can make use of pdoc and pinfo. It
> also uses the ipython debugger prompt (which personally I'm not a fan
> of but I guess it makes it ipython consistent.) There is now the
> possibility of using the ipython color scheme, but I couldn't figure
> out how to get that passed when creating the Debugger.Pdb object.
>
> And in going over IPython/Extensions/ipy_pydb.py I've noticed a couple
> of other things. First there should be a check that pydb can be
> imported and that there is a late enough version of pydb.
>
> Below is a patch.


Not a bad solution, I committed the patch. In general, ipy_pydb.py is
"your territory" and I'll gladly commit every patch I get for it
immediately. In theory something like ipy_pydb.py could even be
bundled w/ pydb, just like python-mode.el is bundled with python...

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'


More information about the IPython-dev mailing list