diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..3dddbd5 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,60 @@ +{ + "name": "SAIC Python MQTT Gateway Dev", + "image": "mcr.microsoft.com/devcontainers/python:3.12", + "runArgs": [ + "--env-file", + ".env" + ], + "customizations": { + "vscode": { + "settings": { + "launch": { + "configurations": [ + { + "name": "Python: Debug Gateway", + "type": "debugpy", + "request": "launch", + "program": "./src/main.py", + "justMyCode": true, + "console": "integratedTerminal" + } + ], + "compounds": [] + }, + "python.testing.pytestArgs": [ + "tests" + ], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true, + "python.defaultInterpreterPath": "./.venv/bin/python", + "terminal.integrated.shell.linux": "/bin/bash", + "[python]": { + "editor.formatOnSave": true, + "editor.defaultFormatter": "charliermarsh.ruff" + } + }, + "extensions": [ + "charliermarsh.ruff", + "ms-azuretools.vscode-docker", + "ms-python.debugpy", + "ms-python.mypy-type-checker", + "ms-python.pylint", + "ms-python.python", + "ms-python.vscode-pylance" + ] + } + }, + "postCreateCommand": [ + ".devcontainer/setup.sh" + ], + "containerEnv": { + "PYTHONPATH": "${containerWorkspaceFolder}/src" + }, + "remoteEnv": { + "MQTT_URI": "${containerEnv:MQTT_BROKER_URI}", + "MQTT_USER": "${containerEnv:MQTT_USERNAME}", + "MQTT_PASSWORD": "${containerEnv:MQTT_PWD}", + "SAIC_USER": "${containerEnv:SAIC_USERNAME}", + "SAIC_PASSWORD": "${containerEnv:SAIC_PWD}" + } +} \ No newline at end of file diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh new file mode 100755 index 0000000..5ff12aa --- /dev/null +++ b/.devcontainer/setup.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -ex + + +# install system dependencies +pip install poetry + + +# install python dependencies +poetry install --no-interaction + + +# fix dubious ownership warning +git config --global --add safe.directory $(pwd) + +# install pre-commit git hooks + +#pre-commit install +#pre-commit install --hook-type commit-msg