Me and U(buntu)

My Ubuntu Experience!

In Search Of … A Python IDE

Posted by Jason on November 14, 2008

I’ve finally gotten started on developing an open-source desktop version of The Scalculator, which has its roots in a moderately popular perl web app I wrote many years ago.

After looking at a few options, I settled in on Python as the language and QT as the graphical toolkit – and after a few days of development I thought I might put a little effort into finding an IDE in hopes it would help me be a bit more productive.

Keep in mind I am not a professional developer, python or otherwise, so please keep my thoughts in that context. I’m probably looking more toward a more powerful text editor than a full-fledged IDE compared to a more professional developer.

What I wanted

In very rough order of what is important to me in an IDE:

Easy to learn. This is the main thing. I want to be able to start coding almost right away. I’m willing to invest an hour or maybe two into getting started – and more later for advanced features. However, I don’t want to have to take a course just to edit a file and run it. (This immediately rules out emacs.)

Basic Text Editor Stuff. These are things that are in any decent text editor: auto-save, customizable font and size, multiple files open in tabs, force spaces instead of tabs, and so forth.

Code Highlighting and Syntax Support. Yeah, this is a basic requirement. Highlight keywords, strings, constants and the like. Show matching braces, indent correctly and so forth. Most text editors support this to a pretty good degree already.

Custom commands. There are several routine commands I like to run while developing. Things like pylint, epydoc, and bzr. It’s no big deal to jump out to a shell real quick to run this, but it sure would be nice to just push a button right in the IDE. Something some text editors offer.

Auto-completion. Because I am new to Python and QT I have to often look up objects and methods in the documentation. That’s not too bad, because there is very good documentation for both – but again, it sure would be nice to have that stuff come right up in the IDE.

Another point on autocompletion is that I am frequently changing the objects in my project as I (hopefully) find better solutions. Autocompletion can help make sure I use the right names, rather than the ones I had yesterday.

Object outlining. I mean that thing where it shows a little tree of the objects and methods in the file. I find that helpful to jump around quickly in the source to the specific area I would like to work on.

There are a host of other little nice things to have, but they aren’t things I’m really worried about as part of the selection criteria.

One thing that you might think is missing on my list is some sort of debugger support. This is because I just through print statements everywhere when debugging. This doesn’t mean I would turn my nose up at a smooth debugging interface right in the IDE, just that I don’t personally consider it a deal-breaker.

What I Got

I tried lots of possibilities, some were OK, some were poop, a few were nice.

Geany – This is ” a text editor using the GTK2 toolkit with basic features of an integrated development environment.”

Geany

Geany

It is very nice, almost no learning curve and I used it as my main IDE while I was evaluating the other options. It was sort of the “reference standard” – the competition had to do everything and more than Geany did, and it couldn’t be much harder to learn to use.

The autocompletion is not very smart, but still helpful – it is limited to objects in the code, not library objects, and is the name only. I also like the faint line that marks 80 characters.

If you don’t have time to start evaluating IDEs, then just use Geany and get on with the coding.

Verdict: A solid, if very basic, solution.

Netbeans – I had been using this for some other development. With nbPython, Netbeans is supposed to support Python.

[No screenie because I uninstalled this about a week ago.]

You have to set up Mercurial and grab the right version of nbPython, and then find a proper build of Netbeans that will work against that version of nbPython. I got that much working once I think, but even then ran into lots of minor problems. It was a few weeks ago, and I didn’t think to write them down. Sorry.

Netbeans is a nice IDE in general, but just not for Python. Perhaps in the future?

Verdict: Not ready yet. (to be fair, it doesn’t claim to be.)

Eclipse – I downloaded a new release from the website, and was very excited because the promise of integrating QT, bzr, and pydev was very enticing.

[No screenie because I uninstalled this in a rage yesterday.]

It took a bit of time to get everything installed – but after a few tries I got it all fired up. Here’s the problem with Eclipse as far as I can tell: using the IDE is at least twice as complicated as the program you are trying to write.

It’s damn near impossible to bring in existing files into a (PyDev) Project. It turned out to be easier just to re-create the project and cut and paste the code into the new project, file by file.

Even then, I could never change the default directory which I made a mistake on when I first entered. You can force it with the -data switch from the command line, but I’m not sure how that worked because …

…not one single time was I able to re-open the project! I imported it once, and re-created it twice – with a re-install of Eclipse in the middle. Never was I able to re-open the project, though it looked alright on disk. The “Open Project” menu option was always grayed out.

