Prompt Toolkit 2 Shell (

The prompt_toolkit based xonsh shell.


The xonsh shell for prompt_toolkit v2.


Returns a list of (token, str) tuples for the current bottom toolbar.

cmdloop(self, intro=None)[source]

Enters a loop that reads and execute input from user.


Returns the current color map.


Returns an iterable of all available style names.

compile(self, src)

Compiles source code and returns the (possibly modified) source and a valid code object.

continuation_tokens(self, width, line_number, is_soft_wrap=False)[source]

Displays dots in multiline prompt

default(self, line)

Implements code execution.


Called when an empty line has been entered.

format_color(self, string, hide=False, force_string=False, **kwargs)[source]

Formats a color string using Pygments. This, therefore, returns a list of (Token, str) tuples. If force_string is set to true, though, this will return a color formatted string.

precmd(self, line)

Called just before execution of line.

print_color(self, string, end='n', **kwargs)[source]

Prints a color string using prompt-toolkit color management.


Returns a list of (token, str) tuples for the current prompt.

push(self, line)

Pushes a line onto the buffer and compiles the code in a way that enables multiline input.


Resets the line buffer.


An interface for resetting the TTY stdin mode. This is highly dependent on the shell backend. Also it is mostly optional since it only affects ^Z backgrounding behaviour.


Returns a list of (token, str) tuples for the current right prompt.


Sets terminal title.

singleline(self, auto_suggest=None, enable_history_search=True, multiline=True, **kwargs)[source]

Reads a single line of input from the shell. The store_in_history kwarg flags whether the input should be stored in PTK’s in-memory history.

completion_displays_to_styles = {'multi': 'MULTI_COLUMN', 'none': None, 'readline': 'READLINE_LIKE', 'single': 'COLUMN'}

Obtains the current prompt string.