Python has certainly distinguished itself as a go-anywhere, do-anything language. As a language for desktop application development, it can be found behind the Resolver One spreadsheet. As an embedded script language, it's inside the highly respected Blender graphics package and the Rhythmbox media player. It is the binding glue of the Sage open source math package and the Portage package management system of Gentoo Linux. On the Web, it powers the highly popular Zope, TurboGears, and Django frameworks. The list goes on, as any quick Google search will show.
Object-oriented and dynamic, Python encourages rapid, iterative, and almost exploratory development. But good Python development starts with a good Python IDE. In this roundup, I examine nine Python development environments, many open source, but some commercial. They are Boa Constructor, Eric, ActiveState's Komodo, Oracle's NetBeans, Aptana's Pydev, PyScripter, SPE, Spyder, and WingWare's Wing IDE.
Of course, there's also IDLE, the IDE supplied with Python itself. Written using the Tkinter GUI toolkit, IDLE opens instantly into an interactive console. It has no notion of a project, nor is there an included GUI builder. Its configuration is minimal, dealing mainly with fonts, colors, and shortcut keys.
Its debugger is bare bones too, but it gets the job done. Activate the debugger, and when you run an application it starts up immediately. Buttons let you single-step, step over, or step out; also, you can set breakpoints by right-clicking the line in the text editor. While debugging, IDLE provides a view of the current stack and locals. You can activate views for source and globals; from the source view, IDLE will highlight the line that is the current execution point. IDLE is a no-nonsense IDE for editing and debugging Python modules and files as single entities. Many Python developers need more.
This flock of alternatives makes clear that there is no single best Python IDE; the range of problems that these IDEs attempt to solve is too wide to permit a solitary, superior candidate. If you need an IDE that allows development in multiple languages, then Komodo is probably your best bet, though Pydev is a close second and will likely be as good once its documentation holes are filled. If you need an IDE for GUI development, then Eric and Boa Constructor are equally good.
Nine fine Python development tools: Boa Constructor
Boa Constructor is a free IDE written in Python that its creators describe as a wxPython GUI builder. By no means new, the first release of Boa Constructor debuted in the year 2000. The version I tested, 0.2.3, supports 2.x versions of Python from 2.1 to 2.6; I tested it with my 2.6 installation. The IDE's author says it should also support version 2.7. It does not work with any 3.x Python releases, partly because wxPython (on which it depends) does not yet have a 3.x-compatible version, and partly because Boa Constructor's author is not yet prepared to support two code bases. Boa Constructor supports neither Jython nor IronPython.
Boa Constructor's user interface consists of a set of frames -- separate windows that you employ in concert to create and debug Python applications. Those windows are:
- Palette, a toolbar and multitabbed pane. Each pane opens into yet another toolbar. Click the New tab and Boa Constructor presents tool selections for creating a new Python package, module, and so on. Other tabs reveal toolbars for accessing visual controls -- menus, buttons, and more -- that are placed in the GUI designer.
- Inspector, a window for viewing and modifying properties of currently selected objects.
- Editor, Boa Constructor's primary workspace. The editor provides different views, depending on what's open in it. Open a Python module, for example, and it is displayed in the source view. Begin GUI development on a form, and the designer view opens. The editor also has an explorer view, which displays a tree control of the code's components, including classes, methods, functions.
- Explorer, in which you can navigate a variety of data sources: the file system, ZIP archives, CVS repositories, FTP, Zope objects, and more.
- Debugger, which offers a self-explanatory view of all the fundamental debugging capabilities. It can debug multithreaded applications, and it has special support for debugging Zope scripts. You can also debug a remote application by importing debug server code into the target and adding a call that turns on the tracer. (You must also ensure that paths to source files are identical on both host and target.) Also, when you turn on the debugger, Boa Constructor opens an interactive console in the context of the debug target.
Boa Constructor does not have the concept of a "project," as in having a project file that carries meta information about the other files that comprise the final application. Instead, when you create a wxPython application in Boa Constructor, the IDE builds a base Application.py file. If you open that file in the editor, an Application View tab appears that displays the other files within the application. However, if you open any other Python source file, no Application view tab appears because Boa Constructor recognizes that you're working with a stand-alone module.
The layout of Boa Costructor's IDE is unusual and takes some getting used to. In addition, the process of creating a wxPython application -- knowing which button you must push or dialog you must conjure and from what pane in the IDE and when -- is not obvious. Luckily, there are tutorials that guide you through the basics. Without those, I would've been lost my first time through the process. Even so, more tutorials would certainly be beneficial. Otherwise, the documentation is moderately good, and it includes both a reference guide and a Getting Started section.
Nine fine Python development tools: Eric
The Eric IDE comes in two editions: Eric4 supports Python 2.x, and Eric5 supports Python 3.x. I tested Eric 4.4.6 using Python 2.6. Before you can use Eric, you must first download and install a number of other tools and libraries. According to the Readme file, those tools must be installed in a specific order. (I botched things the first time I installed Eric, but wiping everything out and re-installing cleared the matter up.) Happily, Eric's installation script will check all dependencies when you're done.
Eric is built on the cross-platform development framework Qt. For example, Eric's editor is built on QScintilla, a port of Scintilla to Qt. The IDE has excellent plug-in management support; its Plugin Management Window will show you all currently available plug-ins. Select a plug-in, download it, and when you close the plug-in management window, you are guided through the process of unpacking and installing it. The whole process is a good combination of automation and guidance. The one downside is -- as with Eric in general -- the lack of thorough documentation for individual plug-ins.
Eric has an extensive configuration/preferences system. Its size makes it daunting, but it's worth exploring; if something doesn't appear to be working, there's a chance you haven't configured it correctly. For example, when I first tried Eric's integrated browser, images were not shown for any of the Web pages. It turns out that loading images in the Web browser is a preference setting.
Eric lets you organize your work into projects. In fact, Eric has a multiproject viewer similar to Eclipse. You can add several projects to the multiproject viewer, and each is available at a glance. Though nice, it's a bit clunky; you cannot simply drag a project into the viewer. You have to open a project, give it a name and description, and then you can put it in the viewer.
You can think of Eric as container for a number of development tools. These include the Qt Designer for building Qt GUI applications, the Qt Linguist tools for localizing applications built in the Designer, and a UI Previewer that gives you a static view of the user interface that you've built in the Designer. There's a Translations previewer, which is similar to the UI previewer except that it shows how Qt Forms will appear when different translations are used, plus a couple of diff tools, an SQL browser, an Icon editor, and more.
Nine fine Python development tools: Komodo IDE
ActiveState's Komodo -- from the purveyors of ActivePython and other Active languages -- is available in two editions, the Komodo IDE ($295 for one user license) and the free Komodo Edit version. The free edition is more or less an editor with some additional tools. It does not have a debugger, code browser, or interactive shells. It is missing other capabilities; the details can be found in the comparative features table on the ActiveState website.
Komodo is a multilanguage IDE, supporting Ruby, Perl, PHP, and Python. I tested version 5.2.4 and did a bit of work with the beta of version 6, which became available while this article was underway.
When you first launch Komodo, you'll notice that the initial start time is quite long. This is because it is reading modules and constructing its Code Intelligence database. Subsequent launches are as quick as the other IDEs tested.
Komodo's source editor provides both auto-completion and call tips. You can extend auto completion to any module by setting the pythonExtraDirs preference; Komodo will scan the specified directories for Python modules and read them to fill its code intelligence database. When you type in a function, Komodo's call tips will show both function prototype and docstrings.
Beside the editor window you'll find source and object browsers. The source browser shows (and allows navigation in) the files that comprise the project, while the object view lets you browse and view the project's classes, methods, functions, and more. The source editor also lets you quickly turn a piece of code into a snippet (template). Simply select a block of text in the editor and drag it into the Project pane; the new snippet will appear as a separate entity in the project tree, ready for reuse.
Nine fine Python development tools: NetBeans
Oracle's NetBeans, like Eclipse, is an open source, plug-in-based IDE originally built for Java development, but extended to other languages. I tested version 6.8, with what was described as an "early access" version of the Python plug-in. (Because plug-ins are community-driven projects, Oracle could not provide a likely release date.) I tested NetBeans with Jython 2.5.1, though the plug-in claimed that it would also work with the Python 2.6 and 3.1 installations I had.
NetBeans' editor supports code completion. Enter an object followed by
. (a period) and the available methods and object attributes appear in a pop-up list. Select a method and -- if documentation is available for the method -- that is displayed in another popup window. To accelerate development, NetBeans has templates for both Python files and code snippets. At the time of this writing, there were only three file templates, but numerous code snippet templates. Not all of the niceties of NetBeans are active for the Python plug-in, however. For example, the only two refactoring commands available were "find usages" and "rename."
NetBeans has all the debugging features you'll need: breakpoint, watches, stack trace, and so on. It can handle multithreaded Python applications, and you can configure the debugger so that the file stops on the first line of execution. When you launch the debugger, it also opens an interactive console, from which you can enter Python commands in the context of the application being debugged. What is missing is remote debugging, which is not yet supported.
Beyond Python-related features, NetBeans also provides a diff tool, with rudimentary merge capability (that you should experiment with before attempting in the field). The base IDE has support for the version control systems CVS, Subversion, and Mercurial. NetBeans also provides a "local history" feature. This keeps track of modifications you've made to files, so you can step back in time to previous editions. You can even restore deleted files. By default, versions for the last seven days are tracked, though you can modify this duration in the preferences.
Nine fine Python development tools: Pydev
Aptana's Pydev is an Eclipse plug-in that supports development in Python, CPython, Jython, or IronPython. I tested version 1.5.9, running in a Galileo release of the Eclipse IDE. The version I explored will work with both the new Python 3.x as well as the earlier Python 2.x.
Installation is easy with the help of the Eclipse update mechanism. Just connect to the proper repository, select the Pydev install, and Eclipse does the rest for you. If you're already familiar with Eclipse, you'll have no trouble getting Pydev installed or finding your way around the capabilities Pydev includes.
Eclipse refers to a particular configuration of windows as a perspective. Two perspectives are important to Python developers: the Pydev perspective and the Debug perspective. You do your editing in the former; the latter is for running and debugging the application. When you install Pydev, you install three new project types: Pydev, Google Apps, and Django.
A Pydev project is merely a standard Python project; Google Apps and Django projects are created with special features and attributes appropriate for those two development frameworks. For example, if you create a Django application, Pydev automates a number of actions. You can launch a Python shell in the Django environment, issue a custom command, synchronize the Django database, and -- if you happen to be working with the Jython variant of Django -- create a WAR file.
As is standard for Eclipse, Pydev provides plenty of source editing customization features. For example, you can configure code folding so that it operates on
while statements but leaves
try statements unfolded. You can configure hovering so that placing the cursor over a method name displays docstrings. You can define similar customizations for the debugger (such as hovering over an in-context variable in the debugger will display its value in a pop-up). Pydev also installs plenty of templates and associates them with hotkeys. For example, select a function line in your code, click Ctrl+1, and a docstrings template is poured into the editor.
Nine fine Python development tools: PyScripter
PyScripter is the creation of Kiriakos Vlahos. It was originally designed to be a scripting solution for Delphi applications. In fact, PyScripter is built with Delphi (with additional components created by Python for Delphi), and it is noticeably more responsive than the IDEs written in Python. On the downside, PyScripter's Delphi roots limit it to the Windows platform. I tested version 126.96.36.199, which claimed to have support for most of the 2.x Python variants, as well as Python 3.1. I tested PyScripter with Python 2.6.
PyScripter's interface is uncluttered and easy to navigate. Its editor supports code completion, as well as call tips, and will perform syntax checking on the fly as you type. You can create both code snippet and file templates for quickly pouring boilerplate code into an application's source. And templates can be programmed to do more than paste in static source, thanks to PyScripter's custom parameters, which let you script the behavior of templates. Custom parameters can be used, for example, to fetch system values -- date, current directory, Python version -- and write them into the source code when the template is employed. You can also define custom parameters that prompt the user for input and paste the response into the code. You can extend the IDE in a fashion: Any application that can be invoked from the command line can be added to PyScripter's Tools menu.
PyScripter's File Explorer window has a handy, graphical display of the Pythonpath, which you can update with drag-and-drop ease. The Project Explorer lets you create multiple run and debug configurations; each can have its own runtime parameters, working directory, local/remote Python executable selection, and more.
The Project Explorer also lets you configure whether or not the Python runtime is re-initialized before subsequent runs. Without this, if you run an application, stop it to examine something or make changes, and restart it, classes and globals might be retained from the preceding run, which can result in difficult-to-diagnose problems. This feature can be particularly useful when debugging GUI-based applications.
PyScripter uses the standard Python debugger, which supports watches, call stack viewing, breakpoints, and a locals window. You can do remote debugging via one of four remote engines, all making use of RPyC (Remote Python Call), which is bundled with the latest version of PyScripter.
Nine fine Python development tools: SPE
SPE stands for Stani's Python Editor, after the IDE's author. SPE is another free IDE written in Python, and it requires at least Python 2.6 to run, which is the version of Python I used. I tested SPE version 0.8.4. SPE will not work with a 3.x release of Python because it uses the wxPython windowing toolkit, which as of this writing is not yet available for a 3.x Python.
SPE does not install itself in your system menu (on Windows); you start it from the command line. If you have trouble with it (I did not), you can start it in debug mode (by appending a
--debug parameter to the command line) and send the debug output to Stani for help. The IDE is arranged in a classic three-paned format: explorer, navigating, and browsing tools on the left; a large editor pane on the right; and output, interactive shell, and miscellaneous utilities at the bottom. Each pane in the three sections is tabbed. For example, the editor pane has a tab for source editing, a tab that displays a UML diagram of the code being edited, and a tab that provides a browsable PyDoc-generated view of the code's documentation.
The lower pane's interactive shell also provides a locals tab, which shows currently active objects. The session tab records past scripts that you either executed by hand or dragged and dropped into the shell. (This allows rewinding into the past.) The lower pane also has a search utility that can target either source files in the IDE or files within a specified file path.
In the explorer pane, you'll find a list of imports, classes, and method definitions in the current file, arranged in the order they appear in the source. A handier search tab in that same pane is the index tab, which lists all named items, organized alphabetically. From the nearby file browser tab, you can launch files of known extension. (If the file type can be handled by the SPE editor, the file will open in the editor; otherwise it will launch in its appropriate application.)
However, you cannot use the explorer for dragging and dropping files from one folder to another. Nor does right-clicking provide a menu for, say, deleting files. SPE does not have the concept of project (you work with files as individual entities), but it does have the concept of a workspace. A workspace lets you save open scripts, recent files, notes, and so on, into a single file. A workspace is really just a way of saving project preferences.
Nine fine Python development tools: Spyder
Spyder is another Python IDE written in Python. It has been verified to run on Windows, Mac, and Linux.
Spyder is really a kind of numerical package that just happens to use Python as its scripting language. In fact, Spyder's creator, Pierre Raybaut, purposefully incorporated features in Spyder to make its behavior similar to MATLAB's and designed the Spyder workspace to look like MATLAB. Spyder requires PyQt, and at least PyQt4. To use Spyder as it is really intended, you should also download and install pylint, NumPy, SciPy, and matplotlib.
The version I tested was 1.0.3. I used Python 2.6 in my testing, though Spyder's creator informed me that Spyder should work with Python 3.1, and he had reports of users running Spyder in a 3.x-level Python. However, he indicated that, for scientific and mathematical users, there is little different between Python 2.x and Python 3.x. In addition, as of this writing, NumPy and SciPy had not been ported to Python 3. (The development version of NumPy supports Python 3, and a release version is expected in the fall.)
Spyder has three startup levels: All, Basics, and Light. The startup level controls which components are imported when the IDE loads. All imports everything: the math libraries, os, sys, re, time, and os.path. Basics imports the math libraries only, and Light turns off all the add-ons. If you start the Light version, Spyder will not have access to NumPy, SciPy, and matplotlib, though you can manually import those libraries via Spyder's interactive console at a later time.
Spyder's interactive console opens automatically in a pane on the right-hand side of the IDE. Not only can you enter Python code, but the console will accept shell commands if you precede an entry line with
!. For example, to get a local directory, enter
!dir. The console also provides a history log of past commands, available within a separate tab. Select the tab, and you can cut and paste entries from the past.
Nine fine Python development tools: Wing IDE
Wingware's Wing IDE is available in three editions: Professional, Personal, and Wing IDE 101. All versions will run on Windows, Mac, and Linux, and all support the 2.x versions of Python, as well as Python 3.0 and 3.1. (I tested with Python 2.6.) The Professional version is the most expensive and of course the most feature-rich. The Personal Edition, for noncommercial and educational uses, has slightly fewer features but is low-priced. The free edition, being free, does not include features like autocompletion, multithreaded debugging, or remote debugging. (A feature comparison chart is available at the Wingware website.) I tested the Professional edition, version 3.2.9-1 using the IDE's 30-day trial period.
The Wing IDE layout is straightforward, with the editor window being its central fixture. Supporting panes -- source browser, runtime output and debug panes, and so on -- are arranged on the periphery. In the lower right is the eminently useful Source Assistant pane, the Wing IDE's answer to call tips. Begin typing, say, a function call, and the prototype and docstrings information for the corresponding functions are displayed in the Source Assistant. Continue typing, and the likely matches are appropriately reduced. Also, when you click a function name anywhere in the editor (whether at a definition point or a reference point), the function's information is displayed in the Source Assistant. If you select a method, and that method has overridden a parent class method, the Source Assistant displays a clickable link for the location of the overridden method.
Wingware's debugger is highly configurable. For example, you can set the debugger to stop when an exception is raised, but before the except or finally clauses have run; or you can configure the debugger to let those clauses run and then halt execution. Also, you can configure the debugger's watch system to display an object's content only when that object is in context, or hold a reference to the object and show its contents regardless of the current context.
The debugger can handle multithreaded applications; when debugging the target application is halted by, say, a breakpoint, by default the debugger stops all threads and indicates which thread caused the suspension. However, this is configurable so that, if one thread hits a breakpoint, the others can continue to run.
The Wing debugger also supports remote debugging. You have to import a debugging module at the beginning of the target application; the import loads code that provides the target side of the host/target communication. This is a snap if you're remotely debugging an application on the local system. To debug on a separate machine, you must first install a debugger "core" file. Also, you have to define File Location Maps in the IDE. These maps are the means by which the debugger can match paths to source files on the local machine with paths to corresponding files on the target. Luckily, this process is well documented.
Nine fine Python development tools at a glance
|Boa Constructor 0.2.3||Windows, Mac OS X, Linux||Python 2.1 through 2.6|| || ||Free|
|Eric 4.4.6||Windows, Mac OS X, Linux||Python 2.x (Eric4), Python 3.x (Eric5)|| || ||Free|
|Komodo 5.2.4||Windows, Mac OS X, Linux||Python 2.x; Python 3.x support added in Komodo 6.0 beta|| || ||$295 for a single-user license; Komodo Edit is free, but it is really just an editor|
|NetBeans 6.8||Windows, Mac OS X, Linux||Python 2.x, Jython|| || ||Free|
|Pydev 1.5.9||Eclipse||Python 2.x, 3.x, CPython, Jython, IronPython|| || ||Free|
|PyScripter 188.8.131.52||Windows||Python 2.x and 3.1|| || ||Free|
|SPE 0.8.4||Windows, Mac OS X, Linux||Python 2.6 and later 2.x|| || ||Free; documentation requires a €5 (about $6) donation|
|Spyder 1.0.3||Windows, Mac OS X, Linux||Python 2.x|| || ||Free|
|Wing IDE 3.2.9-1||Windows, Mac OS X, Linux||Python 2.x, 3.x|| || ||$179 for Professional edition; Personal ($35) and free versions available|
Also on InfoWorld:
- InfoWorld preview: Visual Studio LightSwitch chases app dev Holy Grail
- InfoWorld review: Microsoft Silverlight 4 vs. Adobe Flash 10.1
- Top five scripting languages on the JVM
- InfoWorld review: Tools for rapid Web development
- InfoWorld review: Eight PHP power tools
- Lab test: Climb aboard Ruby on Rails
This article, "InfoWorld review: Nine fine Python development tools," was originally published at InfoWorld.com. Follow the latest news in software development and Python at InfoWorld.com.