In a similar vein, every time I opened Eclipse all the preferences for things like pydev and bzr integration were blank, and I had to set them up all over again.

I spent several hours on this and eventually gave up. I asked in #python if anyone used this, and everyone pretty much laughed at me. :(

Now in the working session, before I closed Eclipse, things looked nice. The integration with pylint was remarkable, and convinced me to use it often. So, I’m glad for that.

Verdict: Big talk, small walk.

Stani’s Python Editor (SPE) – I ran into a few people mentioning this and gave it a whirl. It worked alright, but documentation is very lacking. There are a couple of “donate” widgets that clutter up the interface, and as far as I could tell the manual is only offered to “donors”? I felt like I was back in shareware-land.

Stani's Python Editor

Stani

SPE has lots of nice features specifically for python development:

  • A “PyDoc” tab (per file) showing the module documentation.
  • A “Index” tab (bottom pane) that uses pydoc tags to jump around in project source.
  • A “Shell” tab (bottom pane) that has a convenient python shell running.

The “PyDoc” tab is slightly marred because I use epydoc. The links in the menus for things like “Python Documentation” lead to 404s, because the pages have changed. Seems like both these issues could be fixed through exposing some preferences – this is a weakness in general throughout SPE – too many “nice touches” seem to be hard-coded.

Similar to the “PyDoc” tab was a “UML” tab. This doesn’t do anything for me, but maybe a more complex project would find it of use? My stuff is generally one class per module, so a UML diagram of a single class isn’t really too helpful.

There is almost no support that I could find for SPE. I ran into a problem (I think I wanted to add a custom run command or something), and couldn’t find anywhere to ask about it. The main SPE site is just the author’s blog, and isn’t really focused on SPE per se.

Verdict: Flawed, but still worth a look.

Komodo Edit – Hooray! This is the first thing that beats Geany hands down!

Komodo Edit

Komodo Edit

There is almost no learning curve. Custom commands are dead simple and well documented. It brought in the existing files straight away. It has the 80-character line.I like the dotted lines it draws to show indention levels too.

Autocompletion is about the same as in Geany, I keep seeing errors about name resolution in the status bar – maybe something needs to be fixed to give better results?

Verdict: The best open source solution I found.

Wing IDE Professional – This is a commercial, Python-specific, IDE. However, they have a very interesting offer of a free license if you are only using the IDE on public open-source projects. I thought it might be nice to take advantage of this offer and see how the open-source alternatives stacked up against a commercial offering.

Wing IDE

Wing IDE

The requirements are very modest, basically you have to present a project with source code available under an OSI-approved license, and the website has to describe the project and show up in Google or some other search engine.

You then print out a form to sign and you can mail/fax/email it back in. I did this and got a license key back in about 5 hours – most of which was night-time Stateside. Very fast turnaround – and keep in mind my project is very small, on Launchpad, and only me as a developer. (You are welcome to join me, though! :) )

There is only a i386 .deb available for install, but it will work if you force the architecture. You also need to install “enscript” first as the package does not resolve this dependency.

You can tell from the screenshot that the interface is more complex. However, there is good help, and it’s the kind of help where you can click on the link and it opens the dialog that the help is talking about – that is nice.

Also, importing existing files into a new project was no problem – Wing did some analysis and found some tabs in the files (which I thought I had long since gotten rid of). That’s a nice feature.

I went to set up some custom commands, called OS Commands in Wing. These are nice and easy enough to create, but not quite as nice as Run Commands in Komodo – the major failing is the inability to get some user input for the command.

For example, in Komodo I can do something like this:

bzr commit -m "%(ask:QUESTION:DEFAULT)"

And upon execution get a prompt (QUESTION) to enter a bit of text (filled initially with “DEFAULT”) for the commit. I couldn’t find how to do this from Wing.

I also tried to lauch a command using sudo and it got stuck running. The terminate option didn’t do anything. Eventually, I just shut down the whole IDE.

I did use Wing for an entire day, and may stick with it. I certainly haven’t gotten into all the niches, but it seems worth the effort.

Verdict: If you don’t mind it not being open-source, a very nice python-specific IDE.

The Summary

I will continue to give Wing IDE a chance over the next few days, because I want to see if the more advanced features help development.

If I don’t get anything from those advanced features, then it will be  Komodo Edit. For the intersection of features offered by Komodo Edit and Wing IDE, I give a slight advantage to Komodo Edit.

