Python Training by Dan Bader

Sublime Text for Python development — My 2016 review

When you ask for editor recommendations as a Python developer one of the top choices you’ll hear about is Sublime Text. In this post I’ll review the status of Python development with Sublime Text as of 2016.

Disclaimer: I’m a fan and long-time user of Sublime Text. I used a number of editors and IDEs for writing Python including PyCharm, IntelliJ with Python plugins, Atom, Visual Studio Code, BBEdit, and emacs. I’ve worked with colleagues who are big Vim proponents. And while I never got the hang of Vim, I feel like I’m qualified to give Sublime Text a relatively unbiased review. You’ve been warned though 😃.

What I like about Sublime Text

  • Performance: Sublime is one of the fastest editors available. Pavel Fatin compared typing latencies between several popular editors and Sublime Text is consistently among the fastest and most responsive ones in his list. My (unscientific) personal impression comparing Sublime with similar editors like Atom or VS Code confirms this. Also note that Sublime starts up super fast. I don’t restart my development environment too often, but when I do it’s nice to be back up and running within a few seconds — rather than waiting half a minute for a ginormous IDE to boot up.

  • Stability and reliability: I’ve been using Sublime as my main editor for almost four years and it’s always been rock solid for me in terms of stability. I don’t think I’ve ever lost any data due to a crash or some other issue. I think that’s impressive. I like my tools to be reliable.

  • Plugin ecosystem: Something that’s drawn me towards Sublime is its fantastic community that wrote thousands of plugins for it. That way you can build a custom editor setup that does exactly what you want and how you want it. Several fantastic packages for Python development are available. I’ve reviewed some of them here: Sublime Text Plugin Reviews.

  • Package Control: Sublime Text has Package Control which is a plugin manager that let’s you install and uninstall other plugins directly from within the editor. It’s kind of a “meta plugin” that makes tinkering with your setup super easy. Package Control comes with a directory of available plugins which makes it easy to pick out the good ones based on popularity and recent activity.

  • Plugins are written in Python: Most Sublime plugins are written in Python. Sublime Text includes an embedded Python interpreter that’s used to run the plugin code. It’s nice being able to look under the hood and read through a plugin’s code to judge its quality. If you’re a Python developer and you’re interested in writing your own Sublime Text package then that’s also a bonus.

  • It’s pretty: There’s a wide variety of themes for Sublime Text available which allows you to set up the look and feel of your editor to your liking. On top of that, Sublime’s font rendering is excellent. I’m peculiar about the way my editor looks. If I’m going to be staring at this thing for several hours each day then it better be as pretty as it can be 😀. I found Sublime Text to be easier to “prettify” than other editors.

  • Soft learning curve: Compared to some other editing environments like Vim or Emacs, Sublime Text has a soft learning curve. This is great for beginners. In my experience it’s difficult to be successful with Vim or Emacs without going all-in and spending at least a few weeks or months learning the system. Sublime Text is much easier to pick up in comparison.

  • UI state restoration: Sublime Text remembers the state of your editor windows when you shut it down so that when you restart Sublime everything looks the way you left it, including modified or unsaved files. This feature is brilliant! I haven’t seen anything quite like it and it’s something that discouraged me from using Atom, for example. I often use new editor tabs as scratchpads for notes. And while those are temporary it’s nice not having to worry about losing them due to an editor crash or restart.

  • Multiple cursors: Like some other editors Sublime supports editing with multiple cursors at the same time. This is super handy when you want to rename a local variable, for example. Select the variable, hit cmd+d a couple of times to select all other occurrences and then type the new name. Done. The same approach works in other situations like re-formatting a several lines of code at once or cutting out parts from a log file.

  • Cross-platform: Sublime Text is available for Mac, Linux, and Windows. It’s nice being able to use a familiar editing environment across multiple platforms.

  • Handles large files: Sublime is good at dealing with large files, like an occasional giant CSV file or a log file you want to take a look at in a familiar environment. I like not having to switch to other tools (like less) for that job, knowing Sublime will handle the file just fine and won’t freeze or crash. Atom dealt with the same files much less gracefully. It often freezed for seconds at a time or even crashed.

  • Fast global search: Sublime’s global text search is fast. I find it comparable to tools like ack, which is nice because that means I have to switch to the command line less. Sublime also indexes your source files and has a Goto Symbol in Project command that let’s you quickly jump to specific identifiers, functions, or classes. This feature is aware of Python’s syntax so it’s usually accurate.

  • Command palette: I’m bad at remembering keyboard shortcuts for commands I use infrequently. Sublime’s solution to that problem is the Command Palette. You can open it with cmd+p and find what you’re looking for with a fuzzy text search. Let’s say I want to rename a file and I can’t remember the keyboard shortcut for that – what I’ll do is open the Command Palette and type ren to select the File: Rename command and then hit return. Boom, this let’s me rename a file without ever moving my hands away from the keyboard – and without having to remember some arcane shortcut. This feature is a great time saver!

