It’s so lonely at the top of Olympus.
Zeus, the eternal king of the gods, faced some hard times while trying to maintain his reign. Hades nearly usurped his brother, Zeus, in a battle for control. As the battle raged, most of the the Gods took Zeus’s side, because who wants to mess a guy that shoots lightning, but some of the more disgruntled Gods took Hades’ side and the battle raged.
The back-end programming world is not unlike Mount Olympus. There is always a battle raging for supremacy, and in 2020, the battle still rages between Java and Python. And, like the ancient Greeks, most developers choose to “worship” one or two commonly used programming languages. However, unlike Ancient Greece, modern programmers are (slightly) more flexible.
There are coding polyglots out there who dabble in more than one back-end programming language, and do it using a single IDE. Some might call them blasphemers, we prefer to think of them as peacemakers.
If you happen to be one of those, and now looking to effectively program in Python (or Jython – a kind of mixture of both Java and Python) in Intellij IDEA – this post is for you! We’ve assembled a list of plugins that add Python coding functionality, and also to help you do it more efficiently.
Python in Intellij IDEA vs PyCharm
Before we dive into Python support on Intellij IDEA, it’s worth mentioning JetBrains’ standalone IDE for Python and Django – PyCharm. With a free community edition of PyCharm available for download (much like Intellij IDEA Community Edition for Java development) it’s no wonder PyCharm is the most popular standalone Python IDE and is widely favored by the pros. It offers a simpler UI for project management, IDE settings and other features.
The main advantage of the Intellij IDEA Python plugin over PyCharm is its full range of Jython support features (cross-language navigation, completion and refactoring). PyCharm only supports Jython as the runtime for running applications. So if you’re using Java/Python integration in your project, PyCharm alone won’t get the job done.
Another reason why this relationship between JetBrains IDEs is relevant is the fact that the plugins supported in PyCharm are usually compatible with Intellij IDEA. This makes perfect sense as it is based on the same IDE framework by Intellij.
So let’s start with the basics: installing the plugin to enable Python support in Intellij IDEA.
How to add Python to Intellij IDEA
To give your Intellij IDEA all the functionality of the popular PyCharm flavor of the JetBrains IDE all you need to do is install the official Python plugin by JetBrains.
The only thing to check before you download and install the Python plugin is the type of Intellij IDEA license you have. The Python plugin (that comes packaged in PyCharm) is compatible with the paid versions of Intellij IDEA (rather than the free community edition).
7 Python Plugins for Intellij IDEA
The basic plugin will give you smart editing for Python scripts, effectively expanding the functionality of Intellij IDEA to match that of PyCharm for all Python-related concerns and purposes. However, software professionals such as yourself have a few extra plugins up their sleeve to make you Python development on Intellij IDEA even more effective and productive.
As the name suggests, this plugin is a Python linter. It provides both real-time and on-demand scanning of Python files with Pylint from within you Intellij IDEA. Pylint is an open source project so it can be fully customized for your needs. In addition, Pylint has extensive documentation on the plugin website.
This handy little plugin is a smart alternative to the “Execute Line in Console” command. It automatically determines the number of lines to be sent to the Python console and is easy to access with a keyboard shortcut: alt shift A.
It’s worth noting that this plugin may become obsolete in the upcoming version of Intellij IDEA and PyCharm, as a request to implement it in JetBrains IDEs has been submitted in late 2019.
Not a Python plugin in the strict sense, Tabnine is programming productivity tool that helps you write better code faster. Tabnine uses GPT-2 to provide highly accurate code predictions in Python, and other languages too. Tabnine is now part of the Codota family but, honestly, we’ve always loved its amazing accuracy.
Mypy is an optional static type checker and source code analyzer for Python that aims to combine the benefits of dynamic (or “duck”) typing and static typing. Among others, it looks for programming errors, helps enforce a coding standard and sniffs for some code smells.
This plugin from the JetBrains plugin marketplace integrates MyPy into your Intellij IDEA. If you need some guidance, the MyPy website features extensive documentation to help you install and use MyPy to improve your Python code.
Developed by the JetBrains research division, this plugin promises to seek out potential bugs and quality issues in your Python code by using deep learning models. DeepBugs can detect bugs like incorrect function arguments, incorrect comparison, and others, based on extracted code semantics.
Why wait to run the program to see the magic happen? This plugin lets you run your Python code as you type it. It will display variable values, matplotlib, Pyglet, or turtle graphics in a dedicated panel on the right of your Intellij IDEA workspace.
This last plugin in our list is a handy collection of three inspections you can run on your Python code to attempt to detect potentially dead code and intentions for generating boilerplate code. This plugin will seek out potentially unused classes, functions (including methods) and names (in global and class-level assignments) in your code.
Beyond Python – Other Intellij IDEA Plugins
If you’re an experienced Intellij IDEA user, then you probably already have your favorite IDE plugins and theme installed. Just in case you don’t (or if you’re looking to expand your collection with a few time-saving productivity-improving gems), we’ve collected the top 21 plugins for Intellij IDEA. Our extensive list includes all you need to make the most of Intellij IDEA as a development environment – from AI coding assistants (like our own Codota plugin) to fun additions like the Nyan Cat progress bar.
This post was originally written by yours truly and published on the Codota blog.