This documentation is for an old version of IPython. You can find docs for newer versions here.
A class for managing IPython extensions.
A class to manage IPython extensions.
An IPython extension is an importable Python module that has a function with the signature:
def load_ipython_extension(ipython): # Do things with ipython
This function is called after your extension is imported and the currently active InteractiveShell instance is passed as the only argument. You can do anything you want with IPython at that point, including defining new magic and aliases, adding new components, etc.
You can also optionally define an unload_ipython_extension(ipython)() function, which will be called if the user unloads or reloads the extension. The extension manager will only call load_ipython_extension() again if the extension is reloaded.
You can put your extension modules anywhere you want, as long as they can be imported by Python’s standard import mechanism. However, to make it easy to write extensions, you can also put your extensions in os.path.join(self.ipython_dir, 'extensions'). This directory is added to sys.path automatically.
Download and install an IPython extension.
If filename is given, the file will be so named (inside the extension directory). Otherwise, the name from the URL will be used. The file must have a .py or .zip extension; otherwise, a ValueError will be raised.
Returns the full path to the installed file.
Load an IPython extension by its module name.
Returns the string “already loaded” if the extension is already loaded, “no load function” if the module doesn’t have a load_ipython_extension function, or None if it succeeded.
Reload an IPython extension by calling reload.
If the module has not been loaded before, InteractiveShell.load_extension() is called. Otherwise reload() is called and then the load_ipython_extension() function of the module, if it exists is called.
Unload an IPython extension by its module name.
This function looks up the extension’s name in sys.modules and simply calls mod.unload_ipython_extension(self).
Returns the string “no unload function” if the extension doesn’t define a function to unload itself, “not loaded” if the extension isn’t loaded, otherwise None.