### Navigation

- index
- modules |
- next |
- previous |
- home|
- search|
- documentation »
- The IPython API »

# core.magics.extension

## Module: `core.magics.extension`

Inheritance diagram for `IPython.core.magics.extension`:

Implementation of magic functions for the extension machinery.

## `ExtensionMagics`

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

  Bases: `IPython.core.magic.Magics`

  Magics to manage the IPython extensions system.

  `__init__`(shell)
  `arg_err`(func)

    Print docstring if incorrect arguments were passed

  `default_option`(fn, optstr)

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

  `format_latex`(strng)

    Format a string for latex inclusion.

  `install_ext`(parameter_s='')

    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.

    Parameters:

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

  `load_ext`(module_str)

    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.

    Options:

      -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_ext`(module_str)

    Reload an IPython extension by its module name.

  `shell` = None
  `unload_ext`(module_str)

    Unload an IPython extension by its module name.

### Navigation

- index
- modules |
- next |
- previous |
- home|
- search|
- documentation »
- The IPython API »