15 Responses to “In Search Of … A Python IDE”

  1. kell said

    Just stumbled across this article, I’ve been looking through a few IDE myself.

    For Python + QT, I thought most people were using Eric – http://die-offenbachs.de/eric/index.html.

    It opens up looking more like photoshop than a simple text editor, but the frames can be closed to leave you with a more basic UI.

  2. JohnMc said

    You might try Quanta Plus. Though its thrust is for web work and php I find it acceptable for use with Python as well when I am coding something in Spyce.

  3. wizandchips said

    Went through the same myself. In the end I didn’t find anything I’m really comfortable with. It’s a pity for Eclipse.. such a great IDE for Java, but buggy and hellish to configure for python usage (especially under Linux). For now I stay with ye olde Python IDE. Have you tried Notepad++ for Windows?

  4. Marco said

    You probably want to look at Eric, like kell said. It has been my favorite and most complete IDE for a long time. I just wish I had something like this in GTK+ :p

    Give it a shot. Had all the features you ask for and much more, which are pluggable or can be turned off.
    A must have ;)

    Cheers

  5. Mark said

    I can recommend Komodo Edit too. It is easy to use and runs on multiple OSes. However, for my taste it was a bit too much. I cannot exactly say what I disliked about it, maybe it was too much of an IDE for me.

    So I recently settled with Gedit. Like many others I overlooked that app first but with plugins for python development as well as some other nifty plugins it becomes a powerful yet lightweight editor. Maybe you should give it a shot :)

  6. Too bad you didn’t give Pydev (+ Extension) some extra chances. If you start the project from scratch in Pydev (or import the code using the Import facilities), it’s really nice. Autocompletition works, code checking works, you get basic refactoring, plus access to nice Eclipse extensions for svn integration or web (XML, HTML, JS, CSS) editing.

  7. Alan said

    Easy to learn. Check

    Basic Text Editor Stuff. Check (duh)

    Code Highlighting and Syntax Support.Check

    Custom commands. check

    Auto-completion. Check

    Object outlining. Check

    If that’s all you need, why not try vim, which does all of the above and is available on all platforms ?

    And vim can be extended to your hearts content, in python

    My vim can open a Python Traceback: it loads all the relevant lines of the files.
    If my python script imports an extra module then
    vim starts up with all files, with local data for each stack frame.

    How many of the IDEs you try can syntax highlight python code, within a doctest file ?
    A few extra lines in the config files and mine does

    I don’t suppose any of those IDEs could run the doctest from the editor,
    then update the test’s text in the buffer with”Actual vs Expected” for each test?
    Vim doesn’t do that either
    but my vim will do it next week.

    Every minute I invested in learning vim twenty years ago is still paying me back now.
    The time I spent learning Turbo C, Delphi, C++Builder, Eclipse, IntelliJ, (…) was entirely wasted.

    PS: Hate to admit it, but I hear emacs is fairly good too.

  8. eric said

    What about Editra? http://editra.org
    Komodo Edit is nice, but I’ve felt Mozilla XPCOM-based apps to be a bit sluggish.

  9. Matt Street said

    Hey Alan, think you could post a link to your vim scripts or send it to me at:
    matt.street (a)(t) gmail.com?

  10. kartal said

    Komodo edit is nice but there is no code explorer in it.

  11. Billy Mac. said

    I too like others overlooked Gedit at first,
    however though I still like it I’ve come to settle with Wingware’s Python IDE. The “SMART”autocompletion of Wing can’t be beat by any others IMO. I absolutely fell in love with it, and it makes your life so much easier (again IMO) but also to note is the hefty price tag.
    Second to Wing (for me) would have to be Komodo (also with a hefty price tag), and to be honest I would have chose Komodo’s IDE over Wing if it weren’t for Wing’s autocompletion being so smart and conveinient, I really would say it nearly doubles my productivity.
    I also agree that you can’t go wrong with “Geany” either, and what I initially started with and I still use on occasion.

    Just my $0.02
    Cheers

  12. Komodo edit is nice but there is no code explorer in it.

  13. Fx15 said

    Hey Alan, think you could post a link to your vim scripts or send it to me at:
    matt.street (a)(t) gmail.com?

  14. Vlad said

    Editra with plugins – has nice autocomplete

  15. Capitani said

    This article and all it’s comments were very usefull to me. Thankyou for your time!

Sorry, the comment form is closed at this time.

 
Follow

Get every new post delivered to your Inbox.