PyCharm 2017.3 Help

Configuring Content Roots

Introduction

Any project contains at least one content root created together with the project.

You can create additional content roots as well as remove the unnecessary ones.

Creating a content root

  1. Open the Project Structure settings.
  2. In the Projects pane of the Project Structure page, click the project you want to configure content roots for.
  3. In the Content roots of the Project Structure page, click the Add Content Root button /help/img/idea/2017.3/addRoot.png.
  4. In the dialog that opens, locate the desired directory and click OK.
    /help/img/idea/2017.3/py_addContentRoot.png

Removing a content root

Specifying folder categories

Here is how you assign a folder to a different category. In a similar way, you can assign a folder to any other category. This can be done both in the Project tool window and on the Project Structure page of the Settings/Preferences dialog.

To assign a category to a folder in the Project tool window, follow these steps

  1. Open the Project tool window (e.g. View | Tool Windows | Project).
  2. Select the folder that you want to assign to a certain category.
  3. In the context menu, point to Mark Directory As and select the desired category.
    /help/img/idea/2017.3/py_mark_directory_project_tool_window.png

In a similar way you can change the folder category at a later time. (Just select a different category from the context menu.)

To cancel the folder association with its current category (i.e. to make a folder an "ordinary" folder /help/img/idea/2017.3/folder.png), select Unmark as <current_category> Root. (e.g. Unmark as Test Sources Root).

To assign a category to a folder in the Project Structure page, follow these steps

  1. Open Project Structure page of the Settings/Preferences dialog.
  2. Select the folder you want to assign a category to.
  3. Click the category button, for example, root_Source.png.

Exluding files and folders by name patterns

You can make files and folders excluded by specifying the name patterns. Use the Exclude files field to specify the patterns.

/help/img/idea/2017.3/exclude_by_name_pattern.png

See Also

Last modified: 15 September 2017