##// END OF EJS Templates
Merge pull request #4532 from takluyver/sphinx-1.2-dynamic-metaclasses...
Merge pull request #4532 from takluyver/sphinx-1.2-dynamic-metaclasses Hide dynamically defined metaclass base from Sphinx.

File last commit:

r12298:d9eedc8c
r13588:8b7876b5 merge
Show More
index.rst
86 lines | 2.9 KiB | text/x-rst | RstLexer
Brian Granger
Adding new docs for configuration/extensions/plugins.
r2749 .. _extensions_overview:
==================
IPython extensions
==================
Thomas Kluyver
Rework extension docs
r7624 A level above configuration are IPython extensions, Python modules which modify
the behaviour of the shell. They are referred to by an importable module name,
and can be placed anywhere you'd normally import from, or in
``$IPYTHONDIR/extensions/``.
Getting extensions
==================
A few important extensions are :ref:`bundled with IPython <bundled_extensions>`.
Others can be found on the `extensions index
Benjamin Jones
Update link to extensions index
r10258 <https://github.com/ipython/ipython/wiki/Extensions-Index>`_ on the wiki, and installed with
Thomas Kluyver
Rework extension docs
r7624 the ``%install_ext`` magic function.
Using extensions
================
To load an extension while IPython is running, use the ``%load_ext`` magic:
.. sourcecode:: ipython
In [1]: %load_ext myextension
To load it each time IPython starts, list it in your configuration file::
c.InteractiveShellApp.extensions = [
'myextension'
]
Writing extensions
==================
An IPython extension is an importable Python module that has a couple of special
functions to load and unload it. Here is a template::
Brian Granger
Adding new docs for configuration/extensions/plugins.
r2749
# myextension.py
def load_ipython_extension(ipython):
Thomas Kluyver
Rework extension docs
r7624 # The `ipython` argument is the currently active `InteractiveShell`
# instance, which can be used in any way. This allows you to register
Brian Granger
Cleaning up extensions that used plugins.
r8197 # new magics or aliases, for example.
Brian Granger
Adding new docs for configuration/extensions/plugins.
r2749
def unload_ipython_extension(ipython):
# If you want your extension to be unloadable, put that logic here.
This :func:`load_ipython_extension` function is called after your extension is
Thomas Kluyver
Rework extension docs
r7624 imported, and the currently active :class:`~IPython.core.interactiveshell.InteractiveShell`
instance is passed as the only argument. You can do anything you want with
IPython at that point.
Brian Granger
Adding new docs for configuration/extensions/plugins.
r2749
Thomas Kluyver
Rework extension docs
r7624 :func:`load_ipython_extension` will be called again if you load or reload
Brian Granger
Adding new docs for configuration/extensions/plugins.
r2749 the extension again. It is up to the extension author to add code to manage
that.
Thomas Kluyver
Update extension docs with new method for defining magic functions.
r12298 Useful :class:`InteractiveShell` methods include :meth:`~IPython.core.interactiveshell.InteractiveShell.register_magic_function`,
Thomas Kluyver
Improve documentation for extensions, and for storemagic extension.
r5426 :meth:`~IPython.core.interactiveshell.InteractiveShell.push` (to add variables to the user namespace) and
:meth:`~IPython.core.interactiveshell.InteractiveShell.drop_by_id` (to remove variables on unloading).
Brian Granger
Adding new docs for configuration/extensions/plugins.
r2749 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
Thomas Kluyver
Rework extension docs
r7624 ``os.path.join(ip.ipython_dir, 'extensions')``. This directory is added to
Brian Granger
Adding new docs for configuration/extensions/plugins.
r2749 ``sys.path`` automatically.
Thomas Kluyver
Rework extension docs
r7624 When your extension is ready for general use, please add it to the `extensions
Benjamin Jones
Update link to extensions index
r10258 index <https://github.com/ipython/ipython/wiki/Extensions-Index>`_.
Brian Granger
Adding new docs for configuration/extensions/plugins.
r2749
Thomas Kluyver
Rework extension docs
r7624 .. _bundled_extensions:
Pauli Virtanen
DOC: extensions: add documentation for the bundled extensions
r4888
Extensions bundled with IPython
===============================
.. toctree::
:maxdepth: 1
autoreload
Brian Granger
More code review changes:...
r7102 cythonmagic
Fernando Perez
Add new screenshots for release notes.x
r7765 octavemagic
Fernando Perez
Add R magic to the docs.
r7304 rmagic
Thomas Kluyver
Improve documentation for extensions, and for storemagic extension.
r5426 storemagic
Pauli Virtanen
DOC: extensions: add documentation for the bundled extensions
r4888 sympyprinting