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.
2. Python Smart Execute
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.
Webstorm Pycharm Download
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.
5. DeepBugs for Python
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.
6. Live Coding in Python
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.
7. Python Enhancements
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.
Early Access Program
Week five of the EAP brings us to the final v2021.1 build before we introduce the release preview. In this build, you can test WSL 2 support for Maven and Gradle projects, SSL support in the HTTP client and its UI updates, a possibility to query JSONPath, and more.
To try out all the updates, you can download the latest build from our website, get it from the Toolbox App, or update using snaps if you’re an Ubuntu user.
Here are the most significant updates for week five.
WSL 2 support (part 2)
If your Maven or Gradle projects are stored in WSL 2 (wsl$<Linux distribution name><path to project>), you can now open them in IntelliJ IDEA and work with them in the WSL 2 environment.
Frameworks and Web
UX and UI updates in HTTP Client
When you run a request from the HTTP client, the IDE opens the Services tool window. It is now possible to collapse the returned HTML, JSON, or XML by clicking on the minus icon next to it.
The right vertical pane has been given a new look. Response view settings are now grouped under the ‘eye’ icon. When you click on it, you can choose to show line numbers and the format for viewing the response. What’s more, it is easy to scroll to the top and to the bottom of the response by clicking the respective icons.
The last new icon ‘Copy Response Body To Clipboard’ allows you to copy the response body without all the additional info that the full response contains.
SSL support in HTTP client
If you use SSL client authentication for https:// protocols, you can now define SSL settings in the HTTP Client by clicking Add environment file and selecting Private. The IDE will automatically create a file where you can add your SSL configurations.
- 'clientCertificate' – Enter a path to the client certificate, which can either be protected by a password or a key.
- 'hasCertificatePassphrase' – If you set it to true, click the ‘pen’ icon in the gutter to enter a password for the client certificate.
- 'clientCertificateKey' – Enter a path to the client certificate key.
- 'verifyHostCertificate' – Set it to false if you want to disable the server certificate verification by a client. This may be useful when creating test certificates.
UX improvements for JPA
In projects that include JPA entities, you will find redesigned and improved icons in the gutter. They are now clickable and contain a list of the most useful actions for entities and their attributes.
We’ve also improved JPA support for Kotlin and multi-module projects.
JPA Console for Jakarta EE 9
In v2021.1, the JPA console for writing and running JPQL queries is available for Jakarta EE 9 projects.
We continue to improve the experience of using Spring in IntelliJ IDEA. Here is the list of the issues we’ve addressed so far:
- Added support for the javax.annotation.Priority. It is now possible to navigate to the correct autowired bean.
- Improved the processing of the @ConditionalOn annotations in Spring Boot.
- Fixed issues with custom qualifiers, autowiring false-positives, composed annotations for @EnableJpaRepositories in Spring Data JPA. We’ve also addressed issues with code configuration support in Spring MVC, @EndpointId and @ServiceActivator annotations in Spring Integration.
There is some good news for people using JSONPath, a query language that allows you to find different code elements in a JSON document: IntelliJ IDEA now supports JSONPath expressions with the Goessner and Jayway syntax.
For JSON files, call the new action via Edit/Find/ Evaluate JSONPath Expression to open a dedicated tool window. The search field has code assistance to help you write your queries quickly and apply various complex filters. You can also choose how to display your query output: either as a value or a path to the desired data.
For code that uses JSONPath expressions, place a caret inside a JSONPath string, press Alt+Enter, and select Evaluate JSONPath Expression. The action will open a dialog that offers the same functionality as described in the previous paragraph and additionally an area where you can enter a sample JSON input.
New color scheme for UML Diagrams
If you use a light theme, this update is for you. The UML Diagrams now use a new color scheme that makes them look neater and more readable.
Swagger UI now supports specifications with external file references ($ref).
The Structure view for specification files now also features more nodes including Security, Callbacks, and Examples.
Selenium Page Object Generator
We’ve added support for a new tool that allows you to detect DOM elements of a web application. You can access it via Tools Generate Selenium Page Object. Keep in mind that you must install the Selenium UI Testing plugin beforehand.
Enter the web page address in the URL bar and click the target icon next to it. You can now select any DOM element. Click on the plus icon in the left-hand pane to add this element to the area below. Once the code is there, you can change its language or framework. Our tool supports Java, Kotlin, and Groovy and such frameworks as Selenium, FluentLenium, Selenide, Geb, Atlas, and JDI Light.
You can customize the code templates of each framework by selecting Selenium Page Object Templates in Settings/Preferences Editor File and Code Templates.
Language injection improvements
You can insert code written in a different language into your Kotlin code – we call this language injection. In v2021.1, we’ve fixed some of the language injections issues that received the most votes.
First, when you use triple quotes to inject multi-line strings and add the .trimIndent(), or .trimMargin() functions at the end, the lines inside the triple quotes are highlighted correctly, and the mentioned functions work as expected.
Second, language injection works correctly when you concatenate strings.
In this EAP, you can test Kotlin code visualization via UML Class diagrams. You can build a diagram either from the Project view via Diagrams Show diagrams Java classes or from the editor by selecting a class name and pressing ⌥⇧⌘U on macOS or Ctrl+Alt+Shift+Uon Windows or Linux.
Currently, the diagrams only show inheritance and nesting relationships, but we plan to support more detailed association connections, like aggregation, construction, dependency, and others.
Run and debug Gradle, Micronaut, and Quarkus projects in Docker and on remote machines
We continue to improve the Run Targets feature that we recently introduced. You can now run and debug Gradle, Micronaut, and Maven-based Quarkus projects in Docker containers and on remote machines connected via SSH.
We are polishing this feature, so we’d appreciate your feedback. The answers to these questions will help us make it more convenient and effective for you: Do you often have to debug apps running remotely? Does the feature work for your project setup? If not, please tell us what is missing.
These are the major updates for EAP 5. Check out the whole list of resolved issues in the release notes. We’ll appreciate your feedback in the comments below, on Twitter, or via our issue tracker.
Webstorm Pycharm Tutorial