diff --git a/.devcontainer/.dockerignore b/.devcontainer/.dockerignore new file mode 100644 index 000000000000..3040a317c0bf --- /dev/null +++ b/.devcontainer/.dockerignore @@ -0,0 +1,3 @@ +node_modules +.pytest_cache +ms-python-insiders.vsix \ No newline at end of file diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000000..eac80f12a620 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,29 @@ +FROM mcr.microsoft.com/devcontainers/python:3.7 + +ENV CI_PYTHON_PATH=python + +RUN python -m pip install --upgrade pip + +COPY build/test-requirements.txt ./ +RUN python -m pip install -r test-requirements.txt \ + && rm test-requirements.txt + +COPY build/smoke-test-requirements.txt ./ +RUN python -m pip install -r smoke-test-requirements.txt \ + && rm smoke-test-requirements.txt + +COPY build/functional-test-requirements.txt ./ +RUN python -m pip install -r functional-test-requirements.txt \ + && rm functional-test-requirements.txt + +COPY build/functional-test-requirements.txt ./ +RUN python -m pip install -r functional-test-requirements.txt \ + && rm functional-test-requirements.txt + +COPY build/debugger-install-requirements.txt ./ +RUN python -m pip install -r debugger-install-requirements.txt \ + && rm debugger-install-requirements.txt + + +RUN apt-get update +RUN apt-get install -y libatk1.0-0 libatk-bridge2.0-0 libdrm2 libgtk-3-0 libgbm-dev libasound2 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000000..1f7a2262abdf --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,41 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/python +{ + "name": "VSCode Python Dev Container", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "build": { + "dockerfile": "./Dockerfile", + "context": ".." + }, + "customizations": { + "vscode": { + "extensions": [ + "editorconfig.editorconfig", + "esbenp.prettier-vscode", + "dbaeumer.vscode-eslint", + "ms-python.python", + "ms-python.black-formatter", + "ms-python.vscode-pylance" + ], + "settings": { + "python.defaultInterpreterPath": "/usr/local/bin/python" + } + } + }, + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "bash scripts/post_create_command.sh", + "features": { + "ghcr.io/devcontainers/features/node:1": { + "nodeGypDependencies": true, + "version": "14.18" + } + } + // Configure tool-specific properties. + // "customizations": {}, + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 174a850c901e..7a58cf0eee8f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,69 +1,81 @@ // Place your settings in this file to overwrite default and user settings. { - "files.exclude": { - "out": true, // set this to true to hide the "out" folder with the compiled JS files - "dist": true, - "**/*.pyc": true, - ".nyc_output": true, - "obj": true, - "bin": true, - "**/__pycache__": true, - "**/node_modules": true, - ".vscode-test": false, - ".vscode test": false, - "**/.mypy_cache/**": true - }, - "search.exclude": { - "out": true, // set this to false to include "out" folder in search results - "dist": true, - "**/node_modules": true, - "coverage": true, - "languageServer*/**": true, - ".vscode-test": true, - ".vscode test": true - }, - "[python]": { - "editor.formatOnSave": true, - "editor.codeActionsOnSave": { - "source.organizeImports": true - } + "[JSON]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnPaste": true, + "editor.formatOnSave": true }, - "[typescript]": { + "[YAML]": { "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnPaste": true, "editor.formatOnSave": true }, "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnPaste": true, "editor.formatOnSave": true }, - "[JSON]": { + "[jsonc]": { "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnPaste": true, "editor.formatOnSave": true }, - "[YAML]": { + "[python]": { + "editor.codeActionsOnSave": { + "source.organizeImports": true + }, + "editor.defaultFormatter": "ms-python.black-formatter", + "editor.formatOnPaste": true, + "editor.formatOnSave": true + }, + "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnPaste": true, "editor.formatOnSave": true }, - "typescript.tsdk": "./node_modules/typescript/lib", // we want to use the TS server from our node_modules folder to control its version - "python.linting.enabled": false, - "python.formatting.provider": "black", - "python.sortImports.args": ["--profile", "black"], - "typescript.preferences.quoteStyle": "single", - "javascript.preferences.quoteStyle": "single", - "typescriptHero.imports.stringQuoteStyle": "'", - "prettier.printWidth": 120, - "prettier.singleQuote": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": true }, + "files.autoSave": "onFocusChange", + "files.exclude": { + "**/*.pyc": true, + "**/.mypy_cache/**": true, + "**/__pycache__": true, + "**/node_modules": true, + ".nyc_output": true, + ".vscode test": false, + ".vscode-test": false, + "bin": true, + "dist": true, + "obj": true, + "out": true // set this to true to hide the "out" folder with the compiled JS files + }, + "files.trimTrailingWhitespace": true, + "javascript.preferences.quoteStyle": "single", + "prettier.printWidth": 120, + "prettier.singleQuote": true, + "python.formatting.provider": "black", "python.languageServer": "Default", - "python.linting.pylintEnabled": false, - "python.linting.flake8Enabled": true, - "cucumberautocomplete.skipDocStringsFormat": true, + "python.linting.enabled": false, "python.linting.flake8Args": [ // Match what black does. "--max-line-length=88" ], + "python.linting.flake8Enabled": true, + "python.linting.pylintEnabled": false, + "isort.args": ["--profile", "black"], + "python.testing.pytestArgs": ["src/test/pythonFiles"], + "search.exclude": { + "**/node_modules": true, + ".vscode test": true, + ".vscode-test": true, + "coverage": true, + "dist": true, + "languageServer*/**": true, + "out": true // set this to false to include "out" folder in search results + }, "typescript.preferences.importModuleSpecifier": "relative", - "debug.javascript.usePreview": false + "typescript.preferences.quoteStyle": "single", + "typescript.tsc.autoDetect": "off", + "typescript.tsdk": "./node_modules/typescript/lib", // we want to use the TS server from our node_modules folder to control its version } diff --git a/gulpfile.js b/gulpfile.js index a344b165a6cc..37cb42a31b61 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -226,6 +226,23 @@ gulp.task('prePublishBundle', gulp.series('webpack', 'renameSourceMaps')); gulp.task('checkDependencies', gulp.series('checkNativeDependencies')); gulp.task('prePublishNonBundle', gulp.series('compile')); +gulp.task('preparePythonDeps', async () => { + let args = ['-m', 'pip', 'install', '-U', 'pip']; + await spawnAsync(process.env.CI_PYTHON_PATH || 'python', args, undefined, true) + .then(() => true) + .catch((ex) => { + console.error("Failed to upgrade pip using 'python'", ex); + return false; + }); + args = ['-m', 'pip', 'install', 'wheel']; + await spawnAsync(process.env.CI_PYTHON_PATH || 'python', args, undefined, true) + .then(() => true) + .catch((ex) => { + console.error("Failed to install wheel requirement using 'python'", ex); + return false; + }); +}); + gulp.task('installPythonRequirements', async () => { let args = [ '-m', @@ -308,7 +325,7 @@ gulp.task('installDebugpy', async () => { rmrf.sync('./pythonFiles/lib/temp'); }); -gulp.task('installPythonLibs', gulp.series('installPythonRequirements', 'installDebugpy')); +gulp.task('installPythonLibs', gulp.series('preparePythonDeps', 'installPythonRequirements', 'installDebugpy')); function spawnAsync(command, args, env, rejectOnStdErr = false) { env = env || {}; diff --git a/scripts/post_create_command.sh b/scripts/post_create_command.sh new file mode 100644 index 000000000000..8465fe89e365 --- /dev/null +++ b/scripts/post_create_command.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +export PATH="./node_modules/.bin:$PATH" + +gulp installPythonLibs +npm ci