The supported development path is WSL2 + VS Code Remote WSL on Windows, or native on macOS/Linux. A Dev Container option is also available — see Dev Container (optional) below.
git clone https://github.com/solentlabs/cable_modem_monitor.git
cd cable_modem_monitor
git lfs install # required for HAR test fixtures
./scripts/setup.sh # creates .venv and installs all dependencies
code .When VS Code opens, run:
make validateIf anything in the setup fails: ./scripts/verify-setup.sh.
| Tool | All platforms | Windows-specific |
|---|---|---|
| Git | required | required |
| Git LFS | required (HAR fixtures) | required |
| Python 3.12 | required | required (install inside WSL2) |
| VS Code | required | required (installed on Windows side) |
| Docker Desktop | required for HA testing | WSL2 backend enabled |
| WSL2 + Ubuntu | — | required (wsl --install from PowerShell as admin) |
Windows users: clone the repo inside WSL2 (e.g. ~/projects/),
not on the Windows filesystem (/mnt/c/). The 9P bridge is dramatically
slower and breaks file watchers.
| Notification | What to do |
|---|---|
| "Install recommended extensions?" | Click Install — all required. |
| "GitLens" / "CodeQL" extras | Optional; dismiss if not needed. |
make validate # Ruff + Black + quick tests (~30s)
make validate-ci # Full ruff + pytest (2–5 min) — run before push
make test # All three test suites (Core, Catalog, HA)Or use the Testing panel (beaker icon) — pytest tests auto-discover. If they don't appear: refresh the panel, or check the Python interpreter in the bottom-left status bar.
CodeQL tests live in
cable-modem-monitor-ql/tests/and don't appear in the Testing panel. Run them via GitHub Actions orcodeql test run.
VS Code tasks (Ctrl+Shift+P → Tasks: Run Task):
| Task | Purpose |
|---|---|
| 🚀 HA: Start | Start HA with info logging (restarts if already running) |
| 🚀 HA: Start (Debug) | Start HA with debug logging for all integration namespaces |
| ⏹️ HA: Stop | Stop the HA container |
| 📋 HA: View Logs | Tail HA logs in real time |
| 🗑️ HA: Clean All Data (Reset) | Wipe HA's local test config (users, integrations, settings) |
After starting, open http://localhost:8123.
git checkout -b feature/my-change
# edit, run tests via Testing panel or `make test-quick`
make validate
git commit -am "..."
git push -u origin feature/my-changePre-commit hooks auto-format with Black and lint with Ruff. See CONTRIBUTING.md for PR guidelines and commit message conventions.
Worktrees share the main repo's .venv automatically. Every dev script
(run-python.sh, run-pyright.sh, activate_venv.sh, pre-commit
hooks) calls scripts/dev/resolve-venv.sh, which:
- Looks for
.venvin the current directory. - Falls back to the main worktree via
git rev-parse --git-common-dir.
Create one anywhere convenient (a sibling directory, or your team's preferred worktree location):
git worktree add ../my-feature feature/v3.14.0
cd ../my-featureA .venv symlink is created on first use (gitignored). VS Code,
Pylance, and the test runner all work without setup.
If you're on Windows and don't yet have WSL2:
# PowerShell as Administrator
wsl --install
# Restart when prompted; Ubuntu launches automatically afterward.In Ubuntu:
cat /etc/os-release # confirm Ubuntu 22.04 or 24.04
# Install Docker (or use Docker Desktop with WSL2 backend)
sudo apt install docker.io
sudo usermod -aG docker $USER
exit # log back in to apply group
# Verify
docker run hello-worldThen clone the repo under ~/projects/ and run code . — VS Code
detects WSL2, installs Remote-WSL, and opens the folder. The
bottom-left status bar should read "WSL: Ubuntu".
If WSL2 uses too much RAM, create C:\Users\<username>\.wslconfig:
[wsl2]
memory=8GB
processors=4Then wsl --shutdown.
A Dev Container configuration is available for contributors who prefer a fully isolated environment. It requires Docker and the Dev Containers extension.
# After cloning, open VS Code and click "Reopen in Container"
# First build takes 2–5 minutes; subsequent opens are instant.The container installs all dependencies automatically via
.devcontainer/post-create.sh. If tools like ruff or black are missing
after a container rebuild, run the Fix Dev Container VS Code task.
docker ps # is Docker running?If not, start Docker Desktop. Then in VS Code: F1 → Dev Containers:
Rebuild Container.
docker ps
docker stop ha-cable-modem-testOr run the ⏹️ HA: Stop task.
HAR fixtures are stored in Git LFS. If a file is ~130 bytes starting
with version https://git-lfs., LFS hasn't fetched the content:
git lfs install # once per machine
git lfs pullmake format # auto-fix
make lint # see what's wrong
pre-commit install --install-hooks # update hookschmod +x scripts/*.sh scripts/dev/*.shgroups # should include 'docker'
sudo usermod -aG docker $USER
exit # log back in- Check Python interpreter in bottom-left status bar
(should be
/usr/local/bin/python3.12inside the container). - Refresh: Testing panel → refresh icon, or
F1→ Python: Refresh Tests.
- Integration-level issues: TROUBLESHOOTING.md
- Workflow / PR guidelines: CONTRIBUTING.md
- Bug report: open an issue