From 4e5cb0e09f2874d2fadbf29a3aabdceaf4c5f03c Mon Sep 17 00:00:00 2001 From: Jonathan B Coe Date: Sat, 31 Jan 2026 18:46:00 +0000 Subject: [PATCH 1/4] Copy devcontainer from https://github.com/jbcoe/pytorch-sandbox --- .devcontainer/.dockerfilelintrc | 2 ++ .devcontainer/Dockerfile | 26 +++++++++++++++++ .devcontainer/devcontainer.json | 52 +++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 .devcontainer/.dockerfilelintrc create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/.dockerfilelintrc b/.devcontainer/.dockerfilelintrc new file mode 100644 index 0000000..782a730 --- /dev/null +++ b/.devcontainer/.dockerfilelintrc @@ -0,0 +1,2 @@ +rules: + sudo_usage: off diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..60616a2 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,26 @@ +# Use Python:3.12-slim image as the base image as the PyTorch image +# https://hub.docker.com/r/pytorch/pytorch is too big (>3GB). +FROM python:3.12-slim + +# Install essential packages and create non-root user +RUN apt-get update && apt-get install -y --no-install-recommends git curl sudo bash-completion vim \ + && useradd -m -s /bin/bash vscode \ + && echo "vscode ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \ + && mkdir -p /workspace \ + && chown vscode:vscode /workspace \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /workspace + +# Switch to non-root user +USER vscode + +# Set up shell completions +RUN echo 'source /usr/share/bash-completion/completions/git' >> ~/.bashrc \ + && echo 'source /etc/bash_completion' >> ~/.bashrc + +# Set up uv and Python environment +RUN curl -LsSf https://astral.sh/uv/install.sh | sh + +# Set up environment variables +ENV PATH="/home/vscode/.local/bin:${PATH}" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..6f3379e --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,52 @@ +{ + "name": "py_cppmodel Dev Container", + "build": { + "dockerfile": "Dockerfile", + "context": ".." + }, + "customizations": { + "vscode": { + "extensions": [ + "charliermarsh.ruff", + "esbenp.prettier-vscode", + "github.vscode-pull-request-github", + "ms-python.mypy-type-checker", + "ms-python.python", + "ms-python.vscode-pylance", + "ms-toolsai.jupyter-keymap", + "ms-toolsai.jupyter-renderers", + "ms-toolsai.jupyter", + "ms-toolsai.vscode-jupyter-cell-tags", + "ms-toolsai.vscode-jupyter-slideshow", + "tamasfe.even-better-toml" + ], + "settings": { + "python.defaultInterpreterPath": "/usr/local/bin/python", + "[python]": { + "editor.defaultFormatter": "charliermarsh.ruff", + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "explicit" + } + }, + "[toml]": { + "editor.defaultFormatter": "tamasfe.even-better-toml", + "editor.formatOnSave": true + }, + "evenBetterToml.schema.enabled": true, + "evenBetterToml.schema.associations": { + "pyproject.toml": "https://json.schemastore.org/pyproject.json" + } + } + } + }, + "mounts": [ + "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached", + "source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached" + ], + "remoteUser": "vscode", + "updateRemoteUserUID": true, + "remoteEnv": { + "UV_LINK_MODE": "copy" + } +} From aa5978728cf7d6eaf463976bc48d0be1be600648 Mon Sep 17 00:00:00 2001 From: Jonathan B Coe Date: Sat, 31 Jan 2026 18:50:55 +0000 Subject: [PATCH 2/4] Simplify devcontainer and correct PythonPath --- .devcontainer/devcontainer.json | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6f3379e..679c627 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -18,24 +18,15 @@ "ms-toolsai.jupyter", "ms-toolsai.vscode-jupyter-cell-tags", "ms-toolsai.vscode-jupyter-slideshow", - "tamasfe.even-better-toml" ], "settings": { - "python.defaultInterpreterPath": "/usr/local/bin/python", + "python.defaultInterpreterPath": "/${workspaceFolder}/.venv/bin/python", "[python]": { "editor.defaultFormatter": "charliermarsh.ruff", "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.organizeImports": "explicit" } - }, - "[toml]": { - "editor.defaultFormatter": "tamasfe.even-better-toml", - "editor.formatOnSave": true - }, - "evenBetterToml.schema.enabled": true, - "evenBetterToml.schema.associations": { - "pyproject.toml": "https://json.schemastore.org/pyproject.json" } } } From d076ccf1a6328564f8248ae46c3a877da0bfcfd5 Mon Sep 17 00:00:00 2001 From: Jonathan B Coe Date: Sat, 31 Jan 2026 18:52:21 +0000 Subject: [PATCH 3/4] Cleanup from CodePilot review --- .devcontainer/Dockerfile | 2 -- .devcontainer/devcontainer.json | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 60616a2..d1c4445 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,3 @@ -# Use Python:3.12-slim image as the base image as the PyTorch image -# https://hub.docker.com/r/pytorch/pytorch is too big (>3GB). FROM python:3.12-slim # Install essential packages and create non-root user diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 679c627..676f004 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,5 @@ { - "name": "py_cppmodel Dev Container", + "name": "py-cppmodel Dev Container", "build": { "dockerfile": "Dockerfile", "context": ".." From 669df3687196572a48968aea0498a812073126b7 Mon Sep 17 00:00:00 2001 From: Jonathan B Coe Date: Sat, 31 Jan 2026 18:54:31 +0000 Subject: [PATCH 4/4] Cleanup from CodePilot review --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 676f004..fd24ccd 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -33,7 +33,7 @@ }, "mounts": [ "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached", - "source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached" + "source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached" ], "remoteUser": "vscode", "updateRemoteUserUID": true,