August 15, 2006

Stani's Python Editor: A feature-filled cross-platform IDE

Author: Joseph Quigley

As a Python developer, I have always wanted a more powerful integrated development environment than IDLE. Although IDLE is a useful IDE, it lacks some handy features, such as an automatic debugger, auto-completion, and extra formatting options, such as not displaying whitespace. A good FOSS alternative for developers is Stani's Python Editor, a cross-platform IDE for Python written in Python.

SPE's interface is easy to use. It provides tabs for getting around, which I prefer to a large amount of drop-down menus, buttons, and dialogs. It has hotkeys for fast access to several of its features.

For each open file SPE displays three tabs named Source, PyDoc, and Uml. Source allows you to view the source code, PyDoc displays the doc strings in the source code, and Uml lists the functions and classes in the file, and arranges functions that belong to a class to be near to each other.

Near the bottom of the main window are eleven tabs, several of which are especially useful. For instance, if you need to test a few lines of code, you can write them in the integrated Shell tab rather than opening an external shell and starting the Python interpreter. When testing a program, SPE can either use an external console or the built-in shell. When running a script in the integrated shell, SPE shows a dialog that allows a programmer to add command-line arguments. The built-in shell's output is nicely formatted and colored (with, for instance, red for errors and warnings) and routed to the Output tab.

The Notes tab lets you jot down anything important. In Linux, notes are saved in ~/spe/defaults.sws; in Windows it's in C:\Documents and Settings\user\.spe\default.sws. Each note is assigned to the file it was written for.

The Find tab makes quick work of looking for a specific piece of code in a directory filled with files. For example, if I were looking for pygame.display.set_caption("Hello World") in a directory with 25 files and I did not know which file(s) this bit of code was in, I could either grep for it, or save myself time and use the Find tab.

The Browser tab allows you to quickly open files that are in the same working directory.

SPE allows programmers to adjust the indentation spaces to their preference, and you can keep SPE from displaying white space. If there is more than one file open, SPE can show the files as rows, columns, or "notebook" (allowing you to switch between open files through a tab interface). SPE can single out and display docstrings. It has an autocomplete feature for code. In addition to a syntax checker, SPE includes an interface for two wxPython GUI designers and the ability to comment or uncomment hundreds of lines of code at a time by pressing Alt-3 or Alt-4.

SPE makes managing classes and functions easy with a sidebar. I can click on any class or function in the list to have SPE take me to the line that has the class/function on it. Right-click on the __init__(self, vid) entry and SPE will go to the function __init__(self, vid) within class HUD. This saves time, especially when a program is hundreds of lines long (and if it's nicely organized into classes), as there is no need to search for a particular class or function. SPE can also go to the lines where Python imports a module (useful when someone has their import lines spread all over the code), just as it does with classes and functions.


SPE can be run from a USB drive, which is helpful given the cross-platform advantages of Python. I put this to the test by booting into Windows, installing Python 2.4.3 and wxPython 2.6, and downloading the version of SPE, which works on both Windows and Linux (and apparently Mac OS X too). I found that SPE did work off a USB drive, but it requires Python and wxPython to be installed on the host (whether the programmer is using Windows or Linux). For those who are very mobile, a commercial, fully external Python environment for Windows called Movable Python lets you develop and test without the need for installing Python and wxPython on the host.

My few complaints with SPE are the limited selection of external shells you can start when running a script, the lack of a QT GUI designer, the fact that some features are not KDE-compatible, and the inability to assign hotkeys for drop-down menu shortcuts, such as running a script externally. Otherwise, SPE is a nice cross-platform, feature-filled IDE, and it is exceptionally useful when you're debugging code.


  • Python
Click Here!