[IPython-dev] New approach to loading extensions - _ip.load()

Ville M. Vainio vivainio@gmail....
Thu Jun 14 13:14:52 CDT 2007

At this point just importing the extensions didn't scale anymore, so I
moved from the bare

ip = IPython.ipapi.get()

to introducing 'init_ipython(ip)' function that gets run when you run
_ip.load. What _ip.load is:

- It imports the module
- It runs init_ipython(ip) if the module has one. 'ip' is an ipapi instance.

IPython.ipapi.get() approach still works, of course, but some
modules/extensions *need* to be imported with _ip.load.
IPython.history is a first such extension.

Basically, modules that need to be 'load':ed are the ones that can be
imported w/o also outside IPython contex (general purpose modules), or
the ones that are imported by IPython itself before the
'configuration' phase (e.g. the ones imported ipapi.py, as opposed

New modules are recommended to be implemented using the init_ipython approach.

The following changeset should give you the idea:


Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'

More information about the IPython-dev mailing list