1. The basics of Python development in VS Code#

1.1. Some facts & figures#

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.

Exercise: Explore VS Code accessibility

  1. 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 with code ..

  2. Use the Command Palette to Zoom in and Zoom out (editor and/or view).

  3. 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!

  4. 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.

Exercise: Share your profile

  1. Create a new profile or use one of the templates.

  2. Either in your local or browser-based VS Code, try customizing some settings, themes, font sizes, etc.

  3. Export your current profile as a gist (or locally if you prefer).

  4. Copy-paste the URL for your profile gist, and add it to the discussion page.

  5. Try making a profile for presenting/screencasting or maybe a distraction-free writing space and take turns sharing all your cool new profiles with your team šŸ˜„

  6. Try importing a profile created by someone else via the Profiles > Import Profile... option in the Gear menu! You can find @crazy4pi314’s profiles here.

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.

Exercise: New Python project from scratch

  1. 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
  1. Install the tutorial package by running:

pip install -e .
  1. Use the Command Palette to run the Python: Select Interpreter command and set it to the tutorial environment you just created.

  2. Use the Command Palette to create a new Interactive Window using the Jupyter: Create Interactive Window command.

  3. Run the following lines to test your environment:

from tutorial import welcome
welcome()