PyCharm 2019.2 Help

Configure profiles

Introduction

PyCharm lets you configure settings for your code validation analysis and save them as inspection profiles. You can customize the existing inspection profiles (including default profiles), and create new ones. You can also share, import and export inspection profiles.

PyCharm distinguishes between IDE and project profiles.

Stored in IDE

These profiles are saved in an application config directory (for example, ~/.PyCharmXXXX/config/inspection on Linux) and are available for any project.

Stored in Project

These profiles are saved in a particular project's .idea directory (for example, $PROJECT_DIR/.idea/inspectionProfiles on Linux).

Customize profiles

  1. In the inspection settings, select the profile to be changed.

    Select a profile

    Note that the default profiles are also editable.

  2. Customize the desired inspections: enable or disable, change their severity and the other options, which can be different for the various inspections.

    Note that the selectors of severity and scopes, and the options section (if any) are only available for the enabled inspections.

  3. To apply an inspection to a restricted set of files, associate it with the corresponding scopes.

    By default, all inspections apply to all the sources of the current project.

Note that inspections, whose state is changed relative to the default values, and all their grouping nodes are highlighted with blue.

Manage profiles

  1. In the inspection settings, select the profile you want to manage.

  2. Click Manage profile and from the list, select one of the following options:

    • Copy to IDE or Copy to Project - to copy the selected profile to either IDE level or the project level.

    • Duplicate - to make a copy of the selected profile. You can change the name of the profile in the Profile field.

    • Rename - to rename the selected profile.

    • Delete -to delete the selected profile.

    • Restore Defaults - to change the selected profile back to its default settings.

    • Add Description or Edit Description - to add a new or edit an existing description for the selected profile.

    • Export - to export the selected profile in a form of XML file. You can select where to export your profile.

    • Import Profile - to import the desired profile (XML file). You can select where to import your profile.

Inspection profiles keep information on the enabled inspections, the scope of files that they analyze, and their severity settings. In PyCharm, there are two types of profiles.

  • Profiles Stored in IDE are saved in the PyCharm configuration directory and are available for any project. You can copy the IDE profile to the current project using the Copy to Project option.

  • Profiles Stored in Project are saved in the .idea directory and are available within one project. You can copy the project profile to the IDE level using the Copy to IDE option.

PyCharm comes with two default profiles of each type (Default and Project Default) that you can customize, or create new ones. You can also share, import, and export inspection profiles.

Create a new profile

To create a new profile, copy one of the default profiles and change its settings.

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), go to Editor | Inspections.

  2. Select the profile that you want to copy, click the Show Scheme Actions, and select Duplicate.

  3. Change the profile name, and press Enter.

Duplicating a profile

Restore the default profile configuration

You can restore the default inspection settings: inspections enabled by default and their severity levels.

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), go to Editor | Inspections.

  2. Select the necessary profile from the list, click the Show Scheme Actions icon and select Restore Defaults.

Synchronize profiles between computers

Profiles stored in project are kept together with other project configuration files and are shared through VCS. That is why, after you configure a new project profile and share it with other members of your team, this profile will be automatically propagated to their projects after they check out the project from a VCS.

If you want to share a profile stored in the IDE, you can use the Settings Repository plugin that is bundled with PyCharm.

In this case, you have to configure this profile as the default inspection profile for all newly created projects (make it global). The plugin will promote this global configuration to all computers that are connected to the settings repository.

Share a profile stored in IDE

  1. Make sure that the settings repository is configured.

  2. From the main menu, select File | Other Settings | Settings for New Projects, and click Editor | Inspections.

  3. In the Profile list, select the profile that you want to share, apply the changes and close the dialog.

  4. From the main menu, select File | Settings Repository and click Overwrite Remote to send the new configuration to the repository.

  5. On another computer connected to the repository, go to File | Settings Repository and select Overwrite Local to download and apply the configuration.

Export and import a profile

To share a profile, you can also export it and then import it on another computer.

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), go to Editor | Inspections.

  2. Click the Show Scheme Actions icon and select Export.

  3. To import a profile, click the Show Scheme Actions icon and select Import Profile.

  4. Specify the path to the profile and click Open.

Last modified: 6 November 2019