IPython Documentation

Table Of Contents

Previous topic


Next topic


This Page


Module: core.magics.extension

Inheritance diagram for IPython.core.magics.extension:

Implementation of magic functions for the extension machinery.


class IPython.core.magics.extension.ExtensionMagics(shell)

Bases: IPython.core.magic.Magics

Magics to manage the IPython extensions system.


Print docstring if incorrect arguments were passed

default_option(fn, optstr)

Make an entry in the options_table for fn, with value optstr


Format a string for latex inclusion.


Download and install an extension from a URL, e.g.:

%install_ext https://bitbucket.org/birkenfeld/ipython-physics/raw/d1310a2ab15d/physics.py

The URL should point to an importable Python module - either a .py file or a .zip file.


-n filename : Specify a name for the file, rather than taking it from
the URL.

Load an IPython extension by its module name.

magics = {'cell': {}, 'line': {'load_ext': 'load_ext', 'reload_ext': 'reload_ext', 'install_ext': 'install_ext', 'unload_ext': 'unload_ext'}}
options_table = None
parse_options(arg_str, opt_str, *long_opts, **kw)

Parse options passed to an argument string.

The interface is similar to that of getopt(), but it returns back a Struct with the options as keys and the stripped argument string still as a string.

arg_str is quoted as a true sys.argv vector by using shlex.split. This allows us to easily expand variables, glob files, quote arguments, etc.


-mode: default ‘string’. If given as ‘list’, the argument string is returned as a list (split on whitespace) instead of a string.

-list_all: put all option values in lists. Normally only options appearing more than once are put in a list.

-posix (True): whether to split the input line in POSIX mode or not, as per the conventions outlined in the shlex module from the standard library.

registered = True

Reload an IPython extension by its module name.

shell = None

Unload an IPython extension by its module name.