I’ve mostly finished up work on an alternative frontend for bpython - it’s
installable with (updated)
pip install bpython[curtsies]
bpython-curtsies is bpython with native terminal scrolling:
It also has send-to-editor (F7 by default) and an improved version of
good old bpython rewind:
raw_input prompts are saved so they don’t need
to be entered again, and a new environment is used instead of the old one,
so variable bindings are actually undone.
Since it’s not limited to keys curses can detect, there are more keybinds:
Curtsies is a terminal wrapper I’ll write more about in another post.
Build your own lightsaber
Having rewriten so much of the code, there’s very low overhead for me to add new features. A few weeks ago I added the ability to edit the current REPL session in an external editor, and used the feature a ton that day while answering questions some Hacker Schoolers had reading the excellent Python Essential Reference1.
Sam Aaron, creator of Overtone and Emacs Live, advocated building one’s own tools in a talk I listened to the other day. I’m referencing him mostly because I wanted to use this section title. As he suggests, I’ve found using a tool I created daily rewarding and powerful. I’ve added other features on a whim that aren’t in the current pull request:
- vim-style abbreviations:
- automatic import (try to import libraries when name errors occur)
- upload to Online Python Tutor (available as a standalone pastebin helper)
- Demo mode: display of what key was just pressed, and scripts that play back bpython sessions key by key
- Features specific to the Python turtle graphics library, including better undo.
These features may not belong in bpython, but at various times they’ve been useful to me.
If I were to write another REPL, I might just write it from scratch, but it’s exciting that my work might be used by the existing bpython user base, and the framework provided by the existing code and feature set was helpful in structuring and scoping the project.