PyCharm is My New Python IDE

Friends, family, and maybe regular readers know that I’m more likely to publicly

Regular readers know that I’ve used a large number of IDEs over the past several years. They also know that I have, in every single case, returned to Vim, and I’ve spent a lot of time and effort making Vim be a more productive tool for me.

No more. I’m using PyCharm. It’s my primary code editor.

I’ve been using it since the very early EAP releases — maybe the first EAP release. I have rarely been disappointed, and when I was, it was fixed fairly rapidly. Here’s a quick overview of the good and bad.

Vim Keybindings!

I’ve been using Vi and Vim for an extremely long time. Long enough that whenever I’m editing text, I instinctively execute Vi keystrokes to navigate. Apparently my brain just works that way and isn’t going to stop. When I use other editors, and talk to users of other editors, one of the first things that comes up is how to do things efficiently by exploiting the keyboard shortcuts provided by the editor, so why reinvent the wheel? Why make me learn yet another collection of key strokes to get things done?

Sure, Vi keybindings are a pretty much completely arbitrary set of shortcuts, but so are whatever shortcuts anyone else is going to come up with. I’m glad that PyCharm decided to let the Vi-using community easily embrace its IDE.

And, by the way, PyCharm has by far the best and most complete Vi emulation mode I’ve ever seen in any IDE.

Git Integration

Well, not just git, but I use git. The git integration isn’t 100% flawless, but it’s perfect for most day-to-day needs. I use it with local repositories, as well as a centralized one at work, in addition to GitHub. Updating the project works really well, and lets me easily see what changes were applied. Likewise, when I’m ready to push and a file shows up in the list I didn’t recall changing, a quick double-click let’s me see what’s going on in a very nice diff viewer.

The most recent EAP release of PyCharm adds GitHub support specifically, in addition to Git. I’m not sure what that’s about just yet, because I’ve been perfectly happy using PyCharm with GitHub for quite some time. I’ll have to report further on that later.

It Gets Python Right

This is pretty huge. PyCharm makes me a more productive coder because it points out when I’ve done something goofy. If I mistype a variable, forget a colon, or whatever, I expect any editor to let me know, but PyCharm goes further than that. It’ll let me know if I’ve inadvertently changed the signature in a method I’m overriding in a subclass. With a single click, it’ll also open up the file the overridden method lives in and show me the method. That rocks.

It’ll also suggest imports if it can’t resolve a reference I’ve made in my code. Pressing alt+Enter adds the import to the file (at the top, not inline) without moving the cursor.

Code completion is good, but it’s not actually the reason I use an IDE, so I’m not one of those people who opens an IDE, types two lines into it, judges the outcome, and never comes back if it’s not precisely what I expect. I want to see how the overall environment makes me more productive. Code completion has always been more ‘gravy’ than ‘meat’ to me. I do happen to like that when I make a method call, PyCharm very unobtrusively and without taking over shows me the method signature. I honestly don’t require more than that.

Indentation, I must say, is very good. I don’t think perfection exists, but PyCharm comes closer than most. One detail I rather like is that PyCharm will automatically dedent after a return statement. This attention to detail pervades PyCharm, and pretty much guarantees I’ll miss a lot of cool features in PyCharm that I use all the time without thinking about it. My bad.

Run Configurations

It’s pretty easy to do just about whatever you want to do to run your code. For example, I use nosetests and coverage.py within PyCharm. Another PyCharm user I know uses pylint in PyCharm. I recently added a pep8 run configuration to PyCharm, and I have a pylint configuration too (though I’ve found that pylint doesn’t actually tell me much about my code I don’t already know, so it’s kind of a nag: “Yeah yeah, I’ll fix it” I find myself saying.)

Point is, if there’s a tool you use in your development process, it’s probably doable from within PyCharm, so you don’t have to break your focus.

Nits

