[IPython-dev] Package-specific extensions: an idea

Fernando Perez fperez.net at gmail.com
Thu Jun 16 16:18:58 EDT 2011

On Tue, May 17, 2011 at 3:48 PM, Robert Kern <robert.kern at gmail.com> wrote:
> There's a general problem for writing package-specific extensions to IPython.
> Namely, you want to be able to write and enable an extension to IPython that
> provides special behavior for particular objects, say numpy arrays, without
> requiring that a particular package be imported at startup. You can often get by
> in ad hoc ways. For example, in the pretty-printing code, I added the ability to
> register deferred type-checking. For magic functions, you can usually just do
> local imports inside the magics.
> However, I've had an idea for a general solution.

I'm kind of -1 on this approach right now, mostly because I really
don't want to add more special paths to our execution logic.  Instead,
we have already the ability for users to register any function they
desire to execute afterwards:


So my suggestion would be for this to be done by the user as a
post-execute function.  We can certainly provide it pre-canned to
eliminate the need for users to rewrite boilerplate, but I'd rather
keep the main run* methods as tight as they can reasonably be in the
main codebase.

How does that sound?


More information about the IPython-dev mailing list