For a few months when I first started developing with python I was using ipython for all of my REPL needs for python. At the time nothing really competed with ipython.
However I had a few gripes:
- Multiline editing and history was non-existent (If you defined a function, good luck re-editing it)
- Auto-completion didn’t function like most text editors do, with completion showing a pop-up of all available options
- Pulling code in the REPL into a text editor was spotty at best
So imagine my surprise when I found a little python REPL named ptpython courtesy of reddit’s own /r/python
I am gonna go over some of my favorite features of ptpython and why it is my daily driver for all of my python REPL needs.
This is the first feature that really drew me to ptpython. The ability to edit multiple lines is a feature so good it’ll make you wonder why no other interpreter had done it before.
The history browser is a killer feature that I use everyday. It can be used to pick and choose code you have entered before to include into your current session. It is also searchable and, with recent updates, is very fast.
Autocompletion and Documentation Popups
This is another killer feature which I don’t think I could live without now. The idea behind popup autocompletion is amazing. It allows you to see all of your options without you having to hit >TAB multiple times.
Ptpython allows you to pull code from the interpreter into your own $EDITOR and then put it back into the interpreter without altering all too much in between. It’s really an intuitive process and makes code that is a little hard to edit in the interpreter, that much easier to bring into a real text editor like VIM.
Ptpython is great, it really is. The people who made it really care about having features that positively affect your workflow and they try to make it easy to for you to get things done quicker.
Some features that I didn’t go over here but that are awesome in their own right:
- Custom keybinds
- For example I have a keybind to import a statement that allows logging to the terminal.
- Different colorschemes!
- Complete while typing
Oh it also includes a
ptipython mode so if you need any of ipython’s features you can use that as well! The best of both worlds!
Why ptpython is the only REPL you will ever need from Python