[IPython-dev] autoload and making %pydb be more ipythonic (was: Extensions/pydb_ipy.py added)
rocky at panix.com
Thu Nov 23 23:39:20 CST 2006
Thanks for applying the patch!
I am currently out of town, but when I get back I'll try as you suggest below.
I have other patches sitting on a disk somewhere too.
I don't have a problem adding ipy_pydb.py in the pydb package. But the one thing though that I think would somehow be nice is that if one *didn't* have to do run "import ipy_pydb" to allow %pydb to work. Given that one can put this in a "try" block, I don't see any downside of doing this.
A cool and more general mechanism for ipython extensions would be something along the lines of Emacs Lisp "autoload". Say if I run %xxx ... then if that's not registered, try to run "import ipy_xxx" (where for example xxx = pydb), and then run %xxx .... Comments?
Ville M. Vainio writes:
> 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