Visual Studio Code - Hide __pycache__

To hide the Python cache folder “__pycache__” and the cache file “.pyc”, add the pattern of the file/folder you want to hide to the “files.exclude” setting.

pycache folder and .pyc file
pycache folder and .pyc file
After changing settings
After changing settings

Steps to hide “__pycache__”

  1. Click the “Manage” button in the “Side Bar”.
    Side Bar - Manage
    Side Bar - Manage
    Side Bar - Manage(enlarged)
    Side Bar - Manage(enlarged)
  2. Select “Settings” from the menu that appears.
    Manage menu - Settings
    Manage menu - Settings
  3. Select the scope of the settings on the “Settings” tab. There are “User” and “Workspace” tabs as shown in the image below. If you are not working on a workspace, “Workspace” will not be displayed. The difference between “User” and “Workspace” is shown in the table below (a brief explanation of workspaces is provided in a later chapter).
    User / Workspace
    User / Workspace
    User / Workspace(enlarged)
    User / Workspace(enlarged)
    User Overall settings. If there are settings for Workspace, they will take precedence over Workspace settings.
    Workspace Settings are only reflected in the workspace being worked on.
  4. Enter “files.exclude” in the search text box at the top of the screen to narrow down the settings items.
    Search text box
    Search text box
    Search text box(enlarged)
    Search text box(enlarged)
  5. When “Files: Exclude” is displayed in the settings, click the “Add Pattern” button.
    Files: Exclude
    Files: Exclude
    Files: Exclude(enlarged)
    Files: Exclude(enlarged)
  6. When a text box for entering patterns is displayed, enter the following pattern and click OK.
    **/*.pyc
    
    Input pattern to exclude .pyc files
    Input pattern to exclude .pyc files
    Input pattern to exclude .pyc files(enlarged)
    Input pattern to exclude .pyc files(enlarged)
  7. Click the “Add Pattern” button again and enter the following pattern in the text box for pattern input, then click OK.
    **/__pycache__
    
    Input pattern to exclude pycache folder
    Input pattern to exclude pycache folder
    Input pattern to exclude pycache folder(enlarged)
    Input pattern to exclude pycache folder(enlarged)
  8. The cache files will be hidden.
    After changing settings
    After changing settings
    After changing settings(enlarged)
    After changing settings(enlarged)

What is a workspace?

A workspace is a collection of folders and files opened in VSCode. Workspaces allow you to manage multiple folders and files together. You can also change settings for each workspace. For example, you can set font size to 14 for workspace A and font size to 16 for workspace B. Workspace settings are made on the “Workspace” tab.

Test Environment