Python settings reference

The Python Extension for VS Code is highly configurable. This page describes the key settings you will want to work with.

Refer to User and workspace settings to find our more about working with settings in VS Code generally.

General settings

Setting Default Description
python.pythonPath "python" Path to the python interpreter.
python.venvPath "" Path to folder with a list of Virtual Environments, such as ~/.pyenv, ~/Envs, ~/.virtualenvs.
python.envFile "${workspaceRoot}/.env" Absolute path to a file containing environment variable definitions.
python.terminal.launchArgs [] Launch arguments given the Python interpreter when running a file.
python.terminal.executeInFileDir false Indicates whether to run a file in the file's directory instead of the current folder.
python.jediPath "" Path to folder containing the Jedi library (folder should contain a jedi subfolder).

Workspace symbol (tags) settings

Workspace symbols are symbols in C source code generated by the ctags tool (described on Wikipedia and on ctags.sourceforge.net). To quote Wikipedia, ctags "generates an index (or tag) file of names found in source and header files of various programming languages." Where Python is concerned, ctags makes it easier to jump to defined functions and other symbols in C/C++ extension modules.

Setting
(python.workspaceSymbols.)
Default Description
tagFilePath "${workspaceRoot}/.vscode/tags" Fully qualified path to tag file (an exuberant ctag file), used to provide workspace symbols.
enabled true Specifies whether to enable the Workspace Symbol provider.
rebuildOnStart true Specifies whether to re-build the tags file on start.
rebuildOnFileSave true Specifies whether to re-build the tags file on when saving a Python file.
ctagsPath "ctags" Fully qualified path to the ctags executable; default value assumes it's in the current environment.
exclusionPatterns ["**/site-packages/**"] Pattern used to exclude files and folders from ctags.

AutoComplete settings

Setting
(python.autoComplete.)
Default Description See also
addBrackets false Specifies whether VS Code automatically adds parentheses (()) when autocompleting a function name. Editing
preloadModules [] Specifies modules to pre-load to improve autocomplete performance. Editing
extraPaths [] Specifies locations of additional packages for which to load autocomplete data. Editing

Formatting settings

Setting
(python.formatting.)
Default Description See also
formatOnSave false Applies formatting on document save. Editing - Formatting
outputWindow "Python" The name of the output window for formatting messages. Editing - Formatting
provider "autopep8" Specifies the formatter to use, either "autopep8" or "yapf". Editing - Formatting
autopep8Path "autopep8" Path to autopep8 Editing - Formatting
autopep8Args [] Arguments for autopep8, each argument as a separate item in the array. Editing - Formatting
yapfPath "yapf" Path to yapf Editing - Formatting
yapfArgs [] Arguments for yapf, each argument as a separate item in the array. Editing - Formatting

Refactoring - Sort Imports settings

Setting
(python.sortImports.)
Default Description See also
path "" Path to isort script Editing - Refactoring - Sort Imports
args [] Arguments for isort, each argument as a separate item in the array. Editing - Refactoring - Sort Imports

Linting settings

General

Setting
(python.linting.)
Default Description See also
enabled true Specifies whether to enable linting in general. Linting
enabledWithoutWorkspace true Specifies whether to perform linting without a workspace open. Linting
lintOnTextChange true Specifies whether to lint as you type. Linting
lintOnSave true Specifies whether to line when saving a file. Linting
maxNumberOfProblems 100 Limits the number of linting messages shown. Linting
outputWindow "Python" The output window in which to display linting messages. Linting
ignorePatterns [".vscode/*.py", "**/site-packages/**/*.py"] Exclude file and folder patterns. Linting

Pylint

Setting
(python.linting.)
Default Description See also
pylintEnabled true Specifies whether to enable Pylint. Linting
pylintArgs [] Additional arguments for Pylint, with each argument given as an item in the array. Linting
pylintPath "pylint" The path to Pylint. Linting
pylintCategorySeverity.convention "Information" Mapping for Pylint convention message to VS Code type. Linting
pylintCategorySeverity.refactor "Hint" Mapping for Pylint refactor message to VS Code type. Linting
pylintCategorySeverity.warning "Warning" Mapping for Pylint warning message to VS Code type. Linting
pylintCategorySeverity.error "Error" Mapping for Pylint error message to VS Code type. Linting
pylintCategorySeverity.fatal "Error" Mapping for Pylint fatal message to VS Code type. Linting

Pep8

