[IPython-User] Custom magic debugger function

Robert Kern robert.kern@gmail....
Tue Aug 9 14:31:45 CDT 2011

On 8/7/11 7:42 PM, Aaron Meurer wrote:
> On Sun, Aug 7, 2011 at 5:46 AM, Thomas Kluyver<takowl@gmail.com>  wrote:
>> On 7 August 2011 09:04, Aaron Meurer<asmeurer@gmail.com>  wrote:
>>> Is it possible to create custom magic expressions?  I'd like to create
>>> a %pudb magic, which acts like %pdb except it calls PuDB on failure
>>> instead of pdb.
>> It's certainly possible to create custom magic expressions. For handling
>> exceptions, I think that interactiveshell.set_custom_exc should do what you
>> want.
>> Thomas
> Sorry, but how do I create custom magic? I didn't see anything in the
> documentation, though I may have missed it.

You need to write an extension. The included parallelmagic extension shows one 
way, using a Plugin:


This is useful when you need to keep track of state as attributes on the Plugin 

My kernmagic package shows another way to expose individual magic functions that 
do not have state:


Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

More information about the IPython-User mailing list