VSCode#

The Visual Studio Code editor has become a very popular IDE. Its main features include

See also

There are of course many alternatives to VSCode. From command-line editors like Vim with python-mode, over spyder, to the commercial PyCharm (for which ETH students can receive a free pro license.

Customization#

Extensions#

Thousands of extensions provide additional features, key mappings and themes.

Settings#

The looks and behaviour of VSCode are heavily customizable. The settings can be made globally for all projects, but also defined and overridden for each workspace. The workspace-specific preferences are stored inside the project’s .vscode/settings.json. This JSON file can be edited directly or via the GUI. If you include it in your version control, all collaborators can share the same configuration.

The following snippet shows a selection of noteworthy settings.

{
    "editor.bracketPairColorization.enabled": true,
    "files.insertFinalNewline": true,
    "files.trimTrailingWhitespace": true,
    "files.exclude": {
        "**/__pycache__": true,
        "**/.venv": true,
    },
    "jupyter.askForKernelRestart": false,
    "[python]": {
        "editor.defaultFormatter": "ms-python.python",
        "editor.formatOnSave": true,
    },
    "python.formatting.provider": "black",
    "python.formatting.blackArgs": ["--line-length=100"],
    "python.linting.flake8Enabled": true,
    "python.linting.flake8Args": ["--max-line-length=100"],
    "python.defaultInterpreterPath": ".venv/bin/python3",
    "telemetry.telemetryLevel": "off",
}

Tip

By default, VSCode collects telemetry data, including crash reports and usage data. For privacy reasons you should consider disabling this automatic data reporting by setting the telemetry.telemetryLevel user setting to off.

Python and Jupyter#

The Python extension is indispensable for Python development and includes the closed-source Pylance language server as dependency. There is also the Jupyter extension. The official documentation and tutorials offer plenty of resources to explore Python and Jupyter in VSCode.

../../../_images/vscode_1.png