Skip to content

Commit 714170f

Browse files
committed
tooling: Add devcontainer for Python/MicroPython development.
1 parent e7996a2 commit 714170f

2 files changed

Lines changed: 106 additions & 0 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM mcr.microsoft.com/devcontainers/python:3.10
2+
3+
# System packages for firmware build and board communication
4+
RUN apt-get update && apt-get install -y --no-install-recommends \
5+
gcc-arm-none-eabi \
6+
libnewlib-arm-none-eabi \
7+
openocd \
8+
udev \
9+
&& rm -rf /var/lib/apt/lists/*
10+
11+
# udev rules for STeaMi board (DAPLink / STM32)
12+
RUN mkdir -p /etc/udev/rules.d \
13+
&& echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="0d28", MODE="0666"' \
14+
> /etc/udev/rules.d/99-steami.rules

.devcontainer/devcontainer.json

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
{
2+
"name": "STeaMi MicroPython Dev",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
7+
// USB access for STeaMi board (DAPLink / mpremote / OpenOCD).
8+
// Privileged mode is required for firmware flashing and board communication.
9+
// This is incompatible with GitHub Codespaces but essential for local use.
10+
"privileged": true,
11+
"mounts": ["type=bind,source=/dev/bus/usb,target=/dev/bus/usb"],
12+
"runArgs": ["--device=/dev/bus/usb"],
13+
14+
"remoteEnv": {
15+
"VENV_DIR": "/home/vscode/.venv"
16+
},
17+
18+
"features": {
19+
"ghcr.io/devcontainers/features/node:1": {
20+
"version": "22"
21+
},
22+
"ghcr.io/devcontainers/features/common-utils:2": {
23+
"installZsh": true,
24+
"installOhMyZsh": true,
25+
"upgradePackages": true,
26+
"username": "vscode"
27+
},
28+
"ghcr.io/devcontainers/features/github-cli:1": {},
29+
"ghcr.io/stuartleeks/dev-container-features/shell-history:0": {}
30+
},
31+
32+
"customizations": {
33+
"vscode": {
34+
"settings": {
35+
"terminal.integrated.profiles.linux": {
36+
"zsh": {
37+
"path": "zsh"
38+
}
39+
},
40+
"terminal.integrated.defaultProfile.linux": "zsh",
41+
42+
"editor.minimap.enabled": false,
43+
"editor.formatOnSave": true,
44+
"editor.formatOnPaste": true,
45+
"editor.rulers": [99],
46+
47+
"[python]": {
48+
"editor.defaultFormatter": "charliermarsh.ruff"
49+
},
50+
"[json]": {
51+
"editor.defaultFormatter": "esbenp.prettier-vscode"
52+
},
53+
"[jsonc]": {
54+
"editor.defaultFormatter": "esbenp.prettier-vscode"
55+
},
56+
"[makefile]": {
57+
"editor.tabSize": 8
58+
},
59+
"[yaml]": {
60+
"editor.tabSize": 2
61+
},
62+
63+
"python.defaultInterpreterPath": "/home/vscode/.venv/bin/python",
64+
"python.testing.pytestEnabled": true,
65+
"python.testing.pytestArgs": ["-v", "-k", "mock"],
66+
67+
"files.watcherExclude": {
68+
"**/.git/objects/**": true,
69+
"**/node_modules/**": true,
70+
"**/.build/**": true,
71+
"**/__pycache__/**": true
72+
},
73+
"search.exclude": {
74+
"**/node_modules": true,
75+
"**/.build": true
76+
}
77+
},
78+
"extensions": [
79+
"charliermarsh.ruff",
80+
"ms-python.python",
81+
"ms-python.vscode-pylance",
82+
"ms-vscode.vscode-serial-monitor",
83+
"esbenp.prettier-vscode",
84+
"github.vscode-pull-request-github",
85+
"vivaxy.vscode-conventional-commits"
86+
]
87+
}
88+
},
89+
90+
"postCreateCommand": "make setup VENV_DIR=/home/vscode/.venv && sudo /usr/lib/systemd/systemd-udevd --daemon",
91+
"remoteUser": "vscode"
92+
}

0 commit comments

Comments
 (0)