Skip to content

Product Package Management

Brett Cannon edited this page Sep 3, 2020 · 7 revisions

Overview:

The extension depends on a number of 3rd party tools such as pylint, flake8, etc for various features. These 3rd party tools are installed on demand based on the usage of the feature. E.g. when using flake8, the extension attempt to use flake8, if there are errors and the error indicates the module isn't installed then the user will either be presented with a prompt to install it or the extension will install it for the user.

Products and Product Types

Each tool is treated as a separate product within the extension: https://github.com/Microsoft/vscode-python/blob/main/src/client/common/types.ts

export enum Product {
    pytest = 1,
    nosetest = 2,
    pylint = 3,
    flake8 = 4,
    pep8 = 5,
    pylama = 6,
    prospector = 7,
    pydocstyle = 8,
    yapf = 9,
    autopep8 = 10,
    mypy = 11,
    unittest = 12,
    ctags = 13,
    rope = 14,
    isort = 15,
    black = 16,
    bandit = 17
}

Each of the above products are logically grouped into what's called a Product Type:

export enum ProductType {
    Linter = 'Linter',
    Formatter = 'Formatter',
    TestFramework = 'TestFramework',
    RefactoringLibrary = 'RefactoringLibrary',
    WorkspaceSymbols = 'WorkspaceSymbols'
}

Installation

When using different parts of the extension the above products are used, e.g. for linting, testing, etc. If one of these modules (also called a product) then we install them on behalf of the user.

Installer

The installation of the packages (product) is done via the installers defined in https://github.com/Microsoft/vscode-python/blob/main/src/client/common/installer/productInstaller.ts.

We have multiple installers:

Installation Channels

Python packages can be installed a number of ways, pip, pipenv, conda, poetry. The class InstallationChannelManager is what will made the decision on what channel is to be used when installing a python module.

The available channels are:

How to add a new installation channel

Clone this wiki locally