Things I dislike

  • Can be difficult to set up for a beginner: While using Sublime Text the way it comes out of the box is okay, getting most of the good stuff requires spending some time. It’s not as simple as installing an IDE like PyCharm that comes with batteries included. On the other hand, you can start with a simple setup using Sublime. Then simply add more plugins and custom configurations over time to turn it into a completely personalized tool.

  • It’s not free: I was on the fence about adding this point because I believe in paying for the tools that allow me to do my job better. I realize though that some people might find a free solution (like Atom, emacs, or vim) more attractive.

  • Not open-source, “bus factor”: Many of the Sublime Text alternatives are open-source which makes them more future proof. Sublime Text is developed by just one developer, ex-Googler Jon Skinner. And while Jon is clearly a genius and great at what he’s doing, it’s an open question what would happen if Jon decided (or was forced) to halt development of Sublime Text. Would the project just disappear? Would he be able to pull a TextMate and open-source the project? What if he decides to sell Sublime Text to a company and they do a bad job maintaining it? Essentially, one of the biggest problems with Sublime Text is that it has a bad bus factor — there’s just one developer working on it and its source code is not publicly available. Of course I hope the best for Jon and Sublime Text. My perspective on this issue is that I chose not to worry about it — I’d rather use the best tool for the job now than waste time trying to future proof my setup. If it doesn’t work out I can always switch later. (Edit: Will Bond, the creator of Package Control, joined the ST team in February 2016. This makes Sublime Text’s long-term survival more likely. But it still has a comparatively small team behind it and isn’t open-source like some of the alternatives. If ST ever stops being maintained we’ll probably see open-source reimplementations of the core editor functionality. There’s already projects like Lime Text, an open-source editor that aims to be compatible with Sublime’s plugin API.)

  • No great solution for “semantic auto-complete”: While there are packages that offer IntelliSense-like code completion, those I’ve tried weren’t satisfying. Due to the dynamic nature of Python as a language it will be difficult to get to the point where the auto-complete works as well as it does for Java in IntelliJ or for C# in Visual Studio. So it’s difficult to strike this up against Sublime Text and it’s plugin ecosystem. However, if you’re relying on a feature like that then it may be worth trying out the PyCharm IDE. I found it’s implementation of Python auto-complete the most promising. (Update: I’ve done more research on Python code completion with Sublime Text and after trying out several plugins I think the Anacoda plugin is the best solution. Configured correctly its auto-complete rivals that of PyCharm. I’m now happily using Anaconda in my Python development workflow.)

Conclusion

All things considered I believe Sublime Text is still the top editor choice for Python development. I haven’t found an alternative that would make me want to switch.

In my mind Sublime Text offers the best combination of performance, stability, and ergonomics. With some tuning it can look attractive, too. It does everything I want out of my programming environment and has been a central tool for me over more than three years.

By the way, if you’re looking for help setting up Sublime Text for Python development then check out this tutorial I wrote: » Setting up Sublime Text for Python development «

<strong>5 Sublime Text Tweaks</strong> to <em><u>Boost</u> Your Python Productivity</em>

5 Sublime Text Tweaks to Boost Your Python Productivity

Free 5-day class—just enter your email address below:

This article was filed under: plugin-review, programming, python, and sublimetext.

Related Articles:
Latest Articles:
← Browse All Articles