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: terminal.interactiveshell

IPython terminal interface using prompt_toolkit

1 Class

class IPython.terminal.interactiveshell.TerminalInteractiveShell(**kwargs: Any)

Bases: InteractiveShell

__init__(*args, **kwargs)

Create a configurable given a config config.

Parameters:
  • config (Config) – If this is empty, default values are used. If config is a Config instance, it will be used to configure the instance.

  • parent (Configurable instance, optional) – The parent Configurable instance of this object.

Notes

Subclasses of Configurable must call the __init__() method of Configurable before doing anything else and using super():

class MyConfigurable(Configurable):
    def __init__(self, config=None):
        super(MyConfigurable, self).__init__(config=config)
        # Then any other code you need to finish initialization.

This ensures that instances will be configured properly.

auto_rewrite_input(cmd)

Overridden from the parent class to use fancy rewriting prompt

autoformatter

Autoformatter to reformat Terminal code. Can be 'black' or None

confirm_exit

Set to confirm when you try to exit IPython with an EOF (Control-D in Unix, Control-Z/Enter in Windows). By typing ‘exit’ or ‘quit’, you can force a direct exit without any confirmation.

property debugger_cls

Version of debugger where KeyboardInterrupt exits the debugger altogether.

display_completions

Options for displaying tab completions, ‘column’, ‘multicolumn’, and ‘readlinelike’. These options are for prompt_toolkit, see prompt_toolkit documentation for more information.

editing_mode

Shortcut style to use at the prompt. ‘vi’ or ‘emacs’.

editor

Set the editor used by IPython (default to $EDITOR/vi/notepad).

Allows to enable/disable the prompt toolkit history search

extra_open_editor_shortcuts

Enable vi (v) or Emacs (C-X C-E) shortcuts to open an external editor. This is in addition to the F2 binding, which is always enabled.

handle_return

Provide an alternative handler to be called when the user presses Return. This is an advanced option intended for debugging, which may be changed or removed in later releases.

highlight_matching_brackets

Highlight matching brackets.

highlighting_style

The name or class of a Pygments style to use for syntax highlighting. To see available styles, run pygmentize -L styles.

highlighting_style_overrides

Override highlighting format for specific tokens

mouse_support

Enable mouse support in the prompt (Note: prevents selecting text with the mouse)

prompt_includes_vi_mode

Display the current vi mode (when using vi editing mode).

prompts_class

Class used to generate Prompt token for prompt_toolkit

simple_prompt

Use raw_input for the REPL, without completion and prompt colors.

Useful when controlling IPython as a subprocess, and piping STDIN/OUT/ERR. Known usage are: IPython own testing machinery, and emacs inferior-shell integration through elpy.

This mode default to True if the IPY_TEST_SIMPLE_PROMPT environment variable is set, or the current terminal is not a tty.

space_for_menu

Number of line at the bottom of the screen to reserve for the tab completion menu, search history, …etc, the height of these menus will at most this value. Increase it is you prefer long and skinny menus, decrease for short and wide.

switch_doctest_mode(mode)

Switch prompts to classic for %doctest_mode

system(cmd)

Call the given cmd in a subprocess using os.system on Windows or subprocess.call using the system shell on other platforms.

Parameters:

cmd (str) – Command to execute.

term_title

Automatically set the terminal title

term_title_format

{cwd}.

Type:

Customize the terminal title format. This is a python format string. Available substitutions are

true_color

printf “x1b[38;2;255;100;0mTRUECOLORx1b[0mn”

Type:

Use 24bit colors instead of 256 colors in prompt highlighting. If your terminal supports true color, the following command should print ‘TRUECOLOR’ in orange

2 Functions

IPython.terminal.interactiveshell.get_default_editor()
IPython.terminal.interactiveshell.black_reformat_handler(text_before_cursor)