About
The Python REPL (read-execute-print loop, what you get when you just type python3
) sure is useful, but it's also limiting, especially when you want to go back and tweak a fragment and re-run it.
Creating a temporary program with your favourite editor fixes this, and gets you other advantages like code highlighting. But this requires repetitive set-up, needs an another terminal to run the program, and clutters your filesystem with temporary Python programs.
Enter vpy:
vpy spawns a tmux session with two panes, and runs your favourite editor in the top pane. You can start editing straight away, and whenever you save, vpy runs the snippet in the bottom pane, giving you immediate feedback.
When you're done, just quit the editor, and vpy closes tmux and cleans everything up. No lingering files.
Wrote something, and want to save it after all? Just save the snippet as a different filename (e.g. :w foo.py
in vim).
Download & Installation
vpy is a self-contained simple shell script with only one real dependency: tmux. It runs $EDITOR
for the editor, and it obviously needs Python. Just put the script somewhere in your $PATH
, and it should work.
vpy is not in public source control, but you can grab it here.