I really only have a couple of minor nits about PyCharm. I’ll put them here just so you don’t think I’m getting paid to do this or something (‘cos believe me, nobody would pay me to say these things about their product):

  1. It’s kind of a beast in terms of performance. There’s a certain threshold after which shiny splash screens and pretty icons fail to hide the fact that your app is just a bear. I have a desktop with 4GB RAM and it runs “ok”. It’s reasonably fast. One thing I’ll note about it is that the performance, for whatever reason, doesn’t seem to get exponentially worse as more windows are added.
  2. Window crippling: I hate applications that refuse to let you activate a window when a dialog it considers more important is open. If I have the git commit dialog open, I should be able to start writing a commit message, refer back to the code by clicking the editor window, then click back and finish my message. It’s one example. Others abound. It’s damned annoying at times.
  3. It seems to still fail parsing docstrings. I’m surprised this is still broken. Basically, if I put a docstring in triple quotes at the module level, it marks the docstring as problematic, saying ‘line appears to do nothing’. Well, duh — it’s a docstring.
  4. I find its support for git branches to be really really clumsy to use. You can create new branches, set up tracking branches, etc., but it’s very confusing and unintuitive, and the documentation for the features don’t seem to use terminology I as a git user am familiar with. I actually don’t do my branching operations in PyCharm as of right now because I don’t want to screw anything up.

Overall Opinion: It’s a Win

At least 3 people who know me well are falling out of their chairs, or at least wondering who kidnapped me and took over my blog and started writing nice things about IDEs. It’s not something I really… do.

Look, PyCharm is a win. I don’t like every single thing about it, but here’s the deal:

  1. It does a great many things at least reasonably well (many much better than that).
  2. It does a bunch of other things in a way that is at least not broken (I have issues with some of their UI decisions for some obscure functions, but the functions do work)
  3. It doesn’t actually massively screw up anything that I’ve been able to find.
  4. It tries.

By “It tries”, what I mean is that the PyCharm team seems to go out of its way to make sure that the existing features work, that new features aren’t broken upon release for the sake of saying “HEY, NEW FEATURE!”, and that the finer details of Python don’t go ignored.

