Sunday, November 21, 2010

PyCharm, Charming Indeed

At my day job, I use Eclipse for writing Java. On other projects, well, it's been complicated. At home I prefer Python and Django over Java and JSF.

In the past, I've cycled between Vim, Eclipse and NetBeans.

Pydev does a great job of supporting Python in Eclipse, but Eclipse itself can be aggravating at times. Firstly, I'm using it on a Macbook, and it eats battery. Secondly, I've had mixed results setting up the mercurial plugin. It had been a while since I had tried (I seem to remember things basically working last time) but on my most recent attempt at Eclipse, I needed to sign-up for an account at javaforge.com to install the plugin. "Annoying," I thought, "but at least it's free." Well, after signing up, Eclipse wouldn't let me agree to the license. I suppose I could have kept fighting with it, but Eclipse starts to feel like paperwork if you have to work too much at configuring it (I hate paperwork). The dialogs for installing/removing/updating plug-ins don't seem like they're well thought-out.

NetBeans, has support for Mercurial that was either easy to setup or out-of-the-box (I can't remember needing to install it, but I may be wrong). I really like how NetBeans highlights uncommitted changes on the left of the editor without doing anything (no need to do a Team > Compare ... as in Eclipse). Very nice. NetBeans also has a much nicer plug-in installation process. I had an OK experience with NetBeans while dabbling with Groovy & Grails earlier this year (would have enjoyed it more if code-completion wasn't abysmally slow) and considered giving NetBeans a try for Python. Unfortunately, it seems that the project to support Python in NetBeans has stalled or died.

These experiences being par for the course, mostly I've been hacking away using Vim. I've learned to really enjoy Ctrl+N (complete word) when you've got your whole project open in buffers. Typing ":b part-of-some-filename<tab>" isn't a bad way to navigate. Setting up indent-based folds and using zM (max folds) and zR (no folds) is a workable substitute for Eclipse's outline. Battery life is fantastic, and my fingers love Vim (ddp, %s/blah/what/, :w).

Still, I missed having something underline my mistakes, having a nice outline of the code, and having side-by-side diffs like those I get with Eclipse at work (where CVS is used, hence side-stepping plug-ins).

I decided to give PyCharm a try today. I'm pretty impressed so far.

PyCharm has a "Power Save Mode", and after watching my battery life while working un-plugged for nearly an hour, it seems to work well.

CVS, Git, Mercurial and Subversion are supported out of the box. Uncommitted changes are highlighted on the left of the editor, just like NetBeans.

The editor doesn't seem to have block selection like Vim. I've yet to find a way to change the color scheme. I miss Vim's key bindings, but it's early.

Copying and pasting code from a web2py project I'm rewriting using Django gave me a little trouble. PyCharm kept nagging me to import web2py symbols that I was busy replacing with the appropriate Django equivalents. It didn't actually interrupt me, I just kept seeing this little tool-tip giving me the key-combo to do an import (useful when I've needed it, but annoying in this case). I can probably switch this off.

Overall, I'd say JetBrains has a pretty good chance of getting some money from me by the time my trial runs out.