Skip to content

Dev Container for VS Code Python Extension #21435

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

Merged
merged 7 commits into from
Jun 26, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This image will serve as a starting point for devcontainer.json.
# Get fedora 37 as the base image.
FROM docker.io/library/fedora:37

# Install supported python versions and nodejs.
RUN dnf -y --nodocs install /usr/bin/{python3.7,python3.8,python3.9,python3.10,python3.11,git} nodejs gcc conda && \
Copy link
Member

Choose a reason for hiding this comment

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

Why gcc?

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
RUN dnf -y --nodocs install /usr/bin/{python3.7,python3.8,python3.9,python3.10,python3.11,git} nodejs gcc conda && \
RUN dnf -y --nodocs install /usr/bin/{python3.7,python3.8,python3.9,python3.10,python3.11,git, gcc, conda} nodejs && \

Copy link
Member

Choose a reason for hiding this comment

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

Why the installation of Node when you're doing that below via nvm?

Copy link
Author

Choose a reason for hiding this comment

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

The gcc is here because on the shell script that runs after creation of the docker container, I am installing requirements for users of the dev container to be able to run our tests, and for "build/smoke-test-requirements.txt", specifically, throws " No such file or directory: 'gcc' " if I do not include/download gcc on the docker file.

Copy link
Author

Choose a reason for hiding this comment

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

Good point! I've thought nvm only took take of managing and usage of specific version of node and npm, but realized nvm not only take cares of the controlling of the version, but also the installation itself.

Copy link
Author

Choose a reason for hiding this comment

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

Specifically the the build for psutil (seems to be a Python library that has to do with system utils and processes), more specifically "build/temp.linux-aarch64-cpython-37/psutil" is failing with " is failing with the message "ERROR: Failed building wheel for psutil" and "command 'gcc' failed: No such file or directory: 'gcc'"

Copy link
Member

@brettcannon brettcannon Jun 20, 2023

Choose a reason for hiding this comment

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

I think this is unique to your machine, since https://pypi.org/project/psutil/#files has wheel files for x64 and i686 for Linux, just not ARM.

But specifically, which dependency is pulling it in? Looking at https://github.com/microsoft/vscode-python/blob/main/build/smoke-test-requirements.txt there is no direct dependency on it. I also don't know why any of that is being installed since we have no kernel support, so I suspect the entire file can be dropped since we don't ship Jupyter in-box anymore and the middleware issue I believe has been fixed. @karthiknadig do we still need these installed?

Copy link
Member

Choose a reason for hiding this comment

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

Partially. We still have the old installer that installs pandas, jupyter etc. But, I don't think it requires these installed for testing. I don't see direct references to these packages in our test code. We might want to verify this by removing each package in the list, and running the tests to confirm.

Copy link
Author

@anthonykim1 anthonykim1 Jun 23, 2023

Choose a reason for hiding this comment

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

I think this is unique to your machine, since https://pypi.org/project/psutil/#files has wheel files for x64 and i686 for Linux, just not ARM.

After testing out installing smoke-test build requirement on both Codespaces directly, and via VS Code dev container extension, I found that the gcc is only needed to be installed for ARM host(?) machine.

I found this quite weird, because I would assume the platform is Fedora linux as I am accessing the dev container through the VS Code dev container extension.. the build for smoke-test-requirement is SUCCESSFUL when accessed via Codespaces, but fails when the dev container is accessed via VS Code dev container extension on my ARM machine.

Should I leave the gcc installation included?

Copy link
Author

Choose a reason for hiding this comment

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

Partially. We still have the old installer that installs pandas, jupyter etc. But, I don't think it requires these installed for testing. I don't see direct references to these packages in our test code. We might want to verify this by removing each package in the list, and running the tests to confirm.

When you say running the "tests", do you mean only the smoke test, or all the other tests too, including like unit tests and functional tests?

source ~/.bashrc && \
dnf clean all



# ENV version for node version, nvm version, npm version
ENV NVM_VERSION=0.39.3
ENV NODE_VERSION=16.17.1
ENV NPM_VERSION=8.19.3

# Install nvm, load nvm, and load nvm bash_completion
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v$NVM_VERSION/install.sh | bash
RUN export NVM_DIR="$HOME/.nvm" && \
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" && \
nvm install $NODE_VERSION && \
npm install -g npm@$NPM_VERSION

# For clean open source builds
ENV DISABLE_TRANSLATIONS=true