diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1f9a98d7ec..b3fa6d4932 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,53 +4,60 @@ "postCreateCommand": [ "script/devcontainer-post-create" ], + "containerEnv": { + "DEVCONTAINER": "1" + }, "runArgs": [ "--privileged", "-e", "ESPHOME_DASHBOARD_USE_PING=1" ], "appPort": 6052, - "extensions": [ - // python - "ms-python.python", - "visualstudioexptteam.vscodeintellicode", - // yaml - "redhat.vscode-yaml", - // cpp - "ms-vscode.cpptools", - // editorconfig - "editorconfig.editorconfig", - ], - "settings": { - "python.languageServer": "Pylance", - "python.pythonPath": "/usr/bin/python3", - "python.linting.pylintEnabled": true, - "python.linting.enabled": true, - "python.formatting.provider": "black", - "editor.formatOnPaste": false, - "editor.formatOnSave": true, - "editor.formatOnType": true, - "files.trimTrailingWhitespace": true, - "terminal.integrated.defaultProfile.linux": "bash", - "yaml.customTags": [ - "!secret scalar", - "!lambda scalar", - "!include_dir_named scalar", - "!include_dir_list scalar", - "!include_dir_merge_list scalar", - "!include_dir_merge_named scalar" - ], - "files.exclude": { - "**/.git": true, - "**/.DS_Store": true, - "**/*.pyc": { - "when": "$(basename).py" - }, - "**/__pycache__": true - }, - "files.associations": { - "**/.vscode/*.json": "jsonc" - }, - "C_Cpp.clang_format_path": "/usr/bin/clang-format-13", + "customizations": { + "vscode": { + "extensions": [ + // python + "ms-python.python", + "visualstudioexptteam.vscodeintellicode", + // yaml + "redhat.vscode-yaml", + // cpp + "ms-vscode.cpptools", + // editorconfig + "editorconfig.editorconfig", + ], + "settings": { + "python.languageServer": "Pylance", + "python.pythonPath": "/usr/bin/python3", + "python.linting.pylintEnabled": true, + "python.linting.enabled": true, + "python.formatting.provider": "black", + "editor.formatOnPaste": false, + "editor.formatOnSave": true, + "editor.formatOnType": true, + "files.trimTrailingWhitespace": true, + "terminal.integrated.defaultProfile.linux": "bash", + "yaml.customTags": [ + "!secret scalar", + "!lambda scalar", + "!include_dir_named scalar", + "!include_dir_list scalar", + "!include_dir_merge_list scalar", + "!include_dir_merge_named scalar" + ], + "files.exclude": { + "**/.git": true, + "**/.DS_Store": true, + "**/*.pyc": { + "when": "$(basename).py" + }, + "**/__pycache__": true + }, + "files.associations": { + "**/.vscode/*.json": "jsonc" + }, + "C_Cpp.clang_format_path": "/usr/bin/clang-format-13" + } + } } } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index b6584bc735..307dd496f0 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -2,15 +2,24 @@ "version": "2.0.0", "tasks": [ { - "label": "run", + "label": "Run Dashboard", "type": "shell", - "command": "python3 -m esphome dashboard config/", + "command": "${command:python.interpreterPath}", + "args": [ + "-m", + "esphome", + "dashboard", + "config/" + ], "problemMatcher": [] }, { "label": "clang-tidy", "type": "shell", - "command": "./script/clang-tidy", + "command": "${command:python.interpreterPath}", + "args": [ + "./script/clang-tidy" + ], "problemMatcher": [ { "owner": "clang-tidy", diff --git a/script/setup b/script/setup index 71828deeaa..c650960f05 100755 --- a/script/setup +++ b/script/setup @@ -4,6 +4,12 @@ set -e cd "$(dirname "$0")/.." + +if [ ! -n "$DEVCONTAINER" ] && [ ! -n "$VIRTUAL_ENV" ]; then + python3 -m venv venv + source venv/bin/activate +fi + pip3 install -r requirements.txt -r requirements_optional.txt -r requirements_test.txt pip3 install --no-use-pep517 -e .