diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6c17601b98a..3dc26ed2a94 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -12,10 +12,14 @@ "redhat.vscode-yaml", "esbenp.prettier-vscode" ], + // Please keep this file in sync with settings in home-assistant/.vscode/settings.default.json "settings": { "python.pythonPath": "/usr/local/bin/python", "python.linting.pylintEnabled": true, "python.linting.enabled": true, + "python.formatting.provider": "black", + "python.testing.pytestArgs": ["--no-cov"], + "python.testing.pytestEnabled": true, "editor.formatOnPaste": false, "editor.formatOnSave": true, "editor.formatOnType": true, diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e2fbe9761d0..9a69f0b444c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -48,7 +48,7 @@ repos: - id: check-executables-have-shebangs stages: [manual] - id: check-json - exclude: .vscode + exclude: (.vscode|.devcontainer) - id: no-commit-to-branch args: - --branch=dev diff --git a/.vscode/settings.json b/.vscode/settings.default.json similarity index 58% rename from .vscode/settings.json rename to .vscode/settings.default.json index 910db092e70..85cf4e8b83a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.default.json @@ -1,8 +1,9 @@ { + // Please keep this file in sync with settings in home-assistant/.devcontainer/devcontainer.json "python.formatting.provider": "black", - // https://code.visualstudio.com/docs/python/testing#_pytest-configuration-settings - "python.testing.pytestEnabled": true, // Added --no-cov to work around TypeError: message must be set // https://github.com/microsoft/vscode-python/issues/14067 - "python.testing.pytestArgs": ["--no-cov"] + "python.testing.pytestArgs": ["--no-cov"], + // https://code.visualstudio.com/docs/python/testing#_pytest-configuration-settings + "python.testing.pytestEnabled": true } diff --git a/script/bootstrap b/script/bootstrap index 3166b8c7701..f58268ff1a8 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -6,6 +6,14 @@ set -e cd "$(dirname "$0")/.." +# Add default vscode settings if not existing +SETTINGS_FILE=./.vscode/settings.json +SETTINGS_TEMPLATE_FILE=./.vscode/settings.default.json +if [ ! -f "$SETTINGS_FILE" ]; then + echo "Copy $SETTINGS_TEMPLATE_FILE to $SETTINGS_FILE." + cp "$SETTINGS_TEMPLATE_FILE" "$SETTINGS_FILE" +fi + echo "Installing development dependencies..." python3 -m pip install wheel --constraint homeassistant/package_constraints.txt python3 -m pip install tox colorlog pre-commit $(grep mypy requirements_test.txt) $(grep stdlib-list requirements_test.txt) $(grep tqdm requirements_test.txt) $(grep pipdeptree requirements_test.txt) --constraint homeassistant/package_constraints.txt