♦ πŸ† 2 min, 🐌 4 min

🐍 Python: PyCharm, The editor

PyCharm created by JetBrains is a python interactive development environment (IDE) that's so smart it will teach you how to write better more, readable code.

JetBrains has other editors for pretty much every possible language out there, and all of them are insanely powerful.

Why?

Well if you already have another editor you use (Atom, Visual Studio, ...) that you use and are familiar with. Stick with what you know. If you are a complete novice in the software world I would recommend it.

The really nice thing about PyCharm is that it has out of the box support for majority of the feature that you need from an editor. Sure you can customise pretty much any editor to work the way you want but as a novice you don't know what you really want and need. In that case I would recommend to go with PyCharm and first learn how to really code. Then enter the editor wars.

Get the tool

Get the free community version of the software here .

If you're a student, you can also get the professional licence for free.

Or install PyCharm with a package manager on macOS:

brew install pycharm

Find the app and start it up:

You'll be greeted with the following prompt:

Create a new project

You can use the New project option:

Enter the location of the project and the virtual environment that you want to use. Or you can import/open an existing project from your disk.

I prefer to start the project structure through the command line using mkdir, touch, ... and then just open the project in PyCharm. For some reason, I find it more manageable.

Although if you're using the editor for the first time, create a new project with PyCharm directly, to get the feeling for the editor.

The run/play button

The green fancy button allows you to "play" or execute the script:

Oh and the command line is also built into the editor and will pop up once you run the script.

In the above example, the IDE configured the interpreter for us, but sometimes we have an existing project and need to set it up ourselves.

Setup the interpreter

Sooner or later, you'll have to import an existing project and setup the interpreter for it.

Go to the top right corner:

select the script you want to run, and this UI will open:

This should be self-explanatory.

You can edit and run a lot of other languages from PyCharm. Support is not as good as for python, but I've been using it for all web development, editing in JavaScript, CSS, HTML and it's been pretty nice.

Split view, tabs

Split views and tabs are pretty cool:

Autocomplete, syntax highlighting, code collapse

You have out of the box code completion at your fingertips:

You can collapse parts of the code to focus only on the part you're working on. Supper useful for longer scripts.

Git mode

On the left-hand side next to each line number, you can see the code changes that are new and still uncommitted:

You can also perform git branch comparison, ...

Vim mode

Yes, you can turn on vim mode. Customisation is not as easy and versatile as in the command line, but it's really powerful.

Mark directory as root

By default the top folder of the project is set to root. So if you have the startup script somewhere else than in the root folder, you might want to tell PyCharm where.

Why? So the editor can properly recognise module paths, imports, ...

Wrap up

There are so many other features in PyCharm that it doesn't make sense to cover them here. But in general, the tool can do a lot. If you write in python, use it and never look back.

🐍 Python series:

Get notified & read regularly πŸ‘‡