You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tooling: Add devcontainer for Python/MicroPython development. (#275)
* tooling: Add devcontainer for Python/MicroPython development.
* ci: Standardize Node.js version to 22 across all environments.
* tooling: Add venv support to Makefile with MicroPython stubs.
* tooling: Configure Pylance, recommended extensions, and MicroPython stubs.
* docs: Update CONTRIBUTING with prerequisites and devcontainer docs.
*`mpremote` (installed via `pip install -e ".[test]"`)
95
+
* GitHub CLI (`gh`)
96
+
97
+
Then run `make setup` to install all dependencies and git hooks. This creates a `.venv` with ruff, pytest, mpremote, and MicroPython type stubs for Pylance.
98
+
99
+
## Dev Container
100
+
101
+
A dev container is available for VS Code (local Docker only, not GitHub Codespaces). It includes all prerequisites out of the box: Python 3.10, Node.js 22, ruff, pytest, mpremote, arm-none-eabi-gcc, OpenOCD, and the GitHub CLI.
102
+
103
+
1. Open the repository in VS Code
104
+
2. When prompted, click **Reopen in Container** (or use the command palette: *Dev Containers: Reopen in Container*)
105
+
3. The container runs `make setup` automatically on creation
106
+
107
+
The container also provides:
108
+
109
+
***zsh + oh-my-zsh** as default shell with persistent shell history
110
+
***Pylance** configured with MicroPython STM32 stubs (no false `import machine` errors)
111
+
***Serial Monitor** extension for board communication
112
+
***USB passthrough** for mpremote, OpenOCD, and firmware flashing (the container runs in privileged mode with `/dev/bus/usb` mounted)
113
+
***udev rules** for the DAPLink interface (auto-started on container creation)
114
+
115
+
Note: GitHub Codespaces is not supported because the container requires privileged mode and USB device access for board communication.
116
+
86
117
## Workflow
87
118
88
-
1. Set up your environment: `make setup`
119
+
1. Set up your environment: open in the dev container, or run `make setup` locally
89
120
2. Create a branch from main (format: `feat/`, `fix/`, `docs/`, `tooling/`, `ci/`, `test/`, `style/`, `chore/`, `refactor/`)
90
121
3. Write your code and add tests in `tests/scenarios/<driver>.yaml`
91
122
4. Run `make ci` to verify everything passes (lint + tests + examples)
@@ -142,7 +173,7 @@ The firmware source is cloned into `.build/micropython-steami/` (gitignored). A
142
173
143
174
Use `make firmware` for normal rebuilds from the existing local clone. Use `make firmware-update` only when you want to refresh the `micropython-steami` checkout itself or resync the board-specific submodules before rebuilding.
144
175
145
-
**Requirements**: `arm-none-eabi-gcc` toolchain, OpenOCD for flashing, and `mpremote` for running scripts on the board.
176
+
All these tools are included in the dev container. For local development, see the [Prerequisites](#prerequisites) section.
# Uses 'driver' field for driver scenarios, filename stem for board scenarios.
39
48
# Convention: for board scenarios, the YAML 'name' field must match the filename.
40
-
SCENARIOS := $(shellpython3 -c "import yaml,glob,os; [print(d.get('driver',os.path.basename(f).replace('.yaml',''))) for f in sorted(glob.glob('tests/scenarios/*.yaml')) for d in [yaml.safe_load(open(f))]]" 2>/dev/null)
SCENARIOS := $(shell$(PYTHON) -c "import yaml,glob,os; [print(d.get('driver',os.path.basename(f).replace('.yaml',''))) for f in sorted(glob.glob('tests/scenarios/*.yaml')) for d in [yaml.safe_load(open(f))]]" 2>/dev/null)
0 commit comments