Getting Started with PyCharm. Exploring the IDE comm prof

Welcome to PyCharm! This short guide aims to help you get a grip on the PyCharm IDE.

Before You Start…

Make sure that at least one Python interpreter, version from 2.4 to 3.3 is properly installed on your computer.

Important Note

PyCharm comes with several pre-defined keymaps; so if you are used to working with TextMate, Visual Studio, or Eclipse, you can just select your favorite keymap (File | Settings - IDE Settings - Keymap).

In this quick start guide, we use the default one. If you want to use a different keymap, keep in mind that certain commands have different mappings, or no mappings at all. If this is the case, refer to the section Configuring Keyboard Shortcuts to learn how to create the missing mappings.


Everything you do in PyCharm, is done with the context of a project. What is most interesting about PyCharm, is the possibility to open multiple projects in one frame. When you create a new project (File | New Project), or open an existing one (File | Open Directory), PyCharm suggests you to choose which way you want the project to be opened: in a new window, in the same window after closing the previously opened project, or added to the previously opened project.

You can have as many projects opened in one window as required. So doing, the first project is considered the primary project. All the symbols of the added projects are visible from the primary project.

See also:

Customize Everything!

IDE & project configuration settings

Look at the main toolbar — there is the Settings button settings. Clicking this button opens the Settings dialog box, where you can change your project structure, set up version control, and tweak your working environment to make the development process a real pleasure. Some of the settings pertain to a particular project - for example, project structure, version control configuration, or file colors. The others - like the Editor settings, keymaps, or live templates - pertain to your whole working environment, and thus can be configured even without an open project.


Surely, you keep your sources under a version control, right? Git? SVN? With PyCharm, it's easy to set up, and again the IDE does a good job auto-detecting the VCS already used for existing projects. But you can fine-tune — just click Version Control node in the Settings dialog (Settings dialog | Project Settings | Version Control). By default, you will see project root directory only, but you can break your application down into smaller chunks, and place virtually every directory under its own version control system.

In the Settings dialog, you can also define some behaviors that are common to all version control systems: confirmation on creating or deleting files, tasks performed in the background, ignoring unversioned files and more.

File Colors

