Is there a better Python IDE?
Update 2010-10-10: Added Eric.
Update 2010-10-11: Updated PyCharm, added Komodo
Update 2010-10-14: Added Anjuta, Updated PyCharm and Komodo
I’m currently a user of WingIDE, but sometimes I feel the need for something better, mainly something that is a bit more stable. WingIDE often hangs when switching projects, sometimes the file listing decides that you must double-click on the expand arrow instead of just click on it, etc. It still doesn’t have macros despite this being a much requested feature (how hard can it be to add, really?) and I never really get the hang of the SVN integration, so I just ignore it. And they keep recommending me to use WingIDE’s separate instance of GTK instead of the System GTK, which is daft. Their designs are ugly, and it should work with the system GTK so it looks the same. Anything else is just silly.
But all in all it’s pretty good. I’m not unhappy with WingIDE. But I just have the feeling that there should be something better. So I’m testing other IDE’s. And so far my conclusion is that: No, WingIDE still is the best. But there are many Python IDE’s out there, so maybe I missed some. So this is your chance to tell me that there is one I’ve missed, or tell me that a feature I’m missing from the ones I tested actually *do* exist.And from this testing, this is the features I’d really want, but only WingIDE has:
1. Project management.
You know, adding to a project which files actually are included in the project. I probably could accept if it looks at what is versioned and ignored everything else, but I can’t just tell an IDE that this is my base root directory for the project, and then have the IDE analyze every single file under that directory. I use buildout, and my project directories often include things like Varnish and NGinX, which gets downloaded and compiled as a part of the buildout. I don’t want my editor to care about those files. However, I *do* want it to care about a lot of other files in that directory, so I can’t just select a subdirectory either. No, I do really need a project, not just a workspace, to which I specifically add files and directories, and say which Python interpreter to use, etc.
All of the IDE’s below fail on this count, some more, some less.
2. CTRL-click to go to definition
With WingIDE I can just CRTL-click on any Python variable, and I’ll go to the definition. If I set up the project correctly (see point 3) this includes anything I have imported from no matter what. WingIDE fails sometimes on this, but works most of the time, unless you just ‘from X import *’. Of the IDE’s I tested below I think only PyCharm supports this.
3. Get paths from a script
WingIDE as well as PyCharm has the possibility to analyze a Python-file and look for additions to sys.path, add them to the project and analyze them. That is for me most helpful for the CTRL-Click function above. I couldn’t find this in any other IDE.
4. Remote debugging support
WingIDE can debug processes via TCP/IP. The neat thing with this is that you can write modules for your web framework, which means you can debug it without running the whole web framework as a subprocess of your editor. If your webframework is small, the subprocess technique is feasible. With Plone it is not. Also you can connect and debug your customers server. Nice! But, yes, this is a minor requirement compared to the others. I can survive without it.
So here are the results of the Swedish Jury:
Is windows only. Python is a cross-platform language. A non-cross-platform IDE for Python makes as much sense as having a solar-cell operated night-vision camera. FAIL.
Stanis Python Editor (SPE) / Spyder /Anjuta
Yeah, I know that’s different editors. But I have the same to say about them. They all seem to be really nice little editors, starts fast and has a decent feature set. But neither of them have any actual sort of project management, and although they analyze the file you edit, they don’t analyze your whole project and they know nothing of your dependencies. They therefore can’t do any reasonable code completion or going to source even if they wanted to. They are often listed amongst IDE’s, but they aren’t IDE’s, they are editors that have a file browser built in. These are the ones to look at if you want something really small, fast and lightweight with no fancy frills.
Annoyingly written in Java, this is a really good IDE with loads of stupendous features. However, it is very slow in certain cases, and one of the reasons is because the project handling is lacking. Once again you only set a root directory for the project, and it will import and analyze everything in there. For a small Plone project this took some 15 minutes on my computer, and PyCharm ended up using 800MB of memory. Not fun. Especially since many buildout development projects involve something called “Omelette”, which will make virtual links to all your eggs, in a nice hierarchical structure that’s easy to browser and search through. PyCharm will take your start script, add all the eggs in the path to the project and analyze them, and then analyze everything in the omelette directory again, in practice analyzing all files twice. Now, you say, you don’t need an omelette directory when using PyCharm, and you are right. But in a typical project, most people will not use PyCharm. After some digging though, I found that you could go into the settings and there in “Project structure” exlude directories. So all is good. By why isn’t that option already in the file list? Weird.
PyCharm doesn’t support remote debugging. But that is as mentioned a minor feature. It seems really good, even if it chews up memory like crazy, and stays on the list of things to check out further. Too bad it doesn’t hook into Ubuntu’s UI settings, but uses different fonts for menues etc, it makes it look like shit, but I can survive that.
Update: What I can’t survive with is that the code completion doesn’t work as I want it to. This may be a matter of taste, so if you are looking for an IDE, PyCharm is one of the ones you should try. But it’s not for me, unfortunately because a lot of the features look *really* cool, but that is of no use if the basic features doesn’t work as you want them.
Eric is complex. Indeed, confusing. This is another failure of usability in open source. The weirdest thing is that when creating a project, it also tries to create a skeleton for Python. But obviously, the first thing I do to test is to start using the editor in an ongoing project. Maybe it’s possible to create your own project templates, but an empty one would be nice as default. Eric does have the feature to add specific files and folders to the project, hooray! It also supports remote debugging. I can’t find a way to add existing paths to the project though, not even manually.
Due to the many recommendations I bumped up Komodo to the next thing to look at. Expensive, but nice. Looks good, works smoothly. It doesn’t let you exclude files from the project on a per-file or directory basis, but it let’s you set up a filter for which files to exlude which is a bit more involved, but it has the setting both per project and globally, so you only need to set it up and it will work for new projects. Nice. But with point 3 above, the support is not perfect. Or rather, there is no support, but what I can do is to have the buildout create a custom python interpreter with the sys.path set up correctly. I usually do this in most of my buildouts using he zc.recipe.egg recipe. By selecting that interpreter, Komodo will use it’s sys.path as a basis for analyzing files. That would do very nicely, if this was a per-project setting, but it isn’t. But it’s good enough to continue looking into Komodo. Another option is to use the Omelette recipe that confuses PyCharm, and add the Omelette directory it to the per-project sys.path, but that requires Omelette in thebuildout, but that’s a small concession to make I guess. It’s support for having a remote directory as the project directory is intriguing, as well.
Update: But it’s code completion drives me crazy. I don’t know if it’s buggy, or stupid, or there is some magic button to push, or if I misunderstand something.
EMACS and vi
After articles in Python Magazine I decided to try this out. I hate both EMACS and vi, but it’s worth a try, they have GUI modes, and can be configured to have key-bindings that are not insane, etc. But the fact is that both of them still ended up feeling like editors from the 1970’s and you still feel like 40 years of user interface development somehow just got lost. Even if most commands now can be assigned to reasonable keys, things are still called “yank” and “pull” instead of “copy” and “paste” and you still end up in weird modes you can’t get out of except by pressing escape two hundred times. Yes, I’m sure both are great if you dedicate your life to learning all their intricate features, but in the meantime the rest of the computer world have been trying to teach computers how to understand people, not the other way around. Both EMACS and vi sucks. If you use them: Get your head out of the 70’s you bloody hippie.😉
So… what now?
Did I misunderstand the editors above? Is there other editors I should try? Tell me in the comments.