1. The basics of Python development in VS Code#
1.1. Some facts & figures#
Stack Overflow Annual Developer Surveys: VS Code is the most popular integrated development environment (IDE) since 2018.
Year
VS Code*
Rank
2015
Release
-
2016
7%
13
2017
23%
5
2018
35%
1
2019
51%
1
2020
-
-
2021
71%
1
2022
74%
1
2023
74%
1
*Percentage of respondents using VS Code as a developer environment (multiple answers possible).
2022 State of the Octoverse: github.com/microsoft/vscode is
#1repository on GitHub by number of contributorsThe VS Code Marketplace has 49k extensions as of July 2023
What brought us to VS Code?
1.2. Getting started#
A brief overview of VS Code.
Launching VS Code
Local (Desktop icon /
code .)Browser: Primary option for workshop (https://vscode.dev/,
.on any GitHub page)
Prep Exercise
Follow the setup instructions in the README. For quick set-up we recommend using Codespaces directly from GitHub!
1.3. An anatomy of the VS Code UI#
How to navigate VS Codeās user interface.
Command Palette / Command center
Activity bar
Open folder
Search
Help:
?
Status bar
Panel
Accessibility (color themes, screen readers, screencast mode, etc.)
VS Code terminal (xtermjs)
Exercise: Explore VS Code accessibility
Browse to the tutorial repo on GitHub and try opening it either in your browser (press
.when on repo page) or cloning it locally and opening withcode ..Use the Command Palette to Zoom in and Zoom out (editor and/or view).
Search for Color Themes using the Extensions tab. You can find extensions or color themes that are accessible for color vision deficiencies, for example, take a look at the color blind-friendly extensions. If you are using a screen reader such as NVDA, JAWS and VoiceOver, try using it with VS Code!
Use the Command Palette or āgearā icon to change your Color Theme to a non-default one.
1.4. Customize your UI#
More fun and helpful UI features and settings.
Some key settings to check:
Color themes: Dark, Colorblind
-
Donāt see what you need? Make your own!
1.5. Setting up for Python development#
We will set up a Python project and install the necessary extensions. This piece is fairy quick and self-guided.
Python Environments in VS Code
Default intrepreter settings
Common Python extensions
formatters / linters: pylint, flake8, black, autopep8, ā¦
Exercise: New Python project from scratch
In the Codespace for this workshop or locally (in a Dev Container) on your machine, create a new virtual environment by running:
cd scipy-vscode-tutorial
conda install -n base -c conda-forge mamba
mamba env create -f environment.yml
conda activate tutorial
Install the tutorial package by running:
pip install -e .
Use the Command Palette to run the
Python: Select Interpretercommand and set it to thetutorialenvironment you just created.Use the Command Palette to create a new Interactive Window using the
Jupyter: Create Interactive Windowcommand.Run the following lines to test your environment:
from tutorial import welcome
welcome()