Setting
(python.linting.)
Default Description See also
pep8Enabled false Specifies whether to enable pep8. Linting
pep8Args [] Additional arguments for pep8, with each argument given as an item in the array. Linting
pep8Path "pep8" The path to pep8. Linting
pep8CategorySeverity.W "Warning" Mapping for pep8 W message to VS Code type. Linting
pep8CategorySeverity.E "Error" Mapping for pep8 E message to VS Code type. Linting

Flake8

Setting
(python.linting.)
Default Description See also
flake8Enabled false Specifies whether to enable flake8. Linting
flake8Args [] Additional arguments for flake8, with each argument given as an item in the array. Linting
flake8Path "flake8" The path to flake8. Linting
flake8CategorySeverity.F "Error" Mapping for flake8 F message to VS Code type. Linting
flake8CategorySeverity.E "Error" Mapping for flake8 E message to VS Code type. Linting
flake8CategorySeverity.W "Warning" Mapping for flake8 W message to VS Code type. Linting

mypy

Setting
(python.linting.)
Default Description See also
mypyEnabled false Specifies whether to enable mypy. Linting
mypyArgs ["--ignore-missing-imports", "--follow-imports=silent"] Additional arguments for mypy, with each argument given as an item in the array. Linting
mypyPath "mypy" The path to mypy. Linting
mypyCategorySeverity.error "Error" Mapping for mypy error message to VS Code type. Linting
mypyCategorySeverity.note "Information" Mapping for mypy note message to VS Code type. Linting

pydocstyle

Setting
(python.linting.)
Default Description See also
pydocstyleEnabled false Specifies whether to enable pydocstyle. Linting
pydocstyleArgs [] Additional arguments for pydocstyle, with each argument given as an item in the array. Linting
pydocstylePath "pydocstyle" The path to pydocstyle. Linting

prospector

Setting
(python.linting.)
Default Description See also
prospectorEnabled false Specifies whether to enable prospector. Linting
prospectorArgs [] Additional arguments for prospector, with each argument given as an item in the array. Linting
prospectorPath "prospector" The path to prospector. Linting

pylama

Setting
(python.linting.)
Default Description See also
pylamaEnabled false Specifies whether to enable pylama. Linting
pylamaArgs [] Additional arguments for pylama, with each argument given as an item in the array. Linting
pylamaPath "pylama" The path to pylama. Linting

Unit testing settings

UnitTest framework

Setting
(python.unitTest.)
Default Description See also
unittestEnabled false Specifies whether UnitTest is enabled for unit testing. Unit testing
unittestArgs ["-v", "-s", ".", "-p", "*test*.py"] Arguments to pass to unittest, with each argument specified as an item in the array. See below for a description of the defaults. Unit testing
outputWindow "Python Test Log" The window to use for unit test output. Unit testing
promptToConfigure true Specifies whether VS Code prompts to configure a test framework if potential tests are discovered. Unit testing
debugPort 3000 Port number used for debugging of UnitTest tests. Unit testing

PyTest framework

Setting
(python.unitTest.)
Default Description See also
pyTestEnabled false Specifies whether pytest is enabled for unit testing. Unit testing
pyTestPath "py.test" Path to pytest. Use a full path if pytest is located outside the current environment. Unit testing
pyTestArgs [] Arguments to pass to PyTest, with each argument specified as an item in the array. Unit testing

Nose framework

Setting
(python.unitTest.)
Default Description See also
nosetestsEnabled false Specifies whether Nose is enabled for unit testing. Unit testing
nosetestPath "nosetests" Path to Nose. Use a full path if PyTest is located outside the current environment. Unit testing
nosetestArgs [] Arguments to pass to Nose, with each argument specified as an item in the array. Unit testing

Jupyter settings (deprecated)

These settings are deprecated; for Jupyter support, we recommend the "Jupyter" extension from Don Jayamanne.

Setting Default Description
python.promptToInstallJupyter true Display prompt to install Jupyter.
python.jupyter.appendResults true Specifies whether to append the results to results window. When false, results are cleared with each run.
python.jupyter.defaultKernel "" Default kernel, defaulting to the first available kernel.
python.jupyter.startupCode ["%matplotlib inline"] The source code to run when the kernel starts, where each item in the array is a separate line of source code.

Next steps

  • Python environments - Control which Python interpreter is used for editing and debugging.
  • Editing code - Learn about autocomplete, IntelliSense, formatting, and refactoring for Python.
  • Linting - Enable, configure, and apply a variety of Python linters.
  • Debugging - Learn to debug Python both locally and remotely.
  • Unit testing - Configure unit test environments and discover, run, and debug tests.