Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial devcontainer support #20960

Closed
wants to merge 8 commits into from

Conversation

cpinamtz
Copy link

@cpinamtz cpinamtz commented Mar 31, 2023

Closes #20942

Results inside DevContainer of npm scripts:

  • test ❎ (see detailed steps taken below)
  • test:unittests ✔️
  • test:functional
  • testDebugger
  • testSingleWorkspace
  • testMultiWorkspace
  • testPerformance

Steps taken related to execution of npm run test command:

1. After executing npm run compile successfully as a postCreateCommand of the devcontainer.json file:

$ npm run test

> python@2023.7.0-dev test
> node ./out/test/standardTest.js && node ./out/test/multiRootTest.js

****************************************************************************************************
Start Standard tests
Using insiders build of VS Code.
Found existing install in /workspaces/vscode-python/.vscode-test/vscode-linux-x64-insiders. Skipping download
Jupyter Extension not required
Pylance Extension not required
Starting vscode insiders with args --disable-extensions /workspaces/vscode-python/src/test --enable-proposed-api --timeout 5000
Found existing install in /workspaces/vscode-python/.vscode-test/vscode-linux-x64-insiders. Skipping download
/workspaces/vscode-python/.vscode-test/vscode-linux-x64-insiders/VSCode-linux-x64/code-insiders: error while loading shared libraries: libatk-1.0.so.0: cannot open shared object file: No such file or directory
Exit code:   127
End Standard tests (with errors) Failed

