Expose Pdb API
It would be nice if ipdb exposed some kind of API, like pdb.Pdb and IPython.core.debugger.PDB. This would make it much easier to extend existing code that uses pdb, to use ipdb instead, without needing to rewrite the existing code.
ipdb is based on IPython. IOW, I guess you can use IPython.core.debugger.PDB API.
If this is not the case, can you be more explicit about what API calls you would like to see ?
I'm thinking particularly about a piece of code like the below (taken from the django-pdb project - https://github.com/tomchristie/django-pdb)
p = pdb.Pdb()
p.reset()
p.set_break(filename, lineno, temporary, cond, funcname)
sys.settrace(p.trace_dispatch)
This code can be extended to use IPython.core.debugger.Pdb instead of pdb.Pdb, which behaves mostly like ipdb, but it lacks some of ipdb's features such as colours. It would be useful to have (for instance) an ipdb.Pdb object, which extends the IPython object but adds all of ipdb's nice features.
As things are currently, if I wanted to extend this to behave like ipdb, I would basically end up having to copy-paste a large amount of the ipdb code, just to duplicate the same functionality.
Another place this comes up, fwiw: https://github.com/ask/celery/issues/437 . Having an ipdb.Pdb() would make experiments there easy.
Took me time to come back :flushed:
Any pull request is welcome.