Important

This documentation covers IPython versions 6.0 and higher. Beginning with version 6.0, IPython stopped supporting compatibility with Python versions lower than 3.3 including all versions of Python 2.7.

If you are looking for an IPython version compatible with Python 2.7, please use the IPython 5.x LTS release and refer to its documentation (LTS is the long term support release).

Module: core.completerlib

Implementations for various useful completers.

These are all loaded by default by IPython.

11 Functions

IPython.core.completerlib.module_list(path: str) List[str]

Return the list containing the names of the modules available in the given folder.

IPython.core.completerlib.get_root_modules()

Returns a list containing the names of all the modules available in the folders of the pythonpath.

ip.db[‘rootmodules_cache’] maps sys.path entries to list of modules.

IPython.core.completerlib.is_importable(module, attr: str, only_modules) bool
IPython.core.completerlib.is_possible_submodule(module, attr)
IPython.core.completerlib.try_import(mod: str, only_modules=False) List[str]

Try to import given module and return list of potential completions.

IPython.core.completerlib.quick_completer(cmd, completions)

Easily create a trivial completer for a command.

Takes either a list of completions, or all completions in string (that will be split on whitespace).

Example:

[d:\ipython]|1> import ipy_completers
[d:\ipython]|2> ipy_completers.quick_completer('foo', ['bar','baz'])
[d:\ipython]|3> foo b<TAB>
bar baz
[d:\ipython]|3> foo ba
IPython.core.completerlib.module_completion(line)

Returns a list containing the completion possibilities for an import line.

The line looks like this : ‘import xml.d’ ‘from xml.dom import’

IPython.core.completerlib.module_completer(self, event)

Give completions after user has typed ‘import …’ or ‘from …’

IPython.core.completerlib.magic_run_completer(self, event)

Complete files that end in .py or .ipy or .ipynb for the %run command.

IPython.core.completerlib.cd_completer(self, event)

Completer function for cd, which only returns directories.

IPython.core.completerlib.reset_completer(self, event)

A completer for %reset magic