Python settings reference

The Python Extension for Visual Studio Code is highly configurable. This page describes the key settings you can work with.

For general information about working with settings in VS Code, refer to User and workspace settings, as well as the Variables reference for information about predefined variable support.

General Python settings

Setting
(python.)
Default Description
condaPath "conda" Path to the conda executable.
defaultInterpreterPath "python" Path to the default Python interpreter to be used by the Python extension on the first time it loads for a workspace, or the path to a folder containing the Python interpreter.
Can use variables like ${workspaceFolder} and ${workspaceFolder}/.venv.
Using a path to a folder allows anyone working with a project to create an environment in the .venv folder as appropriate to their operating system, rather than having to specify an exact platform-dependent path. The settings.json file can then be included in a source code repository.
Note: Changes to this setting made after an interpreter has been selected for a workspace will not be applied or considered by the Python extension. The Python extension doesn't automatically add or change this setting.
interpreter.infoVisibility "onPythonRelated" Controls when to display the selected interpreter information on the status bar.
By default, it only shows when there are Python related files open in the editor.
You can set it to "always" if you'd like it to always show on the status bar, or "never" to hide it entirely.
pipenvPath "pipenv" Path to the pipenv executable to use for activation.
venvFolders [] Paths to folders where virtual environments are created.
Depending on the virtualization tool used, it can be the project itself: ${workspaceFolder}, or separate folders for all virtual environments located side by side: .\envs, ~/.virtualenvs, and so on.
envFile "${workspaceFolder}/
.env"
Absolute path to a file containing environment variable definitions.
See Configuring Python environments - environment variable definitions file.
globalModuleInstallation false Specifies whether to install packages for the current user only using the --user command-line argument (the default), or to install for all users in the global environment (when set to true). Ignored when using a virtual environment.
For more information on the --user argument, see pip - User Installs.
poetryPath "poetry" Specifies the location of the Poetry dependency manager executable, if installed. The default value "poetry" assumes the executable is in the current path.
The Python extension uses this setting to install packages when Poetry is available and there's a poetry.lock file in the workspace folder.
terminal.launchArgs [] Launch arguments that are given to the Python interpreter when you run a file using commands such as Python: Run Python File in Terminal.
In the launchArgs list, each item is a top-level command-line element that's separated by a space (quoted values that contain spaces are a single top-level element and are thus one item in the list).
For example, for the arguments --a --b --c {"value1" : 1, "value2" : 2}, the list items should be ["--a", "--b", "--c", "{\"value1\" : 1, \"value2\" : 2}\""].
Note that VS Code ignores this setting when debugging because it instead uses arguments from your selected debugging configuration in launch.json.
terminal.executeInFileDir false Indicates whether to run a file in the file's directory instead of the current folder.
terminal.activateEnvironment true Indicates whether to automatically activate the environment you select using the Python: Select Interpreter command when a new terminal is created.
For example, when this setting is true and you select a virtual environment, the extension automatically runs the environment's activate command when creating a new terminal (source env/bin/activate on macOS/Linux; env\scripts\activate on Windows).
terminal.activateEnvInCurrentTerminal false Specifies whether to activate the currently open terminal when the Python extension is activated, using the virtual environment selected.
terminal.focusAfterLaunch false Whether to switch the cursor focus to the terminal when launching a Python terminal.
logging.level error Specifies the level of logging to be performed by the extension.
The possible levels of logging, in increasing level of information provided, are off, error, warn, info, and debug.
When set to off, which is not recommended, basic information will still be shown such as startup information and commands run by the Python extension.
At the error level, basic information and errors will be shown.
At the warn level, basic, error, and warning information will be shown. At the info level, basic, error, warning, and additional information like method execution times and return values will be shown. At this time, the debug level doesn't display additional information.
experiments.enabled true Enables A/B experiments in the Python extension. If enabled, you may be provided with proposed enhancements and/or features.

Code analysis settings

IntelliSense engine settings

Note: If you have never changed your language server setting, your language server is set to Pylance via the “Default” setting value.

Setting
(python.)
Default Description
languageServer Default Defines type of the language server (Default, Pylance, Jedi, and None).

Python Language Server settings

Pylance Language Server

The language server settings apply when python.languageServer is Pylance or Default. If you have difficulties with the language server, see Troubleshooting in the language server repository.

Setting
(python.analysis.)
Default Description
typeCheckingMode off Specifies the level of type checking analysis to perform.
Available values are off, basic, and strict.
When set to off no type checking analysis is conducted; unresolved imports/variables diagnostics are produced.
When set to basic non-type checking-related rules (all rules in off), as well as basic type checking rules are used.
When set to strict all type checking rules at the highest severity of error (including all rules in off and basic categories) are used.
diagnosticMode openFilesOnly Specifies what code files the language server analyzes for problems.
Available values are workspace and openFilesOnly.
include [] Paths of directories or files that should be included in analysis.
If no paths are specified, Pylance defaults to the directory that contains the workspace root.
Paths may contain wildcard characters such as ** (a directory or multiple levels of directories), * (a sequence of zero or more characters), or ? (a single character).
exclude [] Paths of directories or files that should not be included in analysis.
These override the directories listed under the python.analysis.include setting, allowing specific subdirectories to be excluded.
Note that files listed in this exclude setting may still be included in the analysis if they are referenced/imported by source files that are not in the excluded list.
Paths may contain wildcard characters such as ** (a directory or multiple levels of directories), * (a sequence of zero or more characters), or ? (a single character).
If no exclude paths are specified, Pylance automatically excludes the following: **/node_modules, **/\_\_pycache\_\_, .git and any virtual environment directories.
ignore [] Paths of directories or files whose diagnostic output (errors and warnings) should be suppressed, even if they are an included file or within the transitive closure of an included file.
Paths may contain wildcard characters such as ** (a directory or multiple levels of directories), * (a sequence of zero or more characters), or ? (a single character).
If no value is provided, the value of python.linting.ignorePatterns (if set) will be used.