avatarMartin Thoma

Summary

PyCharm Professional is a comprehensive Python IDE with advanced features like autocompletion, code inspection, and debugging, but it comes with a high cost and a cluttered interface.

Abstract

PyCharm Professional, developed by JetBrains, is a powerful Integrated Development Environment (IDE) tailored for Python development. It offers a suite of features including syntax highlighting, database and scientific view explorers, and extensive customization options for key bindings and UI components. Despite its robust capabilities, such as efficient autocompletion, code inspection tools, and a reliable debugger, it is critiqued for its expensive annual subscription of $89 for individuals, slow startup time, and a user interface that some find overwhelming. The article compares PyCharm to other editors like Sublime Text, noting the latter's simplicity and lower cost, but acknowledges PyCharm's superiority in professional development settings, particularly for those who require a feature-rich environment and can justify the cost.

Opinions

  • PyCharm Professional is considered expensive for beginners but valuable for professional developers due to its comprehensive features.
  • The IDE's startup time and certain UI elements, like the "do you really want to close me" pop-up, are seen as annoying hindrances.
  • PyCharm's autocompletion, code inspection, and debugging tools receive high praise for their effectiveness and contribution to code quality.
  • The database explorer and SciView are noted as useful but also raise questions about the necessity of such features within the IDE, considering the Unix philosophy of single-purpose tools.
  • The article suggests that while PyCharm offers a breadth of functionality, Sublime Text may be sufficient for many developers' needs, offering a more streamlined and cost-effective solution.
  • The cluttered interface of PyCharm is a point of contention, with some users preferring simpler, more focused editing environments.
  • Despite some criticisms, the author acknowledges the professional-grade capabilities of PyCharm, making it a worthwhile investment for those who need its advanced features.

PyCharm Professional — Python Editors in Review 👩‍💻

See what money can give you 🤑

PyCharm Professional 2020.2. The screenshot was taken by Martin Thoma.

PyCharm is an IDE developed by JetBrains since 2010. Yes, the same company that developed IntelliJ, the de-facto default for Java. It costs $89 per year for private people which is pretty expensive if you just get your feet wet with Python. It’s pretty cheap if you consider that the editor/IDE is one of the most important tools of a professional software developer.

It is used by many Python developers as one can see in the number of StackOverflow questions (12,455), in the 2019 Jetbrains Survey, and the 2019 StackOverflow survey.

Speed

It takes roughly 9 seconds on my ThinkPad T490s to start. Sublime Text takes less than a second. PyCharm also has this annoying “do you really want to close me” pop-up. When you close it, it automatically saves the document — but the edit history will be gone. This means you cannot to Ctrl+Z to undo edits.

When you create a new file, you have to decide first which type it has, which name it has, and where it should be stored. In Sublime Text, you just start typing.

The User Interface

In the screenshot above you can see how PyCharm typically looks for me. As PyCharm allows quite a bit of customization, you have to say it like this. Let’s go through the components of the UI:

  • The editor dominates the view. It supports syntax highlighting, shows the line numbers in the gutter, and the scroll bar indicates where it found warnings (yellow) and errors (red).
  • To the left of the editor, there is a file explorer.
  • To the right of the editor, there are two minimized elements that are pretty cool: A database explorer and the SciView. We will come to those later.
  • In the footer, there are also minimized elements. I like the problems and the terminal section.

Find Action

Find Action allows you to search for any menu. No more searching in deeply nested menus. It is similar to the Command Palette in Sublime Text.

If you have the Sublime Text key bindings, you can open the dialogue with Ctrl+Shift+P . It looks like this:

The screenshot was taken by Martin Thoma

In contrast to Sublime Text, PyCharm does not do a fuzzy search here.

Key bindings: Customizable Shortcuts!

If you go to File → Settings ( Ctrl+Alt+S ) and then to Keymap, you can select the defaults of other editors like Sublime Text. This makes a switch pretty easy. You also have a nice interface to set key bindings.

Tab Interactions

You can close a tab with Ctrl+W , create a new file with Ctrl+N , select the previous/next tab with Ctrl+Page Down / Ctrl+Page up . I haven’t found a way to jump to the first/second/n-th tab.

Jump to Line

Ctrl+G lets you go to a line. You can even specify the column you want to go to!

Goto File

Ctrl+P lets you go to any file in the workspace. No fuzzy search, though 😢

Find / Replace All

