Basic Pycharm features [2020]

Listen as audio
Image by 200 Degrees from Pixabay

Hello Techies,

In this blog, I’m going to tell you about my favorite IDE for Python development which is Pycharm. So I’m covering some basic features of pycharm 2020.

What is Pycharm used for?

pycharm features
pycharm features

PyCharm is the most popular IDE (Integrated Development Environment ) used for the Python-based application. Pycharm is developed by the Czech company JetBrains.

Some of the organizations such as Twitter, Facebook, Amazon, and Pinterest use PyCharm as their Python IDE!

We can run PyCharm on Windows as well as on Ubuntu OS.

Pycharm Download

For Pycharm Windows

https://www.jetbrains.com/pycharm/download/#section=windows

For Pycharm Ubuntu

https://www.jetbrains.com/pycharm/download/#section=linux

Basic Pycharm Features

Changing Theme

File → Settings → Appearance & Behavior → Appearance → Theme

The most useful Pycharm Features is changing the Font style

1. For font type:- File → Settings → Editor → Font
2. For font size:- File → Settings → Editor → Size
3. For font Line spacing:- File → Settings → Editor → Line spacing

The most useful Pycharm Features for changing the general appearance

1. Show line number: - File → Settings → Editor → General → Appearance → Show line
    numbers
2. Show method separators:- File → Settings → Editor → General → Appearance → Show 
    method separators
3. Show white spaces:- File → Settings → Editor → General → Appearance → Show white 
    spaces 

keyboard shortcuts

File → Settings → Keymap

Tab placement option

You can change the tab’s position(top, right, bottom, left, None) as per your comfort: Right-click on any file tab and select tab placement option or location is below

File → Settings → Editor → General → Editor Tabs → Placement

When there is a light-bulb tip that appears on the left, use Alt+Enter to pull up the suggested fixes.

If you want to pull up the suggested fixes from that light-bulb tip which appears on the left side of the text, use Alt+Enter.

Split windows

Right-click on the tab and select option split horizontally and split vertically as per your requirement.

To expand and collapse all code blocks

CTRL+SHIFT+Plus and CTRL+SHIFT+Minus

To expand and collapse selected code blocks

CTRL+Plus and CTRL+Minus

To check the local history of your project

VCS → Local History → Show History

Find in Path

Edit → Find → Find in Path or using the shortcut CTRL+Shift+F

Replace in Path

Location: Edit→ Find → Replace in Path or using the shortcut CTRL+Shift+R

Debugger

Right Click on my script name → Debug ‘test’ or Run → Debug ‘test’ and By using breakpoints and the debugger mode, you can easily evaluate your variables at any place in your code.

Python Console

When you need to test some python operations you can use the Python console.

Modify multiple lines

For modifying multiple lines at once you can create multiple cursors by holding the ALT key and clicking and you can perform any action on it. Like the below image

Todo comment

If you want to leave yourself a reminder use the tag # todo xyz. To see all of the todos of the entire project you can use the TODO panel (Alt-6).

Comment and uncomment

select code which you want to comment or uncomment and click Ctrl+/

Reformat code

Code → Reformat code or Key → Ctrl+Alt+L

How to create a virtual environment in Pycharm?

Pycharm Editor also creates a virtual environment inside the project folder. This is one of the coolest feature from pycharm features.

  1. Go to file click on New Project and select the path and add your project name. It will create a project folder with a virtual environment.
  2. If you have created any folder and under that folder, if you required virtual environment then just open that folder in pycharm and go to below location
File → Settings → Project:’project_name’ → Project Interpreter (No Interpreter) and click on that wheeler → Virtual Environment → Click OK

How to Run an application in Pycharm

After creating the virtual environment now we have to install Django using pip. For that just open the terminal in pycharm which you will get at the bottom. Click on the Terminal and simply write the below command.

pip install django

To create a Django project write below command

django-admin startproject demo

Now change the directory to demo

$ cd demo

Run Django project 

python manage.py runserver

These are some basic useful pycharm features and I hope you understood it. Still, if you are facing any issues while using these pycharm features do comment below.

Leave a Comment