Skip to main content

VS Code β€” NHS Quickstart

🧰 One editor for Python · R · SQL · Web · Docker · Dev Containers · WSL2
Why VS Code for the NHS

VS Code gives you a single, lightweight IDE that works across Trust Windows builds (with WSL2), supports Python/R/SQL/JS, and has first-party tooling for GitHub, Docker, and Dev Containers.

Great for: Developer Β· Data Engineer Β· Data Scientist Β· BI Analyst Β· Clinician-Researcher.


βš™οΈ 10-minute install​

1) Install VS Code from code.visualstudio.com

2) Install WSL2 + Ubuntu (optional but recommended)

3) Open VS Code β†’ install extensions (below)

4) Set the Python interpreter from your project’s .venv

# Create a virtual environment in your project
py -3.11 -m venv .venv
.\.venv\Scriptsctivate
python -V

  • Python (Microsoft) β€” language support, debugging, testing
  • Pylance β€” fast Python IntelliSense
  • Jupyter β€” notebooks in VS Code
  • SQL Server (mssql) β€” connect to SQL Server/MI
  • SQLTools (+ drivers) β€” PostgreSQL / SQLite convenience
  • Docker β€” build & run containers, push to registries
  • YAML β€” schemas & validation (Kubernetes, CI)
  • GitHub Pull Requests & Issues β€” PR reviews in editor
  • Dev Containers β€” reproducible environments
  • R (REditorSupport) β€” R console & R Markdown/Quarto helpers (optional)

Tip: create an extensions profile (e.g., Data Science vs Web Dev) and switch per project.


πŸš€ β€œHello NHS” tasks​

1) New File β†’ Jupyter Notebook

2) Select Python kernel (your .venv)

3) Run the cell:

import pandas as pd
df = pd.DataFrame({"date": pd.date_range("2025-01-01", periods=3),
"admissions": [120,135,128]})
df.describe()

🧩 Useful settings (copy to settings.json)​

Note: pure JSON (no comments). On Windows, set python.defaultInterpreterPath to .venv\Scripts\python.exe.

{
"python.defaultInterpreterPath": ".venv/bin/python",
"python.analysis.typeCheckingMode": "basic",
"editor.formatOnSave": true,

"python.formatting.provider": "black",
"python.linting.enabled": true,

"jupyter.askForKernelRestart": false,
"jupyter.sendSelectionToInteractiveWindow": true,

"mssql.connections": [
{
"server": "YOURSERVER",
"database": "NHS_Analytics",
"authenticationType": "Integrated",
"encrypt": "true",
"trustServerCertificate": true
}
],

"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"files.exclude": { "**/.venv": true, "**/__pycache__": true },

"telemetry.telemetryLevel": "off"
}

▢️ Run & Debug​

.vscode/launch.json

{
"version": "0.2.0",
"configurations": [
{
"name": "FastAPI (uvicorn)",
"type": "python",
"request": "launch",
"module": "uvicorn",
"args": ["app:app", "--host", "0.0.0.0", "--port", "8000", "--reload"],
"jinja": true,
"envFile": "${workspaceFolder}/.env"
},
{
"name": "Dash app",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/app.py",
"console": "integratedTerminal",
"envFile": "${workspaceFolder}/.env"
}
]
}

.vscode/tasks.json (optional helpers)

{
"version": "2.0.0",
"tasks": [
{ "label": "Install deps", "type": "shell", "command": "pip install -r requirements.txt" },
{ "label": "Run extract", "type": "shell", "command": "python extract_kpi.py", "problemMatcher": [] }
]
}

🐳 Dev Containers (reproducible environment)​

.devcontainer/devcontainer.json

{
"name": "nhs-python",
"image": "mcr.microsoft.com/devcontainers/python:3.11",
"features": { "ghcr.io/devcontainers/features/docker-in-docker:2": {} },
"postCreateCommand": "pip install -r requirements.txt",
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"ms-azuretools.vscode-docker",
"ms-vscode.vscode-node-azure-pack"
]
}
}
}

Open folder β†’ Reopen in Container to get a clean, consistent toolchain.


πŸͺŸ WSL2 (Linux on NHS Windows)​

  1. Enable Windows Subsystem for Linux
  2. Install Ubuntu from the Store
  3. In VS Code, click the green corner indicator and choose Connect to WSL
  4. Create your .venv inside the Linux filesystem (/home/you/project)

WSL2 avoids Windows-specific package issues and speeds up many Python builds.


πŸ”’ IG & safety checklist​

  • Workspace Trust: only trust folders you control.
  • Keep secrets in .env (local) and a secret store in prod; add .env to .gitignore.
  • Use restricted DB roles from the SQL extension; never connect as admin for ad‑hoc work.
  • Turn off telemetry per Trust policy.
  • Prefer Dev Containers/WSL2 to avoid local installs of sensitive tooling.

πŸ“ Measuring impact​

  • Dev setup time: new laptop β†’ first run.
  • Reproducibility: runs from a clean clone using the provided launch/tasks/devcontainer files.
  • Quality: % of repos with format‑on‑save + lint passing.
  • Adoption: number of teams using profiles/containers.

πŸ”— See also​

See also: Python Β· R Β· SQL Β· Docker Β· AWS Β· Azure Β· Secrets & .env

What’s next?

You’ve completed the Learn β€” VS Code stage. Keep momentum: