IPython 8.4.0 Pypi GitHub Homepage
Other Docs
BackRef

To remove in the future –– IPython.core.completer

Completion for IPython.

This module started as fork of the rlcompleter module in the Python standard library. The original enhancements made to rlcompleter have been sent upstream and were accepted as of Python 2.3,

This module now support a wide variety of completion mechanism both available for normal classic Python code, as well as completer for IPython specific Syntax like magics.

Latex and Unicode completion

IPython and compatible frontends not only can complete your code, but can help you to input a wide range of characters. In particular we allow you to insert a unicode character using the tab completion mechanism.

Forward latex/unicode completion

Forward completion allows you to easily type a unicode character using its latex name, or unicode long description. To do so type a backslash follow by the relevant name and press tab:

Using latex completion:

\alpha<tab>
α

or using unicode completion:

\GREEK SMALL LETTER ALPHA<tab>
α

Only valid Python identifiers will complete. Combining characters (like arrow or dots) are also available, unlike latex they need to be put after the their counterpart that is to say, F\\vec<tab> is correct, not \\vec<tab>F .

Some browsers are known to display combining characters incorrectly.

Backward latex completion

It is sometime challenging to know how to type a character, if you are using IPython, or any compatible frontend you can prepend backslash to the character and press <tab> to expand it to its latex form.

\α<tab>
\alpha

Both forward and backward completions can be deactivated by setting the Completer.backslash_combining_completions option to False .

Experimental

Starting with IPython 6.0, this module can make use of the Jedi library to generate completions both using static analysis of the code, and dynamically inspecting multiple namespaces. Jedi is an autocompletion and static analysis for Python. The APIs attached to this new mechanism is unstable and will raise unless use in an provisionalcompleter context manager.

You will find that the following are experimental:

note

better name for :None:any:`rectify_completions` ?

We welcome any feedback on these new API, and we also encourage you to try this module in debug mode (start IPython with --Completer.debug=True ) in order to have extra logging information if jedi is crashing, or if current IPython completer pending deprecations are returning results not yet handled by jedi

Using Jedi for tab completion allow snippets like the following to work without having to execute any code:

>>> myvar = ['hello', 42]
... myvar[1].bi<tab>

Tab completion will be able to infer that myvar[1] is a real number without executing any code unlike the previously available IPCompleter.greedy option.

Be sure to update jedi to the latest stable version or to try the current development version to get better completions.

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

IPython.core.interactiveshell.InteractiveShell.set_custom_completer

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /IPython/core/completer.py#0
type: <class 'module'>
Commit: