Python is everywhere. These days, it seems it powers everything from major websites to desktop utilities to enterprise software. Python has been used to write all, or parts of, popular software projects like dnf/yum, OpenStack, OpenShot, Blender, Calibre, and even the original BitTorrent client.
It also happens to be one of my favorite programming languages. Personally, Python has been my go-to language through the years for everything from class projects in college to tiny scripts to help me automate recurring tasks. It's one of few languages out there that is both easy to get started with for beginners yet incredibly powerful when beginners graduate to working on real-world projects.
To edit Python programs, you have a number of options. Some people prefer a basic text editor, like Emacs, Vim, or Gedit, all of which can be extended with features like syntax highlighting and autocomplete. But a lot of power users working on large projects with complex code bases prefer an integrated development environment (IDE) to the text editor plus terminal combination. An IDE is essentially a text editor, but with lots of additional features, sometimes specific to just one or two programming languages, to help the programmer keep track of the project as a whole. For instance, most IDEs keep a cache of class, function, and variable names so they can be autocompleted quickly. Others have debug tools, instant logic and error checking, and so on.
The line between an advanced text editor and a slim IDE isn't always clear. As you gain experience, you usually develop an opinion about which features you consider essential for your development needs, and even those sometimes depend on what project you're working on.
Here are some of the most popular options available to Python developers. All are cross-platform, so they can be used on your operating system of choice.
Eric is a common favorite IDE for Python editing. Named after Monty Python's Eric Idle, Eric is actually written in Python using the Qt framework.
Eric makes use of Scintilla, a source code editing component used in a number of different IDEs and editors, and which is also available as the stand-alone SciTE editor.
The features of Eric are similar to other IDEs: brace matching, code completion, a class browser, integrated unit tests, and so on. It also has a Qt form preview function, which is useful if you're developing a Qt GUI for your application. I personally like the integrated task list function.
If you're new to IDEs as a concept, Eric can take some time to master, and you might question whether learning an IDE specific to just Python is worth the time investment. I find Eric to be a great, lighweight, yet full-featured programming environment, and learning it can help the quality of your code and gets you familiar with conventions common to all IDEs.
Eric is available under the GPL version 3.
Pyzo is a Qt-based editor with a built-in file browser, project overview, log, debugger, indentation tracker, and much more. It considers itself an alternative to MATLAB, although actually it's a useful editor for any Python project, not just those dealing with advanced mathematics and science.
Because it's built with Qt, your workspace is highly configurable. You can move panels to suit your workflow or to simulate a specific IDE layout you're used to. The ability to show and hide tool panels based on what information you want in front of you can be a useful way of helping yourself focus, and because you can assign nearly every option to a specific key combination, you can keep your Pyzo editor fluid and dynamic.
Pyzo is a simple IDE, it's not a whole ecosystem the way Eclipse is. It doesn't have a plugin architecture (aside from being open source and therefore inherently hackable), and its main goal is to stay out of your way except to help keep track of your code.
The Spyder IDE, like Pyzo, targets data scientists as its audience. Unlike Pyzo, Spyder is a true environment all its own. It's a big, complex, and feature-rich application with panels to display rendered data, code output, logs, history, and much more. It can be downloaded on its own, or as part of a bundle along with the Anaconda distribution, a popular programming toolkit used by Python and R programmers.
PyCharm is another popular Python editor. There are two versions of PyCharm, and the free and open source edition of PyCharm is the community edition, available under the Apache 2.0 license.
PyCharm features pretty much everything one might hope for in an IDE: integrated unit testing, code inspection, integrated version control, code refactoring tools, a variety of tools for project navigation, as well as the highlighting and automated completion features you would expect with any IDE.
To me, the main drawback of PyCharm is its open core model. Many of PyCharm's advanced features are not available under an open source license, and for me, that's a deal breaker. However, if you're not looking to use advanced features included in the closed source verion, having the features left out may leave PyCharm as a simple and relatively lightweight choice for Python editing.
Eclipse with PyDev
It's hard to write anything about open source integrated development environments without covering Eclipse, which has a huge developer community and countless plugins available, allowing you to customize it to meet nearly any need you can imagine. But this kitchen sink approach is also one of Eclipse's downsides. Depending on your requirements, it may seem bloated or over-complex.
That said, if you're coming to Python from a background in a different language, particularly Java, then Eclipse may already be a familiar IDE. And if you make use of its many features, you may find life without them difficult. Even if you're new to programming, Eclipse can be a great IDE to start on, because once you learn it, you can likely use it for most or everything else you work on, regardless of language.
PyDev adds a huge number of features to Eclipse, far beyond simple code highlighting. It handles code completion, integrates Python debugging, adds a token browser, refactoring tools, and much more. In case you're working with the popular Django Python web framework, then you can leverage PyDev to create new Django projects, execute Django actions with hotkeys, and use a separate run configuration specific to Django.
Eclipse and PyDev are both available under the Eclipse Public License.
Other great options
The list of open source Python editors and integrated development environments is lengthy. Here are a few other interesting standouts.
- PyScripter, LeoEditor, and PTK (the Python Tool Kit) are tools for working with Python code. And of course there's IDLE, the default IDE packaged with Python.
- Geany, Atom, and Brackets are general purpose code editors with Python support through plugins.
- Netbeans and VS Codium are open source general purpose IDEs that, like Eclipse, can be transformed into Python editors with selected plugins and extensions.
- Most extensible code editors are likely to feature Python support. For instance, Emacs can be a full-fledged Python IDE if you know which packages and configurations to use. The KDE editor Kate has syntax highlighting, code collapsing, and project directory support by default, plus further extensions to help along the way.
The important thing to understand about a Python IDE or Python editor is that the best choice is the one that solves a problem. If you get overwhelmed by options and configurations, then choosing a lightweight and simple IDE or text editor may be appropriate. If you want something to help you write cleaner code with fewer errors, then a feature-rich editor with caching and linting might serve you better. Try some of the ones listed here, or ones you find on your own, and see which one works for you. After all, one of the strengths of open source is choice.
This is not a comprehensive list of Python editing solutions. For an (almost) comprehensive list, check out the Python Foundation's lists of integrated development environments and editors for Python. Did we miss your favorite? Let us know what it is in the comments below, and tell us why it's your top pick.
This article was originally published in October 2015 and has been updated to include additional information.
Are you interested in reading more articles like this? Sign up for our weekly email newsletter.