prompt-toolkit 3.0.51


pip install prompt-toolkit

  Latest version

Released: Apr 15, 2025

Project Links

Meta
Author: Jonathan Slenders
Requires Python: >=3.8

Classifiers

Development Status
  • 5 - Production/Stable

Intended Audience
  • Developers

License
  • OSI Approved :: BSD License

Operating System
  • OS Independent

Programming Language
  • Python :: 3
  • Python :: 3.8
  • Python :: 3.9
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3 :: Only
  • Python

Topic
  • Software Development

AppVeyor Latest Version RTD License Codecov

https://github.com/prompt-toolkit/python-prompt-toolkit/raw/master/docs/images/logo_400px.png

prompt_toolkit is a library for building powerful interactive command line applications in Python.

Read the documentation on readthedocs.

prompt_toolkit features

prompt_toolkit could be a replacement for GNU readline, but it can be much more than that.

Some features:

  • Pure Python.

  • Syntax highlighting of the input while typing. (For instance, with a Pygments lexer.)

  • Multi-line input editing.

  • Advanced code completion.

  • Both Emacs and Vi key bindings. (Similar to readline.)

  • Even some advanced Vi functionality, like named registers and digraphs.

  • Reverse and forward incremental search.

  • Works well with Unicode double width characters. (Chinese input.)

  • Selecting text for copy/paste. (Both Emacs and Vi style.)

  • Support for bracketed paste.

  • Mouse support for cursor positioning and scrolling.

  • Auto suggestions. (Like fish shell.)

  • Multiple input buffers.

  • No global state.

  • Lightweight, the only dependencies are Pygments and wcwidth.

  • Runs on Linux, OS X, FreeBSD, OpenBSD and Windows systems.

  • And much more…

Feel free to create tickets for bugs and feature requests, and create pull requests if you have nice patches that you would like to share with others.

Installation

pip install prompt_toolkit

For Conda, do:

conda install -c https://conda.anaconda.org/conda-forge prompt_toolkit

About Windows support

prompt_toolkit is cross platform, and everything that you build on top should run fine on both Unix and Windows systems. Windows support is best on recent Windows 10 builds, for which the command line window supports vt100 escape sequences. (If not supported, we fall back to using Win32 APIs for color and cursor movements).

It’s worth noting that the implementation is a “best effort of what is possible”. Both Unix and Windows terminals have their limitations. But in general, the Unix experience will still be a little better.

Getting started

The most simple example of the library would look like this:

from prompt_toolkit import prompt

if __name__ == '__main__':
    answer = prompt('Give me some input: ')
    print('You said: %s' % answer)

For more complex examples, have a look in the examples directory. All examples are chosen to demonstrate only one thing. Also, don’t be afraid to look at the source code. The implementation of the prompt function could be a good start.

Philosophy

The source code of prompt_toolkit should be readable, concise and efficient. We prefer short functions focusing each on one task and for which the input and output types are clearly specified. We mostly prefer composition over inheritance, because inheritance can result in too much functionality in the same object. We prefer immutable objects where possible (objects don’t change after initialization). Reusability is important. We absolutely refrain from having a changing global state, it should be possible to have multiple independent instances of the same code in the same process. The architecture should be layered: the lower levels operate on primitive operations and data structures giving – when correctly combined – all the possible flexibility; while at the higher level, there should be a simpler API, ready-to-use and sufficient for most use cases. Thinking about algorithms and efficiency is important, but avoid premature optimization.

Projects using prompt_toolkit

Special thanks to

  • Pygments: Syntax highlighter.

  • wcwidth: Determine columns needed for a wide characters.

