Update: Listen to the podcast interview with the PyCharm guys.
Many developers, especially in open source ecosystems such as Python and Ruby, or Linux-based web environments in general, tend towards the minimalist with regard to editors. This includes editors such as Emacs and VIM but I’d also throw in more UI based text editors such as Sublime Text, Notepad++, etc.
In some ways this makes perfect sense. If you spend a decent amount of time SSH’ed into Linux boxes in your data center, well GUI apps such as IDEs make little sense. If you’re doing open source, maybe you are looking for something non-commercial and free. Again, totally reasonable.
But the truth is, as professional developers, we spend most of our time on GUI-based OSes. Our time and effectiveness are extremely valuable.
Specifically for Python devs, I think we should be using the best tools that help us create but also read, test, maintain, and evolve the software we build. To me, the best software for this holistic purpose, is PyCharm. But often the conversation goes, “What feature makes using a big, heavyweight IDE that costs $200 worth it? I’ll just use Emacs” or something along those lines.
There probably isn’t a single reason that works for many people. Rather it’s the sum of all the features as a whole. Moreover, these only become a benefit once you take the time to truly learn them and leverage them without the features getting in the way.
So in this post, here are 9 of my favorite features of PyCharm which taken, in total, build a pretty serious case for giving PyCharm a chance. If your current workflow involves more pure text editors such as Emacs or Sublime Text, take a moment to see PyCharm with an open mind.
Finally, if you’re skeptical of this opinion and you think to yourself, “Here’s just another guy dependent on GUIs to write code. How weak. I don’t need that.” I should say that I spent several years writing C++ with Emacs on SGI supercomputers to great effect. So I have spent some time on both sides of the fence. For me, the grass is greener on this side.
Ok. Here they are: 9 reasons to consider making PyCharm your primary editor to write Python code. I could easily make this 25 but let’s start here.
1. Code completion
PyCharm has great code completion, whether it’s for a built-in or an external package.
I know I said it’s the sum total of features that make PyCharm worth it. Personally, I think great intellisense / code completion may be a single feature which alone wins me over. I have to deal with minor RSI issues and the amount of code I type vs the amount of code created by the tooling with good code completion really does make a big difference in both speed and health.
Python 3.5’s Type Hinting
If code completion fails you, type hints (as in episode_id: int ) will turn it right back on. Notice the dropdown lists methods from the int class.
Code completion for SQL and databases
Look carefully at the image above. That is a basic string literal but PyCharm has determined that it is likely a SQL expression so turns on syntax highlighting and code completion for language keywords (WHERE, FROM, etc).
Moreover, I have attached my SQLite DB to the project. PyCharm is suggesting database schema specific options! O. M. G. is what I thought when I first saw that. Because of the FROM Episodes, it knows that the SELECT clause should be columns from that table.
Just wow. Think of the time and effort as well as avoidance of bugs this will help you with.
SQLAlchemy in the debugger
Set a breakpoint, pause in the debugger and you’ll see the SQL language representation of your SQLAlchemy ORM expression. Yeah, that’s amazing.
I think this is really just part of the string representation of SQLAlchemy ORM expression, but I don’t care because it’s so helpful!
Git visualization in the editor
Wondering what is changed since the last time you did a git commit? Well that would be the blue sections right there! Can even get a diff of that segment or roll it back from within the editor.
Here’s the same file after I checked in the changes:
Code coverage in the editor
Yes, you can run coverage.py outside of PyCharm. But please click that image above and look around. The code coverage details are everywhere – in the project tree, in the summary, in the editor and more.
Now zoom in. See the greenish and redish parts in the margin? Those are the covered and not covered segments right in the editor!
Yes, we can all use pip. But a nice visual representation of what’s installed, whether it’s current, and ability to search and add new packages is sweet.
I sure hope you’re using source control. But even if you are, local history is always keeping track of your changes in a way that complements things like Git. Need to roll something back even if it’s not part of a check in? Local history is always there.
Here’s a diff of a file where the changes between the two versions were not checked in.
Last, but not least, the ability to make changes consistently and safely across 100’s of files by understanding the syntax tree (rather than text replace) is a primary reason to use an IDE in general and PyCharm in particular.
There you have it. Taken in total, those are some seriously powerful features. Check out PyCharm. They have free community editions, and the pro version is free for open source, students, and training.
Feel free to share your thoughts in the comments.