##// END OF EJS Templates
Add option to %autoreload to hide errors when reloading code
Add option to %autoreload to hide errors when reloading code

File last commit:

r28129:fc3b5250
r28273:998efb1a
Show More
index.rst
99 lines | 3.6 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,
Matthias Bussonnier
Remove deprecated install_ext and ~/.ipython/extensions...
r27767 and can be placed anywhere you'd normally import from.
Thomas Kluyver
Rework extension docs
r7624
Getting extensions
==================
A few important extensions are :ref:`bundled with IPython <bundled_extensions>`.
Others can be found on the `extensions index
Thomas Kluyver
Describe using PyPI/pip to distribute & install extensions...
r16474 <https://github.com/ipython/ipython/wiki/Extensions-Index>`_ on the wiki, and
the `Framework :: IPython tag <https://pypi.python.org/pypi?:action=browse&c=586>`_
on PyPI.
Extensions on PyPI can be installed using ``pip``, like any other Python package.
Thomas Kluyver
Rework extension docs
r7624
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
Zach Rottman
Fix typos in docs
r28129 :func:`load_ipython_extension` will not be called again if the users use
`%load_extension`. The user has to explicitly ask the extension to be
reloaded (with `%reload_extension`). In cases where the user asks the extension to
be reloaded, the extension will be unloaded (with
Matthias Bussonnier
fix doc on extension loading
r21614 `unload_ipython_extension`), and loaded again.
Brian Granger
Adding new docs for configuration/extensions/plugins.
r2749
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).
Thomas Kluyver
Polishing some docs
r15104 .. seealso::
:ref:`defining_magics`
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
Matthias Bussonnier
Remove deprecated install_ext and ~/.ipython/extensions...
r27767 imported by Python's standard import mechanism.
Brian Granger
Adding new docs for configuration/extensions/plugins.
r2749
Thomas Kluyver
Rework extension docs
r7624 When your extension is ready for general use, please add it to the `extensions
Thomas Kluyver
Describe using PyPI/pip to distribute & install extensions...
r16474 index <https://github.com/ipython/ipython/wiki/Extensions-Index>`_. We also
encourage you to upload it to PyPI and use the ``Framework :: IPython``
classifier, so that users can install it with standard packaging tools.
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
Thomas Kluyver
Improve documentation for extensions, and for storemagic extension.
r5426 storemagic
Thomas Kluyver
Remove the octavemagic extension....
r16163
Thomas Kluyver
Fix some broken links in the docs
r23220 * ``octavemagic`` used to be bundled, but is now part of `oct2py <https://blink1073.github.io/oct2py/>`_.
Thomas Kluyver
Remove the octavemagic extension....
r16163 Use ``%load_ext oct2py.ipython`` to load it.
Thomas Kluyver
Remove rmagic docs...
r17608 * ``rmagic`` is now part of `rpy2 <http://rpy.sourceforge.net/>`_. Use
``%load_ext rpy2.ipython`` to load it, and see :mod:`rpy2.ipython.rmagic` for
details of how to use it.
Doug Blank
Update index.rst...
r19954 * ``cythonmagic`` used to be bundled, but is now part of `cython <https://github.com/cython/cython/>`_
Matthias Bussonnier
add whatsnew and uppercase C in load_ext...
r17915 Use ``%load_ext Cython`` to load it.
Thomas Kluyver
Remove docs for deprecated extensions...
r21573 * ``sympyprinting`` used to be a bundled extension, but you should now use
:func:`sympy.init_printing` instead.