Skip to content

Commit 4531df3

Browse files
authored
Merge pull request #358 from bj00rn/chore/vscode-dev-container
Add devcontainer for project
2 parents 40de3bb + 6e83564 commit 4531df3

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"name": "SAIC Python MQTT Gateway Dev",
3+
"image": "mcr.microsoft.com/devcontainers/python:3.12",
4+
"runArgs": [
5+
"--env-file",
6+
".env"
7+
],
8+
"customizations": {
9+
"vscode": {
10+
"settings": {
11+
"launch": {
12+
"configurations": [
13+
{
14+
"name": "Python: Debug Gateway",
15+
"type": "debugpy",
16+
"request": "launch",
17+
"program": "./src/main.py",
18+
"justMyCode": true,
19+
"console": "integratedTerminal"
20+
}
21+
],
22+
"compounds": []
23+
},
24+
"python.testing.pytestArgs": [
25+
"tests"
26+
],
27+
"python.testing.unittestEnabled": false,
28+
"python.testing.pytestEnabled": true,
29+
"python.defaultInterpreterPath": "./.venv/bin/python",
30+
"terminal.integrated.shell.linux": "/bin/bash",
31+
"[python]": {
32+
"editor.formatOnSave": true,
33+
"editor.defaultFormatter": "charliermarsh.ruff"
34+
}
35+
},
36+
"extensions": [
37+
"charliermarsh.ruff",
38+
"ms-azuretools.vscode-docker",
39+
"ms-python.debugpy",
40+
"ms-python.mypy-type-checker",
41+
"ms-python.pylint",
42+
"ms-python.python",
43+
"ms-python.vscode-pylance"
44+
]
45+
}
46+
},
47+
"postCreateCommand": [
48+
".devcontainer/setup.sh"
49+
],
50+
"containerEnv": {
51+
"PYTHONPATH": "${containerWorkspaceFolder}/src"
52+
},
53+
"remoteEnv": {
54+
"MQTT_URI": "${containerEnv:MQTT_BROKER_URI}",
55+
"MQTT_USER": "${containerEnv:MQTT_USERNAME}",
56+
"MQTT_PASSWORD": "${containerEnv:MQTT_PWD}",
57+
"SAIC_USER": "${containerEnv:SAIC_USERNAME}",
58+
"SAIC_PASSWORD": "${containerEnv:SAIC_PWD}"
59+
}
60+
}

.devcontainer/setup.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
set -ex
3+
4+
5+
# install system dependencies
6+
pip install poetry
7+
8+
9+
# install python dependencies
10+
poetry install --no-interaction
11+
12+
13+
# fix dubious ownership warning
14+
git config --global --add safe.directory $(pwd)
15+
16+
# install pre-commit git hooks
17+
18+
#pre-commit install
19+
#pre-commit install --hook-type commit-msg

0 commit comments

Comments
 (0)