##// END OF EJS Templates
Fix broken links on install/index.rst...
Fix broken links on install/index.rst Currently the links in the section summary on the index.rst/index.html file are broken. Can be reproduced by going to http://ipython.readthedocs.io/en/stable/install/index.html and clicking on *installing IPython itself*, or *kernels for Jupyter* links. Specific changes ---------------- * Added a reference label to the `install.rst` file * Modified links from external link format to Sphinx arbitrary location cross-referencing format in the `index.rst` file Testing ------- Changes have been tested with a local sphinx build through the supplied makefile and specific links touched are fixed. Tested a few possibly overlapping links (Jupyter:install for instance) and they seem to be unaffected by the change.

File last commit:

r22147:7fef958a
r22679:367c6fe3
Show More
integrating.rst
52 lines | 1.8 KiB | text/x-rst | RstLexer

Integrating your objects with IPython

Tab completion

To change the attributes displayed by tab-completing your object, define a __dir__(self) method for it. For more details, see the documentation of the built-in dir() function.

You can also customise key completions for your objects, e.g. pressing tab after obj["a. To do so, define a method _ipython_key_completions_(), which returns a list of objects which are possible keys in a subscript expression obj[key].

Rich display

The notebook and the Qt console can display richer representations of objects. To use this, you can define any of a number of _repr_*_() methods. Note that these are surrounded by single, not double underscores.

Both the notebook and the Qt console can display svg, png and jpeg representations. The notebook can also display html, javascript, and latex. If the methods don't exist, or return None, it falls back to a standard repr().

For example:

class Shout(object):
    def __init__(self, text):
        self.text = text

    def _repr_html_(self):
        return "<h1>" + self.text + "</h1>"

Custom exception tracebacks

Rarely, you might want to display a different traceback with an exception - IPython's own parallel computing framework does this to display errors from the engines. To do this, define a _render_traceback_(self) method which returns a list of strings, each containing one line of the traceback.

Please be conservative in using this feature; by replacing the default traceback you may hide important information from the user.