From 0054e6a3f6a49695f15d9526997ee0e02895ef83 Mon Sep 17 00:00:00 2001 From: Iain Dillingham Date: Mon, 4 Sep 2023 12:28:59 +0100 Subject: [PATCH 1/2] Hide requirements for dev containers Most users won't need -- and probably won't know the reason for -- requirements.in. If we move it to .devcontainer, then it's hidden. --- .devcontainer/devcontainer.json | 2 +- requirements.in => .devcontainer/requirements.in | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename requirements.in => .devcontainer/requirements.in (100%) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 3d2ff3d..56b1a78 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -23,7 +23,7 @@ // "forwardPorts": [], // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "pip3 install --user -r requirements.in", + "postCreateCommand": "pip3 install --user -r .devcontainer/requirements.in", // Configure tool-specific properties. "customizations": { diff --git a/requirements.in b/.devcontainer/requirements.in similarity index 100% rename from requirements.in rename to .devcontainer/requirements.in From 3e694c414cf079350707591c9b63429cd30cf063 Mon Sep 17 00:00:00 2001 From: Iain Dillingham Date: Mon, 4 Sep 2023 12:32:02 +0100 Subject: [PATCH 2/2] Indent with spaces Nitpick: but we seem to indent everything else with spaces, so let's indent devcontainer.json too. --- .devcontainer/devcontainer.json | 74 +++++++++++++++------------------ 1 file changed, 34 insertions(+), 40 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 56b1a78..c49b0f1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,45 +1,39 @@ // 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": "Python 3", - // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - // 2023-06-29: Use bullseye image instead of bookworm. - // At time of writing, bookworm is new and may have issues with dev containers: - // https://github.com/devcontainers/features/issues/576 - "image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye", - - // Features to add to the dev container. More info: https://containers.dev/features. - "features": { - "ghcr.io/devcontainers/features/docker-in-docker:2": { - "moby": true, - "azureDnsAutoDetection": true, - "installDockerBuildx": true, - "version": "latest", - "dockerDashComposeVersion": "v2" - } - }, - - // 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": "pip3 install --user -r .devcontainer/requirements.in", - - // Configure tool-specific properties. - "customizations": { - "vscode": { - "extensions": [ - "ms-python.python", - "ms-toolsai.jupyter", - "ms-toolsai.jupyter-renderers" - ] - } - }, - - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" - - "remoteEnv": { - "MAX_WORKERS": 2 + "name": "Python 3", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + // 2023-06-29: Use bullseye image instead of bookworm. + // At time of writing, bookworm is new and may have issues with dev containers: + // https://github.com/devcontainers/features/issues/576 + "image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye", + // Features to add to the dev container. More info: https://containers.dev/features. + "features": { + "ghcr.io/devcontainers/features/docker-in-docker:2": { + "moby": true, + "azureDnsAutoDetection": true, + "installDockerBuildx": true, + "version": "latest", + "dockerDashComposeVersion": "v2" } + }, + // 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": "pip3 install --user -r .devcontainer/requirements.in", + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python", + "ms-toolsai.jupyter", + "ms-toolsai.jupyter-renderers" + ] + } + }, + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" + "remoteEnv": { + "MAX_WORKERS": 2 + } }