Ctrl+F to find something, Ctrl+H to replace. You can also use RegEx! Definitely a feature I don’t want to miss. This is pretty cool in combination with multiple cursors!

The screenshot was taken by the author.

Distraction-Free Mode and Zen Mode

Shift+F11 switches in distraction-free mode. You just see the code. No mini-map, no file explorer, no footer. This is helpful if you want to show another developer something. The Zen mode is even better 😃

Autocompletion

The autocompletion of PyCharm works well. PyCharm obviously makes use of type annotations 🎉

PyCharm automatically suggests using one of the attributes of the used class. The screenshot was taken by the author.

PyCharm also gives you hints when you create a new class or use a function:

PyCharm tells you that there are two parameters — x and y — expected. It also lets you know that you have to enter the first one now (x is bold) and that it should be a float 😍

Jump to Definition

F12 shows you the usage of the symbol under your cursor and brings you to the declaration of classes, methods, and functions. In contrast to Sublime Text, this works flawlessly in PyCharm.

Debugging

PyCharm comes with a proper debugger. Have a look at the following image:

The debugger of PyCharm. Screenshot was taken by Martin Thoma.

You can set a breakpoint at the line you’re interested in by clicking next to it (1). Then you click on the “debug” icon (2). PyCharm opens a variable explorer (3). Now you can decide if you want to step over / step into / step into my code / step out (4). It’s simple to use, but extremely valuable if you don’t have a clue what is going on.

Plugins

PyCharm comes has a Marketplace that offers 2354 plugins. For Python, I like Rainbow Brackets: If you have multiple brackets after each other, it becomes hard to read them. Rainbow brackets colors the matching brackets to support you.

Please let me know if you have any other plugin you use for Python!

Code Inspection

PyCharm has various linters that don’t have a comparable free static code analysis tool. They call this code inspection.

Code Inpsection within PyCharm.

Cool rules I’ve noticed are:

  • Spell checking: This works astonishingly well. Preventing typos is helpful because you don’t want to force downstream users to have to add typos e.g. if your function name was wrong.
  • Documentation: PyCharm can check your docstrings against the function signature. This is pretty amazing 😻

In my example repository mpu I had a couple of those. This is a repository where I try hard to follow good practices.

Database Explorer

The database tool window is a part of PyCharm where I don’t know yet what to think about it. One the one hand, it is useful. On the other hand, I like the Unix philosophy:

Make each program do one thing well. To do a new job, build afresh rather than complicate old programs by adding new “features”.

There are a couple of programs which fulfil the same purpose:

  • phpMyAdmin: For MySQL / MariaDB only
  • SQLite Browser: For SQLite only
  • Heidi SQL: MySQL, MariaDB, PostgreSQL, SQLite, Microsoft SQL Server
  • DBeaver: All databases which have a JDBC or ODBC driver, including MySQL, PostgreSQL, SQLite
  • Jetbrains DataGrip: Pretty much the same as the plugin, I suspect?

SciView

The Scientific View is essentially trying to offer the capabilities of a Jupyter Notebook within PyCharm.

More details can be found here:

42 more hints

PyCharm can do a lot. Way more than I can show you in this 6 minute article. Give the following video a try:

Comparison: Community Edition and Sublime Text

PyCharms community edition editor is pretty crappy. Don’t even give it a try.

In comparison to Sublime Text, one has to mention the big price difference. You can use Sublime Text pretty well for free. Even if you are super annoyed by the reminder to pay for it, it still is only $70 once for Sublime Text compared to $200 per year for PyCharm.

Sublime Text offers what you need in 90% of your development time. In those cases, it is faster and less cluttered. However, especially the missing debugger might be a deal-breaker for you.

Summary

PyCharm Professional is an amazing IDE for professional Python developers. I love that they have nice autocompletion, can jump to definitions, and have a working spell-checker integrated. The debugger is also sometimes super helpful.

On the downside, PyCharms interface is too cluttered. To me, the editor has too little screen space. The context menus are just crazy huge and the starting time is too long if you just want to edit a small file.

What’s next?

In this “Python for Beginners” series, we already explained how to use Python with WSL2 on Windows, how to use Python on Windows with Anaconda. The editor Sublime Text was introduced as a good minimal starting point.

This article briefly introduced PyCharm Professional. In a follow-up articles, you will see Visual Studio Code. Stay tuned!

Programming
Python
Ide
Software Development
Coding
Recommended from ReadMedium