Brussels / 31 January & 1 February 2015

schedule

python-prompt-toolkit / ptpython


Ptpython is a better Python REPL built on top of prompt-toolkit. In this talk we'll have a look at what pt(i)python is and how to use it. Further we'll have a look at the underlying library prompt-toolkit. We'll see how it works and how easy it is to create a custom REPL with syntax highlighting, code completion and input validation. (for instance to create an SQLite client.)

Prompt-toolkit is a library for designing command line interfaces. Basically, it can be a pure Python replacement for GNU readline: it implements most of the Emacs and Vi keybindings as well as reverse search and code completion and it supports double width characters. However, it can be even much more powerful. There is syntax highlighting of the input, multiline editing, support for toolbars, custom layouts, multiple input fields and integration with other event loops (e.g. asyncio).

In this talk we will see how easy it is to create a custom command line interface: it doesn't take more than a few lines of code. Further we'll see how to add input validation, code completion and other extensions, each without much effort.

We will also have a look at ptpython. This is a Python REPL build on top of this library. We have a look at several interesting features of ptpython which can make your REPL experience even better. And finally, there is ptipython, the front-end for IPython.

Speakers

Photo of Jonathan Slenders Jonathan Slenders

Links