You project might contain several sites, each one with its own set of files with the same names (__init.py__,,, When they are opened in the editor, it's rather confusing... How can one tell which site they belong to? PyCharm helps make them different by painting their editor tabs (Settings dialog | Project Settings | File Colors). You have to break down your project into smaller chunks - scopes (for example, a scope per site), and select a color for each one.

IDE and Editor

Code colors customizations

Working in an IDE actually means living in it, and it is quite natural to make your haunted place pleasant for your eyes and comfortable for your fingers. That's why PyCharm makes it possible to choose the look and feel of the IDE and the editor, configure your preferred set of keyboard shortcuts (keymap), fine-tune scrolling behavior, highlighting, and more.

All these settings are (again) configured in the Settings dialog: click settings, and see the list of pages under the IDE Settings heading. Here are three pages that might be of interest for the starter: Appearance, Editor, and Keymap.

This is the page where you can select "look and feel" of your PyCharm installation (Settings dialog | IDE Settings | Appearance). Just click the Look and feel drop-down, and select the scheme you like better. You don't need to close the Settings dialog to observe the results of your experiments: click Apply, see what happens, and close the dialog when you are quite happy with what you've got.

The whole bunch of pages under the Editor node (Settings dialog | IDE Settings | Editor) helps you tune every aspect of the editor's behavior. Note that PyCharm comes with the pre-defined color scheme, but if you want to make up something very personalized, you are welcome to do it: save the default scheme with a new name, and start changing its background, font, colors of syntactical elements, error highlighting etc., and immediately observe results in the preview pane.

The set of keyboard shortcuts you work with is one of your most intimate habits - your fingers "remember" certain combinations of keys, and changing this habit is rather painful. With this in mind, PyCharm supplies you with a wide range of pre-defined keymaps (Settings dialog | IDE Settings | Keymap), for those who prefer Eclipse, or for those who've had long experience with Visual Studio... You can create you very own keymap on the base of an existing one.
And finally, there is a magic shortcut Ctrl + Back Quote that helps you switch between schemes (all of them - keymaps, colors, code styles, and L&F) without the Settings dialog (for Windows and Linux users only).

See also:

Write Code Smartly

What makes PyCharm stand out from the numerous IDEs, is its full-featured editor. Whatever you do for developing your source code, PyCharm is always at hand, helping you create error-free applications. Here is a brief outline of the smart PyCharm's coding assistance:

Code completion
  • At every stage of development, use code completion
    (Ctrl+Space ⌃Space), which takes into account the current context. For example, depending on the place where you invoke code completion, you can complete keywords or code blocks, infer types, or complete methods and properties.
  • Use live templates/snippets (Ctrl+J ⌘J) or surround templates (Ctrl+Alt+J ⌘⌥J) to produce entire code constructs. PyCharm comes with a wide range of ready-to-use live templates, or snippets, which you can explore in the Settings dialog (Settings dialog | IDE Settings | Live templates). If you see that you are lacking something especially important for your development goals, extend this set of snippets with your own ones. Don't also miss the possibility to surround with complete code constructs (Ctrl+Alt+T⌘⌥T).
  • Almost like a pair programmer, PyCharm keeps an eye on what you are currently doing, and comes up with smart suggestions, or intention actions, which are marked with a light bulb sign. If you want to know exactly what is there under the light bulb, click it, or press Alt+Enter ⌥↩. This way you can, for example, auto-create a new method that you are already using in the code, but have not yet declared.
See also:
Live templates/code snippets
Intention actions (quick fixes, refactorings, etc.)

Analyze Code Transparently

Code inspection

PyCharm gives you numerous hints and prompts to help you avoid errors, or correct them, if they occur.

First, as you type, you immediately have all syntactical errors underlined with a wavy line. If you place the caret at an error location, you will see a brief description of the problem at the tooltip, and also in the left side of the Status bar.

The next level is static code analysis, or code inspections: your code is analyzed without actually executing it. Actually, PyCharm inspects code in the current file on-the-fly, and shows inspection results in the marker bar as colored stripes. If you see that the right side of your IDE frame is bright with red stripes, beware — it means that your code contains serious errors. Less important things, recommendations to improve code, or warnings, are displayed as yellow stripes. Information for the current file is summarized in a colored indicator on top of the marker bar, which works as traffic lights: green means that everything is fine; at least one problem turns the indicator yellow or red.

Code inspection

By the way, this guy in the Status bar - Hector - keeps an eye on each file currently opened in the editor. By default, Hector never sleeps. If you are sure of yourself, turn him off, and you will get neither warnings, nor suggestions for improvements or error messages.

However, you might want to look deeper into the code of your application. In this case, you have to inspect a whole project, or any of its parts (Code | Inspect Code), and explore results in the Inspection tool window. PyCharm comes with a wide range of pre-defined inspections; you can familiarize yourself, and configure them in the Inspections page of the Settings dialog.

See also:
Inspecting source code

Find Your Way Through

Navigation facilities of PyCharm fall into these major areas:

Source Code

Let's start with finding fragments of text. One of the most basic means of navigation and search in the source code is our good old Ctrl+F⌘F command: start typing your search string, and get immediately to its occurrences in the current file:

But PyCharm goes further, and helps you look for a certain string within a directory, or any arbitrary scope, or an entire project (Ctrl+Shift+F⌘⇧F).

Besides that, PyCharm suggests a more sophisticated approach, namely search for usages. For example, if you want to navigate from a symbol to one of its usages within your application, press Alt+F7⌥F7, or choose Find Usages on its context menu:

Actually, there are several commands that help you find out where a certain symbol is used: you can jump from one usage to another in the current file (Ctrl+F7⌘F7), view usages in the current file color-coded (Ctrl+Shift+F7⌘⇧F7), or across a whole project in a popup list (Ctrl+Alt+F7⌘⌥F7).

If you want to jump from a symbol to its declaration, just middle-click its name, or press Ctrl+B⌘B.

To quickly find an element by name and open it in the editor, use navigation pop-up: press Ctrl+N⌘N (for a class), Ctrl+Shift+N⌘⇧N (for a file), or Ctrl+Shift+Alt+N⌘⇧⌥N (for a symbol), and start typing the name you are looking for. The list of matching names shrinks as you type, but this is just one of the handy facilities: you can use the asterisk wildcard, all caps for CamelHumps, or spaces for snake_case names, slashes for nested folders and so on, and so forth.

Quick search is the easiest way to find a file: with the Project tool window having the focus, you just start typing, and see how the matching nodes are highlighted in the tree view. Actually, this method of finding files or symbols works in any tool window.

Navigate to file

IDE Components

Switch between IDE tabs and tool-windows

Ways to navigate across the IDE are numerous, and we'll briefly outline just some of them. Let's start with the switcher: press Ctrl+Tab⌃Tab to show the switcher, which is a list of the PyCharm's tool windows and open files, and then, keeping the Ctrl key pressed, use Tab or arrow keys to scroll to the component you want to go to.

If you select a file in one of the IDE components, and want to view it in another one (the editor, Project view, Navigation bar, or a changelist), then use Select Target (Alt+F1⌥F1):

And finally, don't forget that pressing Esc will bring you back to the editor, wherever you are!

See also:
"Go to File" demo
Navigating to Class, File or Symbol by Name

Run and Debug Your Application

Quickly run your python application

While working with PyCharm, you'll come to a moment when you need to run or debug an application, a script, or a test. In all these cases, you need a special profile, or a run/debug configuration, which defines script name, working directory, environment variables, and other vital things.

Integrated Python Console

For each of the elements that can be run, there is a default profile, and you can easily launch such an element from its context menu, or with a handy shortcut Ctrl+Shift+F10 ⌘⇧F10. However, if you want to use some other run/debug configuration, you have to choose one on the main menu, and then press Shift+F10⇧F10.

PyCharm also helps those who love the full control of an interactive console: on the Tools menu, you can find commands that launch the interactive Python or Django consoles. Here you can type commands and execute them immediately. Moreover, PyCharm's interactive consoles feature syntax highlighting, code completion, and allow scrolling through the history of commands (Ctrl+Up/Down⌘Up/Down).

Python debugger with breakpoints

Oops... your application or script runs into a run-time error? To find out its origin, you will have to do some debugging. It starts with placing breakpoints (quite simple - just click the left gutter of the line where you want the breakpoint to appear), at which program execution will be suspended, so you can explore program data:

Launching the debugging session is quite as simple: either use the context menu of a specific script, or select a suitable run/debug configuration, and then press Shift+F9 ⇧F9.

And finally, a very convenient way to select run/debug configuration and immediately launch it is Alt+Shift+F10⌥⇧F10/ Alt+Shift+F9⌥⇧F9.

That's it folks!

Here we have given a very concise overview of some vital PyCharm basic facilities, just to give you a quick start. There are numerous important features that make developer's life nice and easy, and the source code nice and clean. Try now these primary steps, and then dig deeper. Enjoy!

We realize you may still have questions. We welcome you to ask them on PyCharm Discussion Forum.