PyCharm vs. Sublime Text
PyCharm vs. Sublime Text
What are the differences between PyCharm and Sublime Text for software developers and programmers? Take a look to see the comparison.
Join the DZone community and get the full member experience.Join For Free
This blog post is about comparing two popular development tools and text editors, Sublime Text and PyCharm to each other. This blog post is written from the perspective of professional software development or if programming is what you do for living.
1. Preface: meet the contenders
I have been developing Python for a decade now in various environments. A few weeks ago, I decided to make a shift from Sublime Text 3 to PyCharm as my primary tool for typing in code on OSX. I tried PyCharm long time ago and I was dissatisfied – PyCharm is built on Java software stack and UI issues, alongside “Java software bloat”, were a major turn off for me. But times change, hardware gets more powerful and it was time for me to reconsider my decision.
Sublime Text is a commercial programmer’s text editor in development since 2008. Its major selling points are speed, powerful code text editing features (multicursor), cross platform support, customizations and plugin ecosystem. Currently Sublime Text version 3 is in beta. Though its development slowed down at some point, as Sublime Text has been mostly a one man show, new Sublime Text builds roll out now regularly. Sublime Text costs 70 USD. Unless you purchase a license you’ll be notified by a nagging dialog.
2. Feature highlights both in Sublime Text and PyCharm
Sublime Text and PyCharm bot have an integrated plugin manager. Sublime Text Package Control is not built in, making the initial adoption more of a hassle. On the other hand I found PyCharm’s plugin installer to be more cumbersome to use – more clicks. Reminds me of those Windows EXE installers.
Sublime text has become famous for its multicursor feature. With the release of PyCharm 4.0 it gained the multicursor support. It does not work exactly as in Sublime Text, but close enough.
The editors enjoy plenty of themes available and both support my favorite Twilight theme. Also to further make the text more readable Source Code Pro font renders out nicely on OSX.
The text editors are good for Python editing and have e.g. indention guidelines and fast toggle soft text wrap options.
3. Sublime Text pros
Sublime Text beats PyCharm in few points and I miss these features in PyCharm, though some of them can be replaced using PyCharm alternatives.
Sublime Text’s Go To Anywhere is more powerful. Press CMD+T and type in few letters of package and module name. Go To Anywhere finds the suitable match. PyCharm Navigate -> File or Navigate -> Symbol are not as powerful as their heuristics seem to need more typing to get where you want.
Whereas PyCharm has a scrollbar with color hints to highlight the next TODO / warning / error place, Sublime Text has a minimap. Scrolling around with the minimap is more powerful as your eyes see the structure of the file unfolding.
The Sublime Text user interface is OpenGL accelerated and it runs smoothly 60 FPS all the time, making it pleasant for the eye and for typing. PyCharm is slower, though the difference is not so noticeable anymore after you pour in enough money to your hardware.
The Sublime Text plugin community is more vibrant. There are more plugins available, they get more support. For example if you need to do polyglot programming in rare languages, like R, Erlang or Haskell, there is guaranteed to be good Sublime Text support. Also if you write documentation in Restructured Text or Markdown PyCharm did not have such good plugins as one gets for Sublime Text.
As this blog post is mostly about Python development, one cannot dismiss the fact that Sublime Text plugins are self-contained Python modules – not cumbersome Java projects. It is very easy to write them, though Sublime Text plugin API is somewhat limited. There is even a menu entry New plugin. This might be one of the fact explaining why the Sublime Text plugin ecosystem is so healthy.
4. PyCharm pros
PyCharm comes with an integrated debugger. You can double click to set breakpoints in your editor and then run your application to stop on the line. But you still don’t lose the ability of drop into an interactive IPython shell when hit to the breakpoint:
Though I did find the PyCharm debugger slowed down the application too much. For example, when running a Pyramid website application inside the debugger the automatic restart cycle became too slow. You had to wait for each restart for more than ten seconds. This kills the basic web development flow: edit – save – refresh. Maybe there is a way to speed up the debugger for large projects – please somebody tell me?
Then the major reason why I switched over – due to limitations in Sublime Text plugin API one simply could not get run output where one can click Python traceback and is taken where the error happened.
I found this lovely navigation bar a quick fix to navigate around to related modules – partially compensates the lack of powerful Go To Anywhere as in Sublime Text:
Autocomplete, autoimport and other code intel and refactoring tools work better in PyCharm. With Sublime Text you need to play around with a lot of plugins to get decent autocomplete. Sublime Text plugins have their own incompatible settings and need a lot of manual package installation (pip install flake8, etc). In PyCharm I just hit alt+enter on a missing symbol and it got added as the import at the beginning of the file. Though I could not change it to format the import as I want – one import statement per line.
PyCharm does background spellchecking of written text and Python docstrings. It’s very handy if you want to write high quality software with meaningful comments and API descriptions.
PyCharm has more robust integrated version control support (Git, SVN). Though Sublime Text has plugins for this, the Sublime Text plugin API offers only very limited UI interaction and you cannot, for example, color files in the project explorer based on their edit status.
PyCharm has a Power save mode. It disables background tasks like code intel which are CPU intensive for large projects. This makes digital nomading much more fun when you are fighting over the single available power plug in a hostel on a remote island.
PyCharm has an integrated terminal and run window, though it has shortcomings and doesn’t seem to behave like a real terminal.
PyCharm has an integrated unit test runner. But it did not work for my py.test and splinter browser tests, as it seems to behave differently than virtualenv’ed tests launched from command line.
5. Conclusion and the future
After a few weeks I found myself using PyCharm for most of my programming needs. The key pain points PyCharm solved for me where robust code intel tools, better Python application run and debug support, with traceback clicking. The development efficiency gained from these features is enough to migrate over, even though there are features I miss in Sublime Text. However, these editors sync files perfectly and I can always alt+tab switch to Sublime Text when I need to write some Restructured Text or Markdown.
Published at DZone with permission of Mikko Ohtamaa , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.