[IPython-User] A few magic commands useful for object inspection

Greg Novak greg.novak@gmail....
Sun Mar 31 06:13:47 CDT 2013

Carl Smith wrote:
> Thank you for this. I was just wondering how this works. In
> short, can I use *all* of the introspection you described
> without IPython, on a vanilla Python install? I wanted to use
> it on Android and IPython doesn't run there yet.

Yes, all.  The whole implementation is just pure Python (should
run on everything back to 2.4 at least, possibly further).  The
only code that depends on IPython is the part that figures out
how to take the argument to the magic command (a string) and
break it up into arguments for the introspection functions.  The function
names are a bit longer (recursive_type instead of rtype) but you can change
that if you like by doing "from grasp import recursive_type as rtype"

Carl Smith wrote:
> Also, are you happy to release it open source? I have an app in
> the works that could really use this kind of magic.

The source is available at https://launchpad.net/grasp.  I put
the CC0 licence on it (equivalent to public domain) so there
should be no issues with incorporating it into another project.
I would ask two things: 1) Please send a link to your project so
I can list it on the web page for the module and 2) Please
provide an attribution in the documentation of your project.

Thomas Kluyver wrote:
> You might want to make it an IPython extension, which makes the
> integration a bit cleaner (you don't need to catch
> NameError). You just call ip.register_magics inside a
> 'load_ipython_extension' function. The full details are at
> http://ipython.org/ipython-doc/stable/config/extensions/index.html
> You're also welcome to add it to the extensions index:
> https://github.com/ipython/ipython/wiki/Extensions-Index

Thanks, will do!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20130331/40025638/attachment.html 

More information about the IPython-User mailing list