Of all of the metrics you might use to gauge the recognition and success of a language, one surefire indicator is the variety of improvement environments obtainable for it. Python’s rise in recognition during the last a number of years has introduced with it a powerful wave of IDE assist, with instruments aimed toward each the overall programmer and those that use Python for duties like scientific work and analytical programming.
These seven IDEs with Python assist cowl the gamut of use instances. Some are constructed solely for Python, whereas others are multilanguage IDEs that assist Python by way of an add-on or have been retrofitted with Python-specific extensions. Every advantages a barely totally different viewers of Python developer, though many try to be helpful as common options.
A great variety of the IDEs at this time are frameworks outfitted with plug-ins for particular languages and duties, fairly than apps written from the within out to foster improvement in a given language. To that finish, your selection of IDE could also be decided by whether or not or not you may have expertise with one other IDE from the identical household.
Associated video: Why Python makes programming simple
For individuals who don’t have such expertise, PyCharm is without doubt one of the greatest locations to begin. It’s pleasant to newcomers, however not hamstrung in its function set. In actual fact, it sports activities a number of the most helpful options amongst the entire IDEs profiled right here. A lot of these options can be found solely within the for-pay model of the product, however there may be a lot within the free model to assist a fledgling developer get began.
LiClipse and the Python Instruments for Visible Studio (PTVS) are good decisions for builders already intimately aware of Eclipse and Microsoft Visible Studio, respectively. Each are full-blown improvement environments—as full-blown as you’re going to seek out—that combine Python fairly properly. Nevertheless, they’re additionally sprawling, complicated purposes that include loads of cognitive overhead. For those who’ve already mastered both of them, you’ll discover it a fantastic selection for Python work.
The Python incarnation of ActiveState’s Komodo IDE is a pure match for individuals who have already used the Komodo IDE for another language, and it has distinctive options (just like the common expression evaluator) that should broaden its attraction. Komodo deserves an in depth look from novices and consultants alike.
Spyder is greatest suited to working with Jupyter notebooks or other scientific computing tools in distributions like Anaconda, rather than as a development platform for Python generally. Finally, IDLE is best reserved for quick-and-dirty scripting, and even on that count, it might take a back seat to a standalone code editor with a Python syntax plug-in. That said, IDLE is always there when you need it.
IDLE, the integrated development and learning environment included with most every installation of Python, could be considered the default Python IDE. However, IDLE is by no means a substitute for a full-blown IDE; it’s more like a fancy file editor. Still, IDLE remains one of the default options for Python developers to get a leg up with the language, and it has improved incrementally with each release of Python, especially with Python 3.5. (See this page for an interesting discussion of the recent efforts to improve IDLE.)
IDLE is built entirely with components that ship with a default installation of Python. Aside from the CPython interpreter itself, this includes the Tkinter interface toolkit. One advantage of building IDLE this way: It runs cross-platform with a consistent set of behaviors. As a downside, the interface can be terribly slow. Printing large amounts of text from a script into the console, for instance, is many orders of magnitude slower than if the script is run directly from the command line.
IDLE has a few immediate conveniences. It sports a built-in read-eval-print loop (REPL), or interactive console, for Python. In fact, this interactive shell is the first item presented to the user when IDLE is launched, rather than an empty editor. IDLE also includes a few tools found in other IDEs, such as providing suggestions for keywords or variables when you hit Ctrl-Space, and an integrated debugger. But the implementations for most of these features are primitive compared to other IDEs and hidebound by Tkinter’s limited selection of UI components. And the collection of third-party add-ons available for IDLE (one such project is IdleX) is nowhere near as rich as you’ll find with other IDEs.
IDLE also has no concept of a project, and thus no provisions for working with a Python virtual environment. The only discernible way to do this is to create a virtual environment and invoke IDLE from its parent installation of Python. Using any other tooling, like test suites, can only be done manually.
In sum, IDLE is best for two scenarios. The first is when you want to hack together a quick Python script, and you need a preconfigured environment to do so. The second is for beginners who are just getting their legs. Even beginners will need to graduate to a more robust option before long.
Komodo IDE, now in version 12, works as both a standalone multi-language IDE and as a point of integration with ActiveState’s language platform. Python is one of many languages supported in Komodo, and one of many languages for which ActiveState provides custom runtime builds.
On install, Komodo informs you about which programming languages, package managers, and other development tools it discovers on the system. This is a great way to get things configured out of the box. I could see, and be certain, that Komodo was using the right version of Python and the correct install of Git.
When you create a new project for a specific language, Komodo presents a slew of options to preconfigure that project. For Python projects, you can choose from one of several common web frameworks. A sample project contains examples and mini-tutorials for many of the supported languages, Python included. Navigation within files is nice and smooth, as there’s a drop-down search widget for all methods and functions within a file. Key bindings are configurable and can be added by way of downloadable packages that emulate other editors (e.g., Sublime Text).
One thing I like a great deal about Komodo is the inclusion of additional tools that are useful across languages, like the regular expression builder. Another powerful feature is the “Go to Anything” bar at the top center, where you can type to find most anything in your current project or the Komodo interface—a metaphor now common to many IDEs (Visual Studio Code, for instance) but always welcome when it shows up.
For linting, Komodo can integrate with PyChecker, Pylint, pep8, or Pyflakes, although support for each of these is hard-wired separately rather than available through a generic mechanism for integrating linting tools.
Some of Komodo 12’s most prominent new features revolve around integration with the ActiveState platform. Teams can configure and build custom runtimes for languages, with all the packages they need included. This is meant to ensure that members of a team don’t have to set up the runtime and dependencies for a project on their own; they can simply grab the same custom runtime with everything preloaded.
Now for the downsides. One of the biggest is the limited support for working with Python virtual environments. One has to manually create a venv, then associate the Python runtime for a project with that venv. Switching venvs for a given project requires digging into the settings for the project.
Komodo 12’s native Git integration is nowhere near as powerful as that of other IDEs. And while you can expand Komodo’s functionality with add-ons, there aren’t nearly as many add-ons for Komodo as there are for Visual Studio Code. What’s more, many of those add-ons don’t yet work in Komodo 12.
LiClipse / PyDev
The Eclipse Foundation’s Java-powered Eclipse editor supports many languages through add-ons. Python support comes by way of an add-on named PyDev, which you can use in two ways. You can add it manually to an existing Eclipse installation, or you can download a prepackaged version of Eclipse with PyDev called LiClipse. For this review I looked at the latter, since it provides the simplest and least stressful way to get up and running.
Aside from Python support, LiClipse also includes Git integration via Eclipse’s EGit add-on, support for Python’s Django web framework, and even support for Jython, the Python variant that runs on the JVM. This last seems fitting given Eclipse’s own Java roots, although Jython development has flagged as of late.
LiClipse makes good use of the stock features in the Eclipse UI. All keys can be remapped, and LiClipse comes with a stock set of key bindings for Emacs emulation. The “perspectives” view system lets you switch among a number of panel views depending on the task at hand—development, debugging, or working with the project’s Git repo.
Some of the best features come by way of plug-ins included in the LiClipse package. Refactoring History lets you track changes across a codebase whenever a formal refactoring takes place—something that in theory can be done with Git, but a dedicated tool like this comes in handy. Another truly nice feature is the ability to automatically trigger a breakpoint upon raising one or more exceptions, including exceptions you’ve defined.
LiClipse’s handling of virtual environments is hit-and-miss. While LiClipse doesn’t detect the presence of a venv in a project automatically, you can always configure and add venvs manually, and LiClipse integrates with Pipenv to create and manage them (assuming Pipenv is present in your base Python installation). There’s a nice GUI explorer to see which packages are installed in which Python venvs, and you can run pip from that GUI as well.
On the downside, it’s unnecesarily hard to do things like install new packages from a requirements.txt file, and it’s awkward to create a shell session with the environment activated in it—a common task that deserves its own tooling.
LiClipse comes with its own code analysis tools built-in, but can be configured to use Mypy and Pylint as well. As with Komodo, though, these choices are hard-wired into the application; there isn’t a simple way to integrate other linters not on that list. Likewise, the one test framework with direct integration into LiClipse is unittest, by way of creating a special run configuration for one’s project.
JetBrains makes a series of IDEs for various languages, all based on the same core source code. PyCharm is their Python IDE, and it’s built with an eye to support the characteristic work patterns and practices of Python developers.
This attention to workflow is evident from the moment you first create a PyCharm project. You’re given the option of setting up a virtual environment from the interpreter of your choice, with a sample main.py file in it. A convenient GUI lets you install modules to a virtual environment using pip, and the IDE will even autodetect requirements.txt files and offer to auto-install any missing dependencies. A fair amount of effort on Python projects gets eaten by wrangling virtual environments, so these features are very welcome.
You’ll find this same attention to workaday details throughout the IDE. For instance, if you run a file in your project with Alt-Shift-F10, PyCharm offers to remember that run configuration for future use. This is handy for projects that might have multiple entry points. When you kick open a command-line instance inside PyCharm with a project loaded, PyCharm automatically activates that project’s virtual environment. For users on low-powered notebooks, PyCharm’s “power save mode” disables background code analysis to keep the battery from being devoured.
Refactoring a project, another common source of tedium, also has a dedicated PyCharm tool. This goes beyond just renaming functions or methods; you can alter most every aspect of the code in question—change a function signature, for instance—and see a preview of what will be affected in the process. PyCharm provides its own code inspection tools, but a third-party plug-in makes it possible to use Pylint.
Python projects benefit from robust test suites, but developers often procrastinate on creating them because of the boilerplate involved. PyCharm’s automatic test-generation feature lets you generate skeleton test suites for existing code, then populate them with the tests as needed. If you already have tests, you can configure a run profile to execute them, with support for all of the popular testing frameworks (pytest, unittest, nose, etc.). There are other automated shortcuts as well. For a class, you can automatically look up which methods to implement or override when creating a subclass, again cutting down on boilerplate.
PyCharm can be expanded and tweaked greatly by way of the thousands of plugins available for it, which can be installed directly via PyCharm’s UI. This includes support for common data or text formats used with Python (CSV, Markdown), third-party tooling (Docker), and support for other languages (R, Rust).
PyCharm’s community edition should cover most use cases, but the professional edition (pricing here) adds some key features useful in enterprise settings, such as out-of-the-box Cython support, code coverage analysis tools, and profiling.