Fundamentals 24 min read

Master PyCharm: From Installation to Advanced Features for Python Development

This comprehensive tutorial walks you through installing PyCharm, creating and running Python projects, debugging, testing, navigating large codebases, integrating version control, using plugins and external tools, and exploring professional features like Django support, all illustrated with step‑by‑step screenshots and shortcuts.

ITPUB
ITPUB
ITPUB
Master PyCharm: From Installation to Advanced Features for Python Development

PyCharm Installation

PyCharm Community Edition 2019.1 can be installed via the JetBrains Toolbox App, which simplifies installing, updating, and removing JetBrains products. After launching the Toolbox, select PyCharm Community and click Install . Accept the user agreement, then the IDE is ready.

Toolbox installation UI
Toolbox installation UI

On first launch, PyCharm shows an import settings dialog; choose Do not import settings , keep the default keymap, and select a UI theme (the tutorial uses the Darcula dark theme).

First‑run settings dialog
First‑run settings dialog

Writing Code in PyCharm

Create a new project via File → New Project . Choose a location, select a Python interpreter (the tutorial uses a virtualenv based on Python 3.6), and keep the default settings. Click Create to open the project.

New Project dialog
New Project dialog

After the project opens, create a new Python file (e.g., guess_game.py) using Cmd+N (macOS) or Alt+Ins (Windows/Linux). Write the following simple guessing‑game code:

import random

random_int = random.randint(1, 100)

while True:
    user_guess = int(input("Guess a number: "))
    if user_guess == random_int:
        print("Congratulations! You guessed it.")
        break
    elif user_guess < random_int:
        print("Too low!")
    else:
        print("Too high!")
Editor with code
Editor with code

Running Code

The program can be executed in three ways:

Press Ctrl+Shift+R (macOS) or Ctrl+Shift+F10 (Windows/Linux).

Right‑click the editor background and choose Run 'guess_game' .

Click the green arrow next to the __main__ block.

The Run tool window displays the program’s output.

Run output
Run output

Debugging

Set a breakpoint on line 8 (the if statement) by clicking the gutter. Use one of the following to start debugging:

Ctrl+Shift+D (macOS) or Shift+Alt+F9 (Windows/Linux).

Right‑click the background and select Debug 'guess_game' .

Click the green arrow next to the __main__ block and choose Debug .

The Debugger window shows variable values (e.g., random_int). Step through the code with F8 (step over) or F7 (step into). Use the Console tab to interact with the program during debugging.

Debugger window
Debugger window

Fix the bug by changing the erroneous randint comparison to random_int, then re‑run the debugger to verify the corrected flow.

Testing

PyCharm supports several test frameworks; the tutorial uses the built‑in unittest. Create calculator.py with a simple Calculator class, then generate a test file via Shift+Cmd+T (macOS) or Ctrl+Shift+T (Windows/Linux) or via the Navigate → Test menu.

Calculator class
Calculator class

Run the tests using Ctrl+R (macOS) or Shift+F10 (Windows/Linux), or via the Run context menu. The test runner shows passed and failed tests, and you can filter, sort, or ignore tests directly from the UI.

Test runner UI
Test runner UI

Editing Existing Projects

Open an existing project via File → Open or the welcome screen. PyCharm automatically detects a virtual environment and sets it as the project interpreter. You can change the interpreter later in Settings/Preferences → Project → Project Interpreter .

Project interpreter settings
Project interpreter settings

Search and Navigation

Use Cmd+F / Ctrl+F to search within the current file, Cmd+Shift+F / Ctrl+Shift+F for a project‑wide search, Cmd+O / Ctrl+N to find a class, and Cmd+Shift+O / Ctrl+Shift+N to locate a file. Press Shift twice to invoke the universal search.

Go to declaration: Cmd (macOS) or Ctrl (Windows/Linux) + click.

Find usages: Alt+F7 .

Recent changes: Shift+Alt+C or View → Recent Changes .

Recent files: Cmd+E (macOS) or Ctrl+E (Windows/Linux).

Navigate back/forward: Cmd+[ / Cmd+] (macOS) or Ctrl+Alt+Left / Right (Windows/Linux).

Version Control Integration

PyCharm integrates with Git, Mercurial, Perforce, and Subversion. Enable VCS via VCS → Enable Version Control Integration… and select Git . The VCS Operations Popup then provides shortcuts for add, commit, push, etc.

VCS popup
VCS popup

Commit changes via Cmd+K (macOS) or Ctrl+K (Windows/Linux). Resolve merge conflicts using the built‑in merge tool, which shows your changes, the incoming changes, and the merged result.

Merge conflict resolver
Merge conflict resolver

Plugins and External Tools

Extend PyCharm’s functionality via the Marketplace. Popular plugins include IdeaVim (Vim emulation), Material Theme UI (dark UI), Vue.js , and Markdown . Install plugins via Settings/Preferences → Plugins → Marketplace .

Plugins marketplace
Plugins marketplace

External tools such as flake8 can be added under Settings/Preferences → Tools → External Tools . Define the program path, arguments (e.g., $FileName$), and working directory. Optionally assign a keyboard shortcut via Keymap → External Tools .

External tool configuration
External tool configuration

Professional Features

PyCharm Professional adds built‑in support for Django, database tools, thread‑concurrency visualization, profiling, and scientific mode. Enable Django support via Settings → Languages & Frameworks → Django → Enable Django support . The IDE then provides template completion, ORM navigation, and manage.py integration.

Django settings
Django settings

Database tools (based on DataGrip) support MySQL, PostgreSQL, SQLite, Oracle, and more, allowing you to run queries, edit schemas, and view data directly from the IDE.

Database tool window
Database tool window

Thread Concurrency Visualization helps debug asynchronous code (e.g., asyncio, Django Channels). Profiling can be performed with vmprof, yappi, or the built‑in cProfile to identify performance bottlenecks.

Conclusion

PyCharm is a powerful, feature‑rich IDE for Python development. By following this tutorial you should now be able to install the IDE, create and run projects, debug efficiently, write and run tests, navigate large codebases, integrate version control, extend functionality with plugins, and leverage professional tools for web and scientific development.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DebuggingtestingVersion ControlPyCharmPython IDEProfessional Features
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.