Writing Python using IDLE or the Python Shell is great for simple things, but those tools quickly turn larger programming projects into frustrating pits of despair. Using an IDE, or even just a good dedicated code editor, makes coding fun—but which one is best for you?

Fear not, Gentle Reader! We are here to help explain and demystify the myriad of choices available to you. We can’t pick what works best for you and your process, but we can explain the pros and cons of each and help you make an informed decision.

To make things easier, we’ll break our list into two broad categories of tools: the ones built exclusively for Python development and the ones built for general development that you can use for Python. We’ll call out some Whys and Why Nots for each. Lastly, none of these options are mutually exclusive, so you can try them out on your own with very little penalty.

What Are IDEs and Code Editors? An IDE (or Integrated Development Environment) is a program dedicated to software development. As the name implies, IDEs integrate several tools specifically designed for software development. These tools usually include:

• An editor designed to handle code (with, for example, syntax highlighting and auto-completion) Most IDEs support many different programming languages and contain many more features. They can, therefore, be large and take time to download and install. You may also need advanced knowledge to use them properly. In contrast, a dedicated code editor can be as simple as a text editor with syntax highlighting and code formatting capabilities. Most good code editors can execute code and control a debugger. The very best ones interact with source control systems as well. Compared to an IDE, a good dedicated code editor is usually smaller and quicker, but often less feature rich.

So what things do we really need in a coding environment? Feature lists vary from app to app, but there are a core set of features that makes coding easier:

• Save and reload code files

If an IDE or editor won’t let you save your work and reopen everything later, in the same state it was in when you left, it’s not much of an IDE.

• Run code from within the environment

Similarly, if you have to drop out of the editor to run your Python code, then it’s not much more than a simple text editor.

• Debugging support

Being able to step through your code as it runs is a core feature of all IDEs and most good code editors.

• Syntax highlighting

Being able to quickly spot keywords, variables, and symbols in your code makes reading and understanding code much easier.

• Automatic code formatting

Any editor or IDE worth it’s salt will recognize the colon at the end of a or statement, and know the next line should be indented. Of course, there are lots of other features you might want, like source code control, an extension model, build and test tools, language help, and so on. But the above list is what I’d see as “core features” that a good editing environment should support. With these features in mind, let’s take a look at some general purpose tools we can use for Python development.

One of the best (and only) full-featured, dedicated IDEs for Python is PyCharm. Available in both paid (Professional) and free open-source (Community) editions, PyCharm installs quickly and easily on Windows, Mac OS X, and Linux platforms. Out of the box, PyCharm supports Python development directly. You can just open a new file and start writing code. You can run and debug Python directly inside PyCharm, and it has support for source control and projects. Pros: It’s the de facto Python IDE environment, with tons of support and a supportive community. It edits, runs, and debugs Python out of the box. Cons: PyCharm can be slow to load, and the default settings may need tweaking for existing projects. Spyder is an open-source Python IDE that’s optimized for data science workflows. Spyder comes included with the Anaconda package manager distribution, so depending on your setup you may already have it installed on your machine. What’s interesting about Spyder is that it’s target audience is data scientists using Python. You’ll notice this throughout. For example, Spyder integrates well with common Python data science libraries like SciPy, NumPy, and Matplotlib. Spyder features most of the “common IDE features” you might expect, such as a code editor with robust syntax highlighting, Python code completion, and even an integrated documentation browser. A special feature that I haven’t seen in other Python editing environments is Spyder’s “variable explorer” that allows you to display data using a table-based layout right inside your IDE. Personally, I usually don’t have a need for this but it does look neat. If you regularly do data science work using Python, you might fall in love with this unique feature. The IPython/Jupyter integration is nice as well. Overall, I’d say that Spyder feels more basic than other IDEs. I like to view it more as a special purpose tool rather than something I use as my primary editing environment every day. What is nice about this Python IDE is that it is available for free on Windows, macOS, and Linux and that it is fully open-source software. Cons: More experienced Python developers might find Spyder too basic to work with on a daily basis and instead opt for a more complete IDE or customized editor solution. A recent addition to the Python IDE family, Thonny is billed as an IDE for beginners. Written and maintained by the Institute of Computer Science at the University of Tartu in Estonia, Thonny is available for all major platforms, with installation instructions on the site. By default, Thonny installs with its own bundled version of Python, so you don’t need to install anything else new. More experienced users may need to tweak this setting so already installed libraries are found and used. Pros: You’re a beginning Python user, and want an IDE that’s ready to roll. Cons: More experienced Python developers will find Thonny too basic for most uses, and the built-in interpreter is something to work around, not with. Plus, as a new tool, there may be issues you find which may not have immediate solutions. If you’re interested in using Thonny as your Python editor, be sure to read our dedicated article on Thonny which goes into more depth and shows you additional features.

Tomasz David
Tomasz David

Leave a Comment