3.0.51 Apr 15, 2025
3.0.50 Jan 20, 2025
3.0.49 Jan 20, 2025
3.0.48 Sep 25, 2024
3.0.47 Jun 10, 2024
3.0.46 Jun 04, 2024
3.0.45 May 28, 2024
3.0.44 May 27, 2024
3.0.43 Dec 13, 2023
3.0.42 Dec 12, 2023
3.0.41 Nov 14, 2023
3.0.40 Nov 10, 2023
3.0.39 Jul 04, 2023
3.0.38 Feb 28, 2023
3.0.37 Feb 21, 2023
3.0.36 Dec 06, 2022
3.0.35 Dec 06, 2022
3.0.34 Dec 06, 2022
3.0.33 Nov 21, 2022
3.0.32 Nov 03, 2022
3.0.31 Sep 02, 2022
3.0.30 Jun 27, 2022
3.0.29 Apr 04, 2022
3.0.28 Feb 11, 2022
3.0.27 Feb 07, 2022
3.0.26 Jan 27, 2022
3.0.25 Jan 27, 2022
3.0.24 Dec 09, 2021
3.0.23 Nov 26, 2021
3.0.22 Nov 04, 2021
3.0.21 Oct 21, 2021
3.0.20 Aug 20, 2021
3.0.19 Jun 17, 2021
3.0.18 Mar 22, 2021
3.0.17 Mar 11, 2021
3.0.16 Feb 11, 2021
3.0.15 Feb 10, 2021
3.0.14 Jan 24, 2021
3.0.13 Jan 22, 2021
3.0.12 Jan 22, 2021
3.0.11 Jan 20, 2021
3.0.10 Jan 08, 2021
3.0.9 Jan 05, 2021
3.0.8 Oct 12, 2020
3.0.7 Aug 29, 2020
3.0.6 Aug 10, 2020
3.0.5 Mar 26, 2020
3.0.4 Mar 06, 2020
3.0.3 Jan 26, 2020
3.0.2 Nov 30, 2019
3.0.1 Nov 28, 2019
3.0.0 Nov 24, 2019
2.0.10 Oct 03, 2019
2.0.9 Feb 19, 2019
2.0.8 Jan 27, 2019
2.0.7 Oct 30, 2018
2.0.6 Oct 12, 2018
2.0.5 Sep 30, 2018
2.0.4 Jul 22, 2018
2.0.3 Jun 08, 2018
2.0.2 Jun 03, 2018
2.0.1 Jun 02, 2018
1.0.18 Oct 03, 2019
1.0.17 Oct 03, 2019
1.0.16 Apr 12, 2019
1.0.15 Jul 27, 2017
1.0.14 Mar 26, 2017
1.0.13 Feb 02, 2017
1.0.10 Jan 30, 2017
1.0.9 Nov 07, 2016
1.0.8 Oct 16, 2016
1.0.7 Aug 21, 2016
1.0.6 Aug 15, 2016
1.0.5 Aug 04, 2016
1.0.4 Aug 03, 2016
1.0.3 Jun 20, 2016
1.0.2 Jun 16, 2016
1.0.1 Jun 15, 2016
1.0.0 May 05, 2016
0.60 Mar 14, 2016
0.59 Feb 27, 2016
0.58 Feb 23, 2016
0.57 Jan 04, 2016
0.56 Jan 03, 2016
0.55 Jan 03, 2016
0.54 Oct 29, 2015
0.53 Oct 05, 2015
0.52 Sep 23, 2015
0.51 Sep 23, 2015
0.50 Sep 05, 2015
0.49 Sep 05, 2015
0.48 Sep 02, 2015
0.47 Aug 19, 2015
0.46 Aug 08, 2015
0.45 Jul 30, 2015
0.44 Jul 30, 2015
0.43 Jul 15, 2015
0.42 Jun 25, 2015
0.41 Jun 20, 2015
0.40 Jun 15, 2015
0.39 Jun 04, 2015
0.38 May 31, 2015
0.37 May 11, 2015
0.36 May 09, 2015
0.35 May 07, 2015
0.34 Apr 26, 2015
0.33 Apr 25, 2015
0.32 Apr 21, 2015
0.31 Jan 30, 2015
0.30 Jan 26, 2015
0.28 Jan 25, 2015
0.26 Jan 08, 2015
0.25 Dec 11, 2014
0.23 Nov 28, 2014
0.22 Nov 09, 2014
0.21 Oct 25, 2014
0.20 Oct 04, 2014
0.19 Sep 30, 2014
0.18 Sep 30, 2014
0.17 Sep 29, 2014
0.16 Sep 29, 2014
0.15 Sep 26, 2014
0.14 Sep 24, 2014
0.13 Sep 19, 2014
0.12 Sep 18, 2014
0.11 Sep 16, 2014
0.10 Sep 12, 2014
0.9 Sep 09, 2014
0.8 Sep 05, 2014
0.6 Sep 03, 2014
0.5 Aug 29, 2014
0.4 Aug 27, 2014
0.3 Aug 26, 2014
0.2 Aug 26, 2014
0.1 Aug 01, 2014

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras: None
Dependencies:
wcwidth