PyCharm’s top features

[Hidden] qualities of one of the most famous IDE for Python programming

Nicolò Gasparini
Analytics Vidhya

--

PyCharm is one of the heaviest IDEs I ever worked with, it’s slow, it requires too much ram and most of all I hate its indexing time. That said, I love it.

Old school coders might not agree, but let’s face it, an IDE is extremely important in terms of daily work, and the more it simplifies your work, the better. Here are some of the feature I like most about this one:

10. Bookmarks

When you have a large project, you often find yourself searching for some code snippets that you know could be the root of a problem or the usual entry-point where you start debugging for an error.

Bookmarks are very intuitive to use and don’t require many explanations, you simply mark a line of code (F11) and you can easily navigate back to it by opening all of your bookmarks (Shift+F11).

9. Search everywhere

This is actually one of my most used features, with a simple double-click of the Shift key PyCharm opens up a search tool that lets you search a term in python classes, file names, and other symbols.
The filter tools in the upper right corner are also useful to better refine your research.
This is essential to work fast on a big project.

An example of single notebook cells execution and debug

8. Jupyter notebook support

Professional feature only
If you’re working with python notebooks and python files simultaneously, you can easily switch between them in the same IDE.
PyCharm offers three different viewing modes and every other notebook’s necessary tool.

7. Node.js external debugger

If you program in python you might think “why would I need an external debugger for Node.js in PyCharm?”. But if you use python for web development, you’ll know that many modern setups have a JS server working somewhere at most times, especially for microservices-based architectures.

By installing these 2 optional plugins: Node.js and Node.js Remote Interpreter, PyCharm lets you insert a remote debugger by exploiting the “--inspect” function of Node.js.

To use it, just start a server with “--inspect” activated, it will expose a port that PyCharm can connect to, after that, you can create a Run/Debug configuration by choosing “Attach to Node.js/Chrome”. I’m going to leave here a more detailed official documentation guide.

The nice part of this is that it works whether your node server is running in a Docker container or in localhost (if you use Docker, remember to expose the --inspect port).

6. Docker interpreter

Professional feature only
I won’t rattle on about the importance and usefulness of Docker here, but if you appreciate it, PyCharm fully supports you in using a remote interpreter.

Easily setup a Docker based interpreter in 3 steps, PyCharm automatically selects your docker-compose file if found

Setting it up it’s easy, just set up your project interpreter by selecting Docker or docker-compose (even easier), and it’s done: PyCharm will automatically create the Docker container each time you’ll run something with this interpreter and attach another container to use the debugger.

An example of docker exec with a container already up and running, we launch a shell command (/bin/bash in this case) that lets us operate inside the container.

The only annoying downside I found is that you cannot run two or more run/debug configurations with the same Docker-based interpreter, because it will try to recreate a container, stopping the other one.
A useful tool to bypass this problem is to use docker attach or docker exec, you can use these commands in a command line or by using the graphic interface under the Services menu.

External libraries files are shown in a yellowish colour in the Darcula theme

Debug docker external libraries

If we are talking about Docker, it’s worth mentioning that, once you set up a remote Docker interpreter, PyCharm lets you see, just below your project root files, a list of “External Libraries”. This is true even for other interpreters such as virtual environments, but you may not know that if an external package is giving you some troubles, you can debug it as one of your own files, simply explore the path, set up a breakpoint, and debug it

An example of the scientific view showing a pandas DataFrame

5. Scientific view

Professional feature only
Pandas ranked 4th in the annual stack overflow survey this year as the most loved framework and if you work with it you’ll surely had the need to see what data you were working with and, let’s admit it, df.head() isn’t very handy.
PyCharm’s scientific view is extremely useful to view and debug DataFrames, as it permits you to directly evaluate filters, format data, and keep multiple datasets.

4. Auto formatter and import optimizer

These are a nice touch for order fanatics and perfectionists, these two features help you keep a clean code, following PEP8 standards, and even solving some troubles such as circular dependencies. It doesn’t quite work as a linter such as python black but PyCharm does let you select formatting options to use and what to format.

The optimize imports, try it with Ctrl+Alt+O

It’s an easy and clean way to keep your code formatted with a simple keyboard shortcut: Ctrl+Alt+L to format code and Ctrl+Alt+O to optimize imports.

PyCharm professional also lets you use these features for other languages such as JS.

3. Conditional breakpoints

A powerful function of the debugger is its conditional breakpoints.

The name says everything, you only stop the debugger when certain conditions are met, nothing simpler than that, yet extremely useful.

To activate a conditional breakpoint, simply add one and right-click on it.

2. Multi-cursor writing

This isn’t as useful as every other functionality listed above, but it’s extremely cool and gives you an incredible sense of power, which is the main reason why it deserves second place.
Often used for JSON files more than actual programming, it can still be a very nice time saver when you’re working with many similar objects.

1. Evaluate dialog

Defining a function in one evaluate window and using it in another. Alt+F8 to open the dialog window, Shift+Enter to switch from single line to multi-line.

This is just one of the most basics feature there could be in an IDE, but I believe PyCharm raised the bar a lot: with the evaluate dialog it provides a detachable, multi-line, multi-window tool that could easily let you write a whole application while remaining in the debug state.

You can of course use it to define or call functions and variables, change existing ones, test a function call for exceptions, and import missing packets, but its strong suit it’s the usability, you can even search and replace text inside of the window or maintain evaluation history.

While not being a feature of the evaluate itself, the Frames panel of PyCharm lets you easily switch threads in the history of your debug execution and evaluate variables as if you were there.

Bonus feature! Resolve conflict

Check out here the official documentation for this feature, this isn’t as catchy but boy is it useful! Once you get the hang of it, it will make your next conflicts a piece of cake.

This concludes my list of features of PyCharm, I wanted to recap some of the ones I mostly use in my daily work, hoping they could save others time as they do to me.

--

--

Nicolò Gasparini
Analytics Vidhya

Software Engineer and full stack developer 💻 based in Italy — /in/nicologasparini/