2. After executing sudo apt-get install libatk1.0-0 (ref: https://www.masmasit.com/2021/08/how-to-install-package-libatk-10so0-on_01058658241.html)

$ npm run test

> python@2023.7.0-dev test
> node ./out/test/standardTest.js && node ./out/test/multiRootTest.js

****************************************************************************************************
Start Standard tests
Using insiders build of VS Code.
Found existing install in /workspaces/vscode-python/.vscode-test/vscode-linux-x64-insiders. Skipping download
Jupyter Extension not required
Pylance Extension not required
Starting vscode insiders with args --disable-extensions /workspaces/vscode-python/src/test --enable-proposed-api --timeout 5000
Found existing install in /workspaces/vscode-python/.vscode-test/vscode-linux-x64-insiders. Skipping download
/workspaces/vscode-python/.vscode-test/vscode-linux-x64-insiders/VSCode-linux-x64/code-insiders: error while loading shared libraries: libatk-bridge-2.0.so.0: cannot open shared object file: No such file or directory
Exit code:   127
End Standard tests (with errors) Failed

3. After executing sudo apt-get install libatk-bridge2.0-0 (ref: https://www.masmasit.com/2021/08/how-to-install-package-libatk-bridge-.html)

$ npm run test

> python@2023.7.0-dev test
> node ./out/test/standardTest.js && node ./out/test/multiRootTest.js

****************************************************************************************************
Start Standard tests
Using insiders build of VS Code.
Found existing install in /workspaces/vscode-python/.vscode-test/vscode-linux-x64-insiders. Skipping download
Jupyter Extension not required
Pylance Extension not required
Starting vscode insiders with args --disable-extensions /workspaces/vscode-python/src/test --enable-proposed-api --timeout 5000
Found existing install in /workspaces/vscode-python/.vscode-test/vscode-linux-x64-insiders. Skipping download
/workspaces/vscode-python/.vscode-test/vscode-linux-x64-insiders/VSCode-linux-x64/code-insiders: error while loading shared libraries: libdrm.so.2: cannot open shared object file: No such file or directory
Exit code:   127
End Standard tests (with errors) Failed

4. After executing sudo apt-get install libdrm2 (ref: https://ubuntu.pkgs.org/20.04/ubuntu-main-amd64/libdrm2_2.4.101-2_amd64.deb.html)

$ npm run test

> python@2023.7.0-dev test
> node ./out/test/standardTest.js && node ./out/test/multiRootTest.js

****************************************************************************************************
Start Standard tests
Using insiders build of VS Code.
Found existing install in /workspaces/vscode-python/.vscode-test/vscode-linux-x64-insiders. Skipping download
Jupyter Extension not required
Pylance Extension not required
Starting vscode insiders with args --disable-extensions /workspaces/vscode-python/src/test --enable-proposed-api --timeout 5000
Found existing install in /workspaces/vscode-python/.vscode-test/vscode-linux-x64-insiders. Skipping download
/workspaces/vscode-python/.vscode-test/vscode-linux-x64-insiders/VSCode-linux-x64/code-insiders: error while loading shared libraries: libgtk-3.so.0: cannot open shared object file: No such file or directory
Exit code:   127
End Standard tests (with errors) Failed

5. After executing sudo apt-get install libgtk-3-0 (ref: https://zoomadmin.com/HowToInstall/UbuntuPackage/libgtk-3-0)

$ npm run test

> python@2023.7.0-dev test
> node ./out/test/standardTest.js && node ./out/test/multiRootTest.js

****************************************************************************************************
Start Standard tests
Using insiders build of VS Code.
Found existing install in /workspaces/vscode-python/.vscode-test/vscode-linux-x64-insiders. Skipping download
Jupyter Extension not required
Pylance Extension not required
Starting vscode insiders with args --disable-extensions /workspaces/vscode-python/src/test --enable-proposed-api --timeout 5000
Found existing install in /workspaces/vscode-python/.vscode-test/vscode-linux-x64-insiders. Skipping download
/workspaces/vscode-python/.vscode-test/vscode-linux-x64-insiders/VSCode-linux-x64/code-insiders: error while loading shared libraries: libgbm.so.1: cannot open shared object file: No such file or directory
Exit code:   127
End Standard tests (with errors) Failed

6. After executing sudo apt-get install libgbm-dev (ref: https://stackoverflow.com/a/67407105/4315310)

$ npm run test

> python@2023.7.0-dev test
> node ./out/test/standardTest.js && node ./out/test/multiRootTest.js

****************************************************************************************************
Start Standard tests
Using insiders build of VS Code.
Found existing install in /workspaces/vscode-python/.vscode-test/vscode-linux-x64-insiders. Skipping download
Jupyter Extension not required
Pylance Extension not required
Starting vscode insiders with args --disable-extensions /workspaces/vscode-python/src/test --enable-proposed-api --timeout 5000
Found existing install in /workspaces/vscode-python/.vscode-test/vscode-linux-x64-insiders. Skipping download
/workspaces/vscode-python/.vscode-test/vscode-linux-x64-insiders/VSCode-linux-x64/code-insiders: error while loading shared libraries: libasound.so.2: cannot open shared object file: No such file or directory
Exit code:   127
End Standard tests (with errors) Failed

7. After executing sudo apt-get install libasound2 (ref: https://www.masmasit.com/2021/08/how-to-install-package-libasound-so-2-on.html)

$ npm run test

> python@2023.7.0-dev test
> node ./out/test/standardTest.js && node ./out/test/multiRootTest.js

****************************************************************************************************
Start Standard tests
Using insiders build of VS Code.
Found existing install in /workspaces/vscode-python/.vscode-test/vscode-linux-x64-insiders. Skipping download
Jupyter Extension not required
Pylance Extension not required
Starting vscode insiders with args --disable-extensions /workspaces/vscode-python/src/test --enable-proposed-api --timeout 5000
Found existing install in /workspaces/vscode-python/.vscode-test/vscode-linux-x64-insiders. Skipping download
Exit code:   SIGTRAP
End Standard tests (with errors) SIGTRAP

@@ -0,0 +1,4 @@
FROM mcr.microsoft.com/devcontainers/python:0-3.10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be 3.7, also, this should install the test requirements.

FROM mcr.microsoft.com/devcontainers/python:0-3.10

RUN apt-get update
# RUN apt-get install -y libatk1.0-0 libatk-bridge2.0-0 libdrm2 libgtk-3-0 libgbm-dev libasound2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thing to do is set the python as CI_PYTHON_PATH.

// 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": "npm install ; npm run compile",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also run gulp task to setup the python packages used by the extension.

@karthiknadig karthiknadig requested a review from karrtikr April 4, 2023 05:31
@karthiknadig karthiknadig self-assigned this Apr 4, 2023
@cpinamtz cpinamtz force-pushed the codespaces-prebuilds branch from bb5692f to ae3a0f4 Compare April 6, 2023 14:40
@cpinamtz

This comment was marked as outdated.

@cpinamtz cpinamtz force-pushed the codespaces-prebuilds branch from ae3a0f4 to 0d0d159 Compare April 6, 2023 14:51
@karrtikr karrtikr added the feature-request Request for new features or functionality label Apr 18, 2023
Copy link

@karrtikr karrtikr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you have a look at https://github.com/microsoft/vscode-pylint/pull/304/files? There seems to be several properties missing which are required, for eg. extensions.

Also have a look at pr-check.yml, we need to install certain requirement files as well. Feel free to @ mention me if you need help.

@cpinamtz cpinamtz force-pushed the codespaces-prebuilds branch 2 times, most recently from 707660e to 1341df1 Compare April 22, 2023 11:40
@cpinamtz
Copy link
Author

@karrtikr Added extensions directly from .vscode/extensions.json file.

Related to the 2nd point of pr-check.yml, I still have no clear which requirements files should be installed but, based on the vscode-pylint's devcontainer's Dockerfile I've installed all the requirements files placed in the build folder.

Copy link

@karrtikr karrtikr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure to add these settings as well (microsoft/vscode-pylint#304):
image

"features": {
"ghcr.io/devcontainers/features/node:1": {
"nodeGypDependencies": true,
"version": "16"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@karrtikr
Copy link

karrtikr commented May 1, 2023

Related to the 2nd point of pr-check.yml, I still have no clear which requirements files should be installed

@cpinamtz Regarding this, have a look at action.yml starting here. We need to make sure all these steps until this are run.

@cpinamtz cpinamtz force-pushed the codespaces-prebuilds branch from 1341df1 to 831a2c0 Compare May 2, 2023 11:45
@cpinamtz cpinamtz requested a review from karrtikr May 2, 2023 11:49
@cpinamtz
Copy link
Author

cpinamtz commented May 2, 2023

Related to the 2nd point of pr-check.yml, I still have no clear which requirements files should be installed

@cpinamtz Regarding this, have a look at action.yml starting here. We need to make sure all these steps until this are run.

I don't know if it's the best approach but, among other things, I've considered the idea of creating a new task to achieve pip upgrade and wheel installation. Let me know if it's a good one or not. Thanks!

Copy link

@karrtikr karrtikr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, please don't remove any existing settings, only add new ones if it doesn't already exist in some form. I like you using gulp for this instead, but make sure it is available and installed in the codespace container.



RUN apt-get update
RUN apt-get install -y libatk1.0-0 libatk-bridge2.0-0 libdrm2 libgtk-3-0 libgbm-dev libasound2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious, where're these coming from?

.vscode/settings.json Outdated Show resolved Hide resolved
.vscode/settings.json Outdated Show resolved Hide resolved

gulp installPythonLibs
npm ci
npm run compile
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this, it can be done manually.

@cpinamtz cpinamtz force-pushed the codespaces-prebuilds branch from 831a2c0 to 1cea782 Compare May 7, 2023 17:13
cpinamtz added 8 commits May 7, 2023 19:19
Added defaultFormatter for Python and tests location for Pytest.
Used `richie5um2.vscode-sort-json` extension
`python.sortImports.args` property will be removed soon
Set it as the 1st one to the existent `installPythonLibs`
gulp task
- Replace npm install by npm ci in devcontainer
- Remove npm run compile
@cpinamtz cpinamtz force-pushed the codespaces-prebuilds branch from 1cea782 to 315681d Compare May 7, 2023 17:19
@karthiknadig karthiknadig requested a review from karrtikr May 16, 2023 04:56
Copy link

@karrtikr karrtikr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM otherwise

"features": {
"ghcr.io/devcontainers/features/node:1": {
"nodeGypDependencies": true,
"version": "14.18"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@karthiknadig Please advise the node version to use here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

16.17.1

"features": {
"ghcr.io/devcontainers/features/node:1": {
"nodeGypDependencies": true,
"version": "14.18"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version": "14.18"
"version": "16.17.1"

"dbaeumer.vscode-eslint",
"ms-python.python",
"ms-python.black-formatter",
"ms-python.vscode-pylance"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"ms-python.vscode-pylance"
"ms-python.vscode-pylance",
"charliermarsh.ruff"

@anthonykim1
Copy link

anthonykim1 commented Jul 21, 2023

Hello! Thank you for the PR. While bulk of what you had in the devcontainer.json was great, we decided to go with slightly different approach when it comes to the Dockerfile and post/on/update Create commands. Instead of the python image that you have used, we decided to use the official Microsoft node version for the base docker image, while also adding pyenv to manage and install different versions of Python (3.7, 3.8, 3.9, 3.10, 3.11 latest..etc) All the commands would also be better suited to be relocated into onCreateCommand.sh, to leverage the benefits of prebuild and so users don't have to sit for their container to load with all the necessary requirement installation that we are doing! I do see you had some other changes in the PR, so please let us know or provide a different PR if you would like to get those changes in! Thank you so much!! Related: #21435 #21675

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set up Codespaces prebuilds
4 participants