Python developers have their choice of shells – command-line interpreters that let you write Python code and execute it immediately. Israeli developer Noam Yorav-Raphael used IDLE, the graphical shell shipped with Python, for many years, and even contributed to its code. But IDLE was originally created to run as a single process, so the client-server model was “quite hacky,” he says, and it was written using the outdated TkInter GUI toolkit. Yorav-Raphael decided that writing a new shell was the way to go.
“I started to gather ideas for a new shell in the summer of 2007, started writing it in the summer of 2008 (so I had a working but not really usable shell), worked on it again in the summer of 2009 (which made it actually usable), and added some cool features in the end of 2009. I released the first public version of DreamPie in February 2010.” Today he released the latest version.
Unlike some other Python shells, DreamPie is a GUI application, so you can use your mouse and keyboard with it in a familiar way. The process that handles the GUI and the process that executes your code are separate, so you can stop whatever you’re doing and the program keeps running. This also allows you to use other Python implementations, such as Jython and IronPython, under the same user interface. DreamPie gives you separate areas for entering code and viewing the results, so you can easily edit any amount of code before executing it. You can save your history to HTML files and load it back, so you can see how you reached your results. Long output is automatically folded so that you can concentrate on what’s interesting you. Results are saved, so you won’t lose a result if you haven’t immediately saved it into a variable. In addition to attribute completion, DreamPie gives you filename completion. There’s also a “copy code only” command that lets you copy a sequence of commands to run them at once or use them in a regular Python program.
DreamPie can help Python developers in a number of ways, Yorav-Raphael says. “I use it as a calculator, allowing me to save values and formulas I have used and change them. I use it when simple scripting is required, for example to rename a lot of files. I use it to work with data; Matplotlib and NumPy give you powerful tools for analyzing and plotting data, which gives me a free Matlab alternative (I actually prefer it over Matlab.) I use it when programming, to interact with libraries to see how they work, and to try my own classes without the need of a complete program to test them. I also used it to teach programming; I find the fact that each command is executed instantly and the feedback immediately available very helpful.”
The program includes keyboard shortcuts for some useful actions – check the menus. And if you type a few characters and press Ctrl+Up, only commands that start with those chars are recalled, giving you a quick way to rerun commands.
The new version 1.1 features “a much enhanced function documentation view and a cool
new way to save you typing parentheses time – you type a function name and press Space and DreamPie will type the parentheses for you, along with quotes for functions that expect a string. It also can be used to interactively play with
Java and C# classes, to aid with development – a use case that actually has nothing to do with Python.
“I also plan to add module name completion. I would like to add support for something like IPython magic commands, and for quickly running shell commands. I don’t have a release plan; I release when I feel that enough bug fixes were made, or when new features are added.
“If someone wants to implement a feature that I like, or is familiar with IPython’s magic and would like to help, it would be great. Also it would be nice if someone wanted to translate DreamPie to another language. People are welcome to contact me directly or post to the mailing list.”