• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

docs/H26-Nov-2021-5,5233,839

examples/H26-Nov-2021-6,6154,911

prompt_toolkit/H07-May-2022-39,85430,106

prompt_toolkit.egg-info/H03-May-2022-182132

tests/H26-Nov-2021-3,1452,104

tools/H26-Nov-2021-3321

.codecov.ymlH A D12-Jan-202013 21

.gitignoreH A D19-Jan-2021423 4737

.travis.ymlH A D19-Jan-2021773 3626

AUTHORS.rstH A D12-Jan-2020148 128

CHANGELOGH A D26-Nov-202170.5 KiB1,9261,538

LICENSEH A D12-Jan-20201.5 KiB2822

MANIFEST.inH A D12-Jan-2020133 54

PKG-INFOH A D26-Nov-20218.1 KiB182132

PROJECTS.rstH A D07-Oct-20214.8 KiB6858

README.rstH A D19-Jan-20215.9 KiB158109

appveyor.ymlH A D12-Jan-2020997 4636

mypy.iniH A D19-Aug-2021487 2119

pyproject.tomlH A D06-Mar-2020296 1411

setup.cfgH A D26-Nov-2021358 4541

setup.pyH A D12-Oct-20212.3 KiB6141

tox.iniH A D12-Jan-2020352 1410

README.rst

1Python Prompt Toolkit
2=====================
3
4|Build Status|  |AppVeyor|  |PyPI|  |RTD|  |License|  |Codecov|
5
6.. image :: https://github.com/prompt-toolkit/python-prompt-toolkit/raw/master/docs/images/logo_400px.png
7
8``prompt_toolkit`` *is a library for building powerful interactive command line applications in Python.*
9
10Read the `documentation on readthedocs
11<http://python-prompt-toolkit.readthedocs.io/en/stable/>`_.
12
13NOTICE: prompt_toolkit 3.0
14**************************
15
16Please notice that this branch is the ``prompt_toolkit`` **3.0** branch. For most
17users, it should be compatible with ``prompt_toolkit`` **2.0**, but it requires at
18least **Python 3.6**. On the plus side, ``prompt_toolkit`` **3.0** is completely type
19annotated and uses asyncio natively.
20
21
22Gallery
23*******
24
25`ptpython <http://github.com/prompt-toolkit/ptpython/>`_ is an interactive
26Python Shell, build on top of ``prompt_toolkit``.
27
28.. image :: https://github.com/prompt-toolkit/python-prompt-toolkit/raw/master/docs/images/ptpython.png
29
30`More examples <https://python-prompt-toolkit.readthedocs.io/en/stable/pages/gallery.html>`_
31
32
33prompt_toolkit features
34***********************
35
36``prompt_toolkit`` could be a replacement for `GNU readline
37<https://tiswww.case.edu/php/chet/readline/rltop.html>`_, but it can be much
38more than that.
39
40Some features:
41
42- **Pure Python**.
43- Syntax highlighting of the input while typing. (For instance, with a Pygments lexer.)
44- Multi-line input editing.
45- Advanced code completion.
46- Both Emacs and Vi key bindings. (Similar to readline.)
47- Even some advanced Vi functionality, like named registers and digraphs.
48- Reverse and forward incremental search.
49- Works well with Unicode double width characters. (Chinese input.)
50- Selecting text for copy/paste. (Both Emacs and Vi style.)
51- Support for `bracketed paste <https://cirw.in/blog/bracketed-paste>`_.
52- Mouse support for cursor positioning and scrolling.
53- Auto suggestions. (Like `fish shell <http://fishshell.com/>`_.)
54- Multiple input buffers.
55- No global state.
56- Lightweight, the only dependencies are Pygments and wcwidth.
57- Runs on Linux, OS X, FreeBSD, OpenBSD and Windows systems.
58- And much more...
59
60Feel free to create tickets for bugs and feature requests, and create pull
61requests if you have nice patches that you would like to share with others.
62
63
64Installation
65************
66
67::
68
69    pip install prompt_toolkit
70
71For Conda, do:
72
73::
74
75    conda install -c https://conda.anaconda.org/conda-forge prompt_toolkit
76
77
78About Windows support
79*********************
80
81``prompt_toolkit`` is cross platform, and everything that you build on top
82should run fine on both Unix and Windows systems. Windows support is best on
83recent Windows 10 builds, for which the command line window supports vt100
84escape sequences. (If not supported, we fall back to using Win32 APIs for color
85and cursor movements).
86
87It's worth noting that the implementation is a "best effort of what is
88possible". Both Unix and Windows terminals have their limitations. But in
89general, the Unix experience will still be a little better.
90
91For Windows, it's recommended to use either `cmder
92<http://cmder.net/>`_ or `conemu <https://conemu.github.io/>`_.
93
94Getting started
95***************
96
97The most simple example of the library would look like this:
98
99.. code:: python
100
101    from prompt_toolkit import prompt
102
103    if __name__ == '__main__':
104        answer = prompt('Give me some input: ')
105        print('You said: %s' % answer)
106
107For more complex examples, have a look in the ``examples`` directory. All
108examples are chosen to demonstrate only one thing. Also, don't be afraid to
109look at the source code. The implementation of the ``prompt`` function could be
110a good start.
111
112Philosophy
113**********
114
115The source code of ``prompt_toolkit`` should be **readable**, **concise** and
116**efficient**. We prefer short functions focusing each on one task and for which
117the input and output types are clearly specified. We mostly prefer composition
118over inheritance, because inheritance can result in too much functionality in
119the same object. We prefer immutable objects where possible (objects don't
120change after initialization). Reusability is important. We absolutely refrain
121from having a changing global state, it should be possible to have multiple
122independent instances of the same code in the same process. The architecture
123should be layered: the lower levels operate on primitive operations and data
124structures giving -- when correctly combined -- all the possible flexibility;
125while at the higher level, there should be a simpler API, ready-to-use and
126sufficient for most use cases. Thinking about algorithms and efficiency is
127important, but avoid premature optimization.
128
129
130`Projects using prompt_toolkit <PROJECTS.rst>`_
131***********************************************
132
133Special thanks to
134*****************
135
136- `Pygments <http://pygments.org/>`_: Syntax highlighter.
137- `wcwidth <https://github.com/jquast/wcwidth>`_: Determine columns needed for a wide characters.
138
139.. |Build Status| image:: https://api.travis-ci.org/prompt-toolkit/python-prompt-toolkit.svg?branch=master
140    :target: https://travis-ci.org/prompt-toolkit/python-prompt-toolkit#
141
142.. |PyPI| image:: https://img.shields.io/pypi/v/prompt_toolkit.svg
143    :target: https://pypi.python.org/pypi/prompt-toolkit/
144    :alt: Latest Version
145
146.. |AppVeyor| image:: https://ci.appveyor.com/api/projects/status/32r7s2skrgm9ubva?svg=true
147    :target: https://ci.appveyor.com/project/prompt-toolkit/python-prompt-toolkit/
148
149.. |RTD| image:: https://readthedocs.org/projects/python-prompt-toolkit/badge/
150    :target: https://python-prompt-toolkit.readthedocs.io/en/master/
151
152.. |License| image:: https://img.shields.io/github/license/prompt-toolkit/python-prompt-toolkit.svg
153    :target: https://github.com/prompt-toolkit/python-prompt-toolkit/blob/master/LICENSE
154
155.. |Codecov| image:: https://codecov.io/gh/prompt-toolkit/python-prompt-toolkit/branch/master/graphs/badge.svg?style=flat
156    :target: https://codecov.io/gh/prompt-toolkit/python-prompt-toolkit/
157
158