Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
59 changes: 59 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
ARG PYTHON_VERSION="3.10"
FROM python:${PYTHON_VERSION}-slim

RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \
ca-certificates \
coreutils \
curl \
dialog \
dirmngr \
gcc \
git \
gnupg2 \
iproute2 \
libssl1.1 \
libxml2-dev \
libxslt-dev \
openssh-client \
procps \
psmisc \
rsync \
sudo \
unzip \
wget \
zip \
zlib1g \
libz-dev \
&& rm -rf /var/lib/apt/lists/*

# Install common python tools for development
RUN pip install \
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need all of these? The minimal set of development tools in use are otherwise included in the [tests]extra and installed with ./configure --dev

Copy link
Author

Choose a reason for hiding this comment

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

We do if we are still relying on PIP as considering some packages will need to handle python wheel buildings.
As i heard you are working on an pip-less env, maybe this is not needed anymore

autopep8 \
black \
flake8 \
mypy \
poetry \
pre-commit \
pylint

ARG USERNAME=vscode
ARG USER_ID=1000
ARG USER_GID=$USER_ID

# Run with non privileged user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd \
--uid $USER_ID \
--gid $USER_GID \
--shell /bin/bash \
--create-home $USERNAME

# sudo support
RUN echo "$USERNAME ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME

ENV CONFIGURE_SUPPORTED_PYTHON=${PYTHON_VERSION}

USER $USERNAME
31 changes: 31 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.112.0/containers/python-3
{
"name": "ScanCode-Toolkit",
"build": {
"dockerfile": "Dockerfile",
},
"settings": {
"puppet.installType": "pdk",
Copy link
Member

Choose a reason for hiding this comment

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

Is puppet part of the environment?

"python.pythonPath": "/usr/local/bin/python",
"python.languageServer": "Pylance",
"python.linting.enabled": true,
"python.formatting.provider": "black",
"python.unitTest.pyTestEnabled": true,
"editor.formatOnSave": true,
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
Copy link
Member

Choose a reason for hiding this comment

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

are these specific to a developer's local setup?

"ms-python.python",
"ms-python.vscode-pylance",
"shardulm94.trailing-spaces",
"formulahendry.code-runner",
"aaron-bond.better-comments",
"eamodio.gitlens",
"wholroyd.jinja",
// "xdebug.php-pack",
// "puppet.puppet-vscode",
],
// "postCreateCommand": "./configure --dev",
"postStartCommand": "pip install -r requirements.txt -r requirements-dev.txt"
Copy link
Member

Choose a reason for hiding this comment

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

This may not be the best command. We use these only as constraints and no longer as plain requirements. See https://github.com/nexB/scancode-toolkit/blob/1dc4b61c89ea6b66d9ff6d596c159633ce757d92/configure#L28

So IMHO running configure --dev (on all OSes) would be a better option.

}