For the past two weeks, I’ve been trying out PyCharm. I deviated from my usual one week test period due to constraints at work (a lot of C++ work on remote boxes, neither of which PyCharm is particularly well suited for).
PyCharm
PyCharm is another paid editor, with prices ranging from free (Open Source Project License/Classroom License) up to a Commercial License, at $199. Individual licenses are available for $99. Each paid license also has subscription fees, which are roughly half of the initial cost. I talked about how I feel about high priced IDEs in my last post, so I won’t repeat it all here. As a plus, however, Jetbrains provides a comparison of the differences between each license, which is nice to know.
Getting Started
When I first created a project, PyCharm wanted me to point it at the Python interpreter to use for the project. It didn’t auto detect what versions of Python I had installed in my system, which was pretty annoying, so I didn’t bother setting them up right away.
Upon opening a folder in my project, PyCharm then froze for 20-30 seconds while it “discovered” all the Python environments I had, including all the virtual environments in my home directory. They weren’t added though, just listed as detected - each time I added one, it two roughly two minutes to process, discovering what I had installed in those environments and what not. This wouldn’t have been so bad if this occurred in the background, but it didn’t. I had to sit there twiddling my thumbs for that whole time, because I couldn’t use the editor.
PyCharm displays the typical “Tip of the day” dialogs on start up - I left these enabled, which I’ve never done before. I recommend the same to anyone trying out PyCharm - it helped me find out about a few features I wouldn’t have seen otherwise.
Java
PyCharm is completely dedicated to Python development, as the name might imply. So what I don’t get, is why everything is written in Java. The editor itself is written in Java, the website is written in Java. Don’t get me wrong, Java is fine, it’s just odd. If you’re going to create a product for Python developers, why force them to use Java? I had to spend 15 minutes fumbling around, trying to install the Oracle JRE/JDK packages because the open source alternatives pose performance problems, apparently.
This results in all the familiar problems associated with Java desktop applications - horrible startup times, memory usage through the roof (700mb at the moment to edit a single file) and random lag spikes.
That, and being Java, it has been beaten with the ugly stick quite a bit. To be fair, this isn’t PyCharm’s fault - it’s just Swing. That said, the developers have written a lot of custom widgets, so it looks a lot cleaner than most Java desktop applications.
Process Management
PyCharm has lots of niceties for deployment, and process management in general. There’s automated tools for generating and applying patches, which is something I haven’t seen in any of the previous editors.
For folks familiar with the Python Package Index, PyCharm can automatically generate a setup.py script for you to make deployment much simpler.
You can also deploy straight to a Google App Engine account, or fall back to simply uploading to a remote server. It also goes one step further, allowing you to compare your local version with what’s on the deployed server - that’s pretty awesome.
UI Navigation
Navigating the UI is a little frustrating sometimes. A lot of the time, menu items have very little explanation or context, such as the “Invalidate Caches” menu option under File. What is in these caches? I have no idea.
Sometimes it’s the opposite, and you get context, but in a way you don’t expect. For example, the code completion popup has a small label at the bottom, explaining things Ctrl+Up/Down will move the cursor position up and down lines. It seems useful, but when that window comes up, how often do you want to change lines? I’m in the habit of expecting those windows to go away when I press escape, so that’s all I do.
PyCharm has a decent plugin system, that has quite a few things available, like extended Javascript functionality, or Github integration. It’s not immediately obvious how installation of a plugin is going, though - progress is displayed in the main window, not the window you currently have open.
The notification system for plugin installation was obviously geared to displaying errors at one point, as when I installed a plugin that required restarting, I was told “Error installing plugin: restart now?” which confused me for a little, before I realised that the plugin developer was misusing the message box.
There’s no Markdown syntax highlighting available, but a plugin can be installed to add it. It’s, unpleasant though. After typing for long enough, (roughly 2-3 seconds) the highlighting will disappear, and won’t reappear until you have stopped typing, because the syntax highlighter can’t keep up. It’s very distracting to have your entire IDE blinking at you repeatedly.
Some of the more advanced tools in the UI don’t give explanations when they should. If I right click on a folder and select “Create ‘Doctests in…’”, I see a weird dialog, which, from what I can infer, should allow me to create some boiler plate for some Doctests. When I complete the dialog, it doesn’t appear to do anything, so I’m not sure. I shouldn’t have to read the documentation for context menu items.
Searchable UI
Of course, PyCharm brings search functionality to the Settings dialog, which I like. It will highlight the relevant portion of the UI as well, to show you why it’s matched, much like the System Preferences in OS X.
The fast open functionality is not as nice, though. It takes about 800ms to process each search result, and display the search results, which leaves me feeling impatient.
Code Editing
Shockingly, I wanted to use Vim mode in PyCharm. PyCharm doesn’t support it by default, which I find kind of strange, considering that it has almost excessive support for other environments - options include Emacs, Visual Studio, and Mac (?).
I’ve had to install Vim support as a plugin, called IdeaVim, which for the most part was very complete, but occassionally I came across some really odd bugs, like undo going back 2-3 steps, then pasting what’s in my buffer to the current cursor position.
I’ve also hit a mode where I couldn’t interact with the text at all - I had to right click and paste before I could move the cursor around or change text at all. At other times, I had to quit the editor completely before I could start editing again.
Sadly, I can’t find a way to remap keys to perform custom actions in PyCharm. This means my work tool can’t be used in PyCharm, which is a pretty big downside to me. I could write a plugin to integrate it, but that feels like a lot of work for something that really should already be available. There’s a very nice looking Keymap in the Settings dialog, which, strangely, has “Refresh” five times… I could remap anything I wanted in there, but not add custom actions.
Code inspection isn’t very smart, in my experience. PyCharm tells me I have typos in my variables, e.g. “Typo in word ‘htmlcontent’”. PyCharm also doesn’t appear to cache this inspection, or do it in the background, as each time I select the menu option, it will repeat the process for the entire project, which is quite slow.
One last nifty tool, for larger projects, is the TODO detection. It will detect and list all TODO lines in comments. How many projects do you know of, where TODOs and FIXMEs live in the code base, long forgotten? I can think of a few that have them everywhere, and have had them there for years and years. Something like this reminds you that they’re still there.
Version Control Integration
Viewing diffs in PyCharm sucks. PyCharm use a character level diff, instead of the tools supplied by the version control system in use. This means your diffs look different to how the version control system sees them, which I don’t like at all. Plus, character level diffs are pretty ugly in general.
I can only find a way to view diffs one file at a time, instead of a project level diff. This means I have to store a lot of stuff in my head at once, which, well, isn’t fun. I shouldn’t have to do that, I already have enough going on in my head about the code I’ve just written.
The commit dialog though, is awesome. You can easily jump between diffs, see and modify which files are included in the changeset, as well as view some statistics for the changeset, like how many new files there are, etc. There are some advanced options too, like optimising the imports, and reformatting code, which are pretty cool. The commit dialog can also be used to create patches, instead of performing the actual commit, which obviously has some pretty useful advantages as well.
Conclusions
PyCharm, while it has it’s fair share of little annoyances, is pretty good. A lot of the bugs I encountered (in fact, all the bugs I can think of) happened due to interaction with plugins I have installed, so it’s fair to say that PyCharm is pretty solid. Development of PyCharm is pretty active too. See the PyCharm 2.5.1 Release Notes, there’s a lot going on there. Bug fixes are nice.
The biggest shortcoming I can think of is the fact that it’s all in Java though - the amount of CPU and RAM being consumed by it and Chromium doesn’t leave room for much else on my machine, and I have 4gb of RAM.
If you want an editor that integrates a lot of workflow for you, like deployment, package generation, and the like, PyCharm is definitely worth checking out.