I once (ok, maybe twice) tweeted about PyCharm’s inability to just… open a file. Sometimes I want to do that. You know… open a file. Sometimes more than one. Sometimes I’m working on a project, and in the spirit of code reuse I want to open two or three other files from other projects as a handy reference, or to double check my work if tests fail (heck, I might just want the test code!). PyCharm used to make that impossible, but within about a month of my mentioning it on Twitter it’s now implemented in the most recent EAP. Others have had similar experiences. They’re responsive. They try. It’s appreciated.

  • Hans

    You know, to be fair, PyDev on the Eclipse platform has been doing all of this for years. And PyDev is both free as in beer and free as in speech. I’ve been using both, but ultimately settled on eclipse for being open source, better performance, and native/not-ugly look and feel on my linux box.

  • masklinn

    > It seems to still fail parsing docstrings. I’m surprised this is still broken. Basically, if I put a docstring in triple quotes at the module level, it marks the docstring as problematic, saying ‘line appears to do nothing’. Well, duh — it’s a docstring.

    It has no problem with class or callable-level docstrings. Is the issue with module-level docstrings reported on youtrack?

  • Jerry Rocteur

    I agree with Hans, PyDev does this and more. The mind boggles why you would want to pay for PyCharm.. I use Aptana, PyDev with vwrapper http://vrapper.sourceforge.net/

    It does not cost anything unless you wish to donate! Support Open Software!

  • http://elis.ws/ Eli

    It looks like JetBrains are doing something VERY RIGHT.

    I’ve wrote a post a month-or-so ago about PhpStorm. http://elis.ws/phpstorm-the-code-editor-ive-been-searching-for-a-long-time/

    P.S.
    You should really add a link to the product itself, don’t let your users go on a Google hunt to find what you are talking about and find themselves in places like download.com because they are not sure…

  • m0j0

    @Hans I’m not saying PyDev doesn’t do any of this. This isn’t a comparison piece, really. I just like PyCharm about a million times better than PyDev, so it’s become my IDE of choice, and I thought I’d share :)

  • m0j0

    @masklinn You’re right, it doesn’t, and so I specified (clearly, I thought) that the issue was with module-level docstrings. I don’t recall if I ever put this in youtrack.

  • m0j0

    @Jerry Boggles the mind? Really? Is the open source community really about choice, or “choice as long as your choice is completely free in every way”? I made a choice. It’s not like I’m bashing PyDev or any other IDE. I like PyCharm better, and I use it. I’ve never been one to not use a product because it costs money. My priority when I’m choosing software is that it works and fits my brain. If it also happens to cost money, I don’t really care.

    This is also not a laundry-list article. PyCharm does “all this and more” too. I really just can’t stand the Eclipse platform, in spite of everyone else seeming to really love it. Perhaps I’m an oddball, but then I’m glad PyCharm decided to make an IDE for oddballs like me.

  • m0j0

    Thanks Eli, will do.

  • Robert

    You compared PyDev with PyCharm in an earlier post:

    “One thing I learned from using PyCharm and Eclipse is that where tools like this are concerned, I really prefer a specialized tool to a generic one with plugins layered on to provide the necessary functionality. Eclipse with PyDev really feels to me like a Java IDE that you have to spend time laboriously chiseling, drilling, and hammering to get it to do what you need if you’re not a Java developer. The configuration is extremely unintuitive, with a profuse array of dialogs, menus, options, options about options and menus, menus about menus and options… it never seems to end.”

    Another outside post distilled it down to: “Too complicated and heavy. ”

    I agree 100% with that.

  • masklinn

    > I don’t recall if I ever put this in youtrack.

    Please check (and create an issue if you didn’t report it), it’s important, in my experience the PyCharm team is *very* responsive to youtrack bugs but they might not be aware of the issue if it’s never been reported.

  • Jason

    Thanks for the blog…picked up a copy of Pycharm at 50% discount and just integrated git this evening. Not new to python but now that I’m moving into projects I really wanted an IDE to help manage everything. Really appreciate the insight.

  • http://www.lazytwinacres.net DangDude

    How is its support for complex regular expressions in search/replace? I’m not a vim fan, but I cut my teeth on vi and its support for regex search and replace. Does it support standard/Perl5/Python expressions? Can I use numbered groups on the replace side of the action?

  • m0j0

    @dangdude — I have no idea. If I’m doing something like that, I’m probably dealing w/ data, not code, in which case I’m not using an IDE. However, there’s a free trial, so I’d def. encourage you to try it out.

  • doesnotmatter

    PyCharm is sooooo slow and bloated. It’s a deal breaker for me. Eclipse, pydev and viplugin with Mercurial and/or GITplugin with Eclipse is hands down superior. There is also a nice color theme plugin for Eclipse now that is available right from the Eclipse Market for free.

    Otherwise, WingIDE is superior as well but I am not a fan of needing X11 for the Mac port.

  • not applicable

    Also, the project management in PyCharm is horrid. The ability to only view one project at a time and all the metadata it drops with .idea files is a mess.

  • m0j0

    The idea that someone using Eclipse would call PyCharm slow and bloated is just baffling to me. That said, even if it were marginally slower, I’d choose it over PyDev based on usability alone. I find Eclipse unusably slow, and the user experience for coding non-java projects is a complete utter travesty.

  • http://kkinder.com/ Ken

    I’ve been a long-time Wing user, though I have to admit, PyCharm has mostly won me over. It is just *so* feature-rich, it’s incredible.

    Have you tried Deployment feature? When using other editors, I had custom scripts set up to rsync over changes to remote servers. PyCharm’s deployment feature negates that and even makes it easy.

    My main complaint is that the debugger is definitely not as good as Wing’s. It has trouble with scopes, and doesn’t always let you even use the interactive console.

  • Vaclav

    Very nice article… I like Pycharm too

  • kapouille

    I have the same problem as doesnotmatter, pycharm is significantly less responsive than pydev for me (ubuntu 12.04). With regards to the usability, I guess it’s subjective as I personally don’t see a significant difference between the 2 (some things are better in eclipse, some others in pycharm, but mostly things are pretty much identical, to the point where I wonder whether they don’t share the same backend code)