From 42ed702a6b9e52208a3513c1ec9adcd0ab606a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Thu, 30 Jan 2025 15:28:12 +0100 Subject: [PATCH 1/7] refactor: use fully defined "dependsOn" in feature --- .github/.devcontainer/devcontainer.json | 37 +++---------------- .../devcontainer-feature.json | 30 +++++++++++++-- 2 files changed, 32 insertions(+), 35 deletions(-) diff --git a/.github/.devcontainer/devcontainer.json b/.github/.devcontainer/devcontainer.json index 8f1a261..c75cc31 100644 --- a/.github/.devcontainer/devcontainer.json +++ b/.github/.devcontainer/devcontainer.json @@ -10,38 +10,13 @@ }, "remoteUser": "vscode", "features": { - "ghcr.io/devcontainers/features/common-utils:2": { - "installZsh": "true", - "username": "vscode", - "userUid": "1000", - "userGid": "1000", - "upgradePackages": "true" - }, - "ghcr.io/devcontainers/features/git:1": { - "version": "latest", - "ppa": "false" - }, - "ghcr.io/rocker-org/devcontainer-features/r-rig:1": { - "version": "release", - "vscodeRSupport": "none", - "installDevTools": "false", - "installREnv": "true", - "installRMarkdown": "false" - }, - "ghcr.io/devcontainers/features/python:1": { - "version": "latest", - "enableShared": "true" - }, - "ghcr.io/julialang/devcontainer-features/julia:1": { - "channel": "release" - }, "./quarto-computing-dependencies": { "dependencies": "all" - }, - "ghcr.io/rocker-org/devcontainer-features/quarto-cli:1": { - "version": "prerelease", - "installTinyTex": "true", - "installChromium": "false" - } + }//, + // "ghcr.io/rocker-org/devcontainer-features/quarto-cli:1": { + // "version": "prerelease", + // "installTinyTex": "true", + // "installChromium": "false" + // } } } diff --git a/.github/.devcontainer/quarto-computing-dependencies/devcontainer-feature.json b/.github/.devcontainer/quarto-computing-dependencies/devcontainer-feature.json index e7c688c..fd0ca4e 100644 --- a/.github/.devcontainer/quarto-computing-dependencies/devcontainer-feature.json +++ b/.github/.devcontainer/quarto-computing-dependencies/devcontainer-feature.json @@ -12,13 +12,35 @@ } }, "dependsOn": { - "ghcr.io/devcontainers/features/common-utils": {}, - "ghcr.io/rocker-org/devcontainer-features/r-rig": {}, - "ghcr.io/devcontainers/features/python": {}, - "ghcr.io/julialang/devcontainer-features/julia": {} + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": "true", + "username": "vscode", + "userUid": "1000", + "userGid": "1000", + "upgradePackages": "true" + }, + "ghcr.io/devcontainers/features/git:1": { + "version": "latest", + "ppa": "false" + }, + "ghcr.io/rocker-org/devcontainer-features/r-rig:1": { + "version": "release", + "vscodeRSupport": "none", + "installDevTools": "false", + "installREnv": "true", + "installRMarkdown": "false" + }, + "ghcr.io/devcontainers/features/python:1": { + "version": "latest", + "enableShared": "true" + }, + "ghcr.io/julialang/devcontainer-features/julia:1": { + "channel": "release" + } }, "installsAfter": [ "ghcr.io/devcontainers/features/common-utils", + "ghcr.io/devcontainers/features/git", "ghcr.io/rocker-org/devcontainer-features/r-rig", "ghcr.io/devcontainers/features/python", "ghcr.io/julialang/devcontainer-features/julia" From 8bb87601d57de856559a3543bc082eee6339663c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Thu, 30 Jan 2025 15:28:29 +0100 Subject: [PATCH 2/7] fix: don't use "su" for Python --- .github/.devcontainer/quarto-computing-dependencies/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/.devcontainer/quarto-computing-dependencies/install.sh b/.github/.devcontainer/quarto-computing-dependencies/install.sh index d8a2998..be7b28c 100755 --- a/.github/.devcontainer/quarto-computing-dependencies/install.sh +++ b/.github/.devcontainer/quarto-computing-dependencies/install.sh @@ -37,7 +37,7 @@ quarto_r_deps() { } quarto_python_deps() { - su "${USERNAME}" -c "python3 -m pip install jupyter papermill" + python3 -m pip install jupyter papermill } quarto_julia_deps() { From 77f064dbb2d9cb456b54dda7d10583763447a5dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Thu, 30 Jan 2025 15:30:55 +0100 Subject: [PATCH 3/7] chore: don't set feature option --- .github/.devcontainer/devcontainer.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/.devcontainer/devcontainer.json b/.github/.devcontainer/devcontainer.json index c75cc31..f60b40b 100644 --- a/.github/.devcontainer/devcontainer.json +++ b/.github/.devcontainer/devcontainer.json @@ -10,9 +10,7 @@ }, "remoteUser": "vscode", "features": { - "./quarto-computing-dependencies": { - "dependencies": "all" - }//, + "./quarto-computing-dependencies": {}//, // "ghcr.io/rocker-org/devcontainer-features/quarto-cli:1": { // "version": "prerelease", // "installTinyTex": "true", From e5081e3c7636343c5892020fb16573401b33a344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Thu, 30 Jan 2025 15:34:38 +0100 Subject: [PATCH 4/7] fix: install all dependencies --- .../devcontainer-feature.json | 8 ------- .../quarto-computing-dependencies/install.sh | 21 +++---------------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/.github/.devcontainer/quarto-computing-dependencies/devcontainer-feature.json b/.github/.devcontainer/quarto-computing-dependencies/devcontainer-feature.json index fd0ca4e..1695f08 100644 --- a/.github/.devcontainer/quarto-computing-dependencies/devcontainer-feature.json +++ b/.github/.devcontainer/quarto-computing-dependencies/devcontainer-feature.json @@ -3,14 +3,6 @@ "version": "1.0.0", "name": "Install Computing Dependencies for Quarto", "description": "Install R, Python, and Julia dependencies for Quarto.", - "options": { - "dependencies": { - "type": "string", - "enum": ["all", "r", "python", "julia"], - "default": "all", - "description": "Specify what dependencies to install." - } - }, "dependsOn": { "ghcr.io/devcontainers/features/common-utils:2": { "installZsh": "true", diff --git a/.github/.devcontainer/quarto-computing-dependencies/install.sh b/.github/.devcontainer/quarto-computing-dependencies/install.sh index be7b28c..b3478ac 100755 --- a/.github/.devcontainer/quarto-computing-dependencies/install.sh +++ b/.github/.devcontainer/quarto-computing-dependencies/install.sh @@ -4,8 +4,6 @@ set -e export DEBIAN_FRONTEND=noninteractive -DEPENDENCIES=${DEPENDENCIES:-"all"} - USERNAME=${USERNAME:-${_REMOTE_USER:-"automatic"}} set -e @@ -44,19 +42,6 @@ quarto_julia_deps() { su "${USERNAME}" -c "~/.juliaup/bin/julia -e 'using Pkg; Pkg.add(\"IJulia\")'" } -case ${DEPENDENCIES} in - all) - quarto_r_deps - quarto_python_deps - quarto_julia_deps - ;; - r) - quarto_r_deps - ;; - python) - quarto_python_deps - ;; - julia) - quarto_julia_deps - ;; -esac +quarto_r_deps +quarto_python_deps +quarto_julia_deps From 5bb35e0bdb6cfd5bf8e12f22f7b5dcf07f59cf97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Thu, 30 Jan 2025 15:34:56 +0100 Subject: [PATCH 5/7] revert: debug change --- .github/.devcontainer/devcontainer.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/.devcontainer/devcontainer.json b/.github/.devcontainer/devcontainer.json index f60b40b..167de02 100644 --- a/.github/.devcontainer/devcontainer.json +++ b/.github/.devcontainer/devcontainer.json @@ -10,11 +10,11 @@ }, "remoteUser": "vscode", "features": { - "./quarto-computing-dependencies": {}//, - // "ghcr.io/rocker-org/devcontainer-features/quarto-cli:1": { - // "version": "prerelease", - // "installTinyTex": "true", - // "installChromium": "false" - // } + "./quarto-computing-dependencies": {}, + "ghcr.io/rocker-org/devcontainer-features/quarto-cli:1": { + "version": "prerelease", + "installTinyTex": "true", + "installChromium": "false" + } } } From 1fc5163caf9d5dae60f45e97470930ef212988bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Thu, 30 Jan 2025 15:07:03 +0000 Subject: [PATCH 6/7] feat: use options to set dependencies --- .github/.devcontainer/devcontainer.json | 16 +++++++++----- .../devcontainer-feature.json | 17 ++++++++++++++ .../quarto-computing-dependencies/install.sh | 22 ++++++++++++++----- 3 files changed, 43 insertions(+), 12 deletions(-) diff --git a/.github/.devcontainer/devcontainer.json b/.github/.devcontainer/devcontainer.json index 167de02..0f63525 100644 --- a/.github/.devcontainer/devcontainer.json +++ b/.github/.devcontainer/devcontainer.json @@ -10,11 +10,15 @@ }, "remoteUser": "vscode", "features": { - "./quarto-computing-dependencies": {}, - "ghcr.io/rocker-org/devcontainer-features/quarto-cli:1": { - "version": "prerelease", - "installTinyTex": "true", - "installChromium": "false" - } + "./quarto-computing-dependencies": { + "rDeps": "rmarkdown", + "pythonDeps": "jupyter,papermill", + "juliaDeps": "IJulia" + }//, + // "ghcr.io/rocker-org/devcontainer-features/quarto-cli:1": { + // "version": "prerelease", + // "installTinyTex": "true", + // "installChromium": "false" + // } } } diff --git a/.github/.devcontainer/quarto-computing-dependencies/devcontainer-feature.json b/.github/.devcontainer/quarto-computing-dependencies/devcontainer-feature.json index 1695f08..8a5c7f6 100644 --- a/.github/.devcontainer/quarto-computing-dependencies/devcontainer-feature.json +++ b/.github/.devcontainer/quarto-computing-dependencies/devcontainer-feature.json @@ -3,6 +3,23 @@ "version": "1.0.0", "name": "Install Computing Dependencies for Quarto", "description": "Install R, Python, and Julia dependencies for Quarto.", + "options": { + "rDeps": { + "type": "string", + "default": "rmarkdown", + "description": "Specify what R dependencies to install." + }, + "pythonDeps": { + "type": "string", + "default": "jupyter,papermill", + "description": "Specify what Python dependencies to install." + }, + "juliaDeps": { + "type": "string", + "default": "IJulia", + "description": "Specify what Julia dependencies to install." + } + }, "dependsOn": { "ghcr.io/devcontainers/features/common-utils:2": { "installZsh": "true", diff --git a/.github/.devcontainer/quarto-computing-dependencies/install.sh b/.github/.devcontainer/quarto-computing-dependencies/install.sh index b3478ac..66221a1 100755 --- a/.github/.devcontainer/quarto-computing-dependencies/install.sh +++ b/.github/.devcontainer/quarto-computing-dependencies/install.sh @@ -6,6 +6,10 @@ export DEBIAN_FRONTEND=noninteractive USERNAME=${USERNAME:-${_REMOTE_USER:-"automatic"}} +R_DEPS=${R_DEPS:-"rmarkdown"} +PYTHON_DEPS=${PYTHON_DEPS:-"jupyter,papermill"} +JULIA_DEPS=${JULIA_DEPS:-"IJulia"} + set -e if [ "$(id -u)" -ne 0 ]; then @@ -31,17 +35,23 @@ elif [ "${USERNAME}" = "none" ] || ! id -u "${USERNAME}" >/dev/null 2>&1; then fi quarto_r_deps() { - su "${USERNAME}" -c "Rscript -e 'pak::pkg_install(\"rmarkdown\")'" + local deps=$1 + deps=$(echo "${deps}" | sed 's/,/","/g') + su "${USERNAME}" -c "Rscript -e 'pak::pkg_install(c(\"${deps}\"))'" } quarto_python_deps() { - python3 -m pip install jupyter papermill + local deps=$1 + deps=$(echo "${deps}" | sed 's/,/ /g') + python3 -m pip install ${deps} } quarto_julia_deps() { - su "${USERNAME}" -c "~/.juliaup/bin/julia -e 'using Pkg; Pkg.add(\"IJulia\")'" + local deps=$1 + deps=$(echo "${deps}" | sed 's/,/","/g') + su "${USERNAME}" -c "~/.juliaup/bin/julia -e 'using Pkg; Pkg.add.([\"${deps}\"])'" } -quarto_r_deps -quarto_python_deps -quarto_julia_deps +quarto_r_deps ${R_DEPS} +quarto_python_deps ${PYTHON_DEPS} +quarto_julia_deps ${JULIA_DEPS} From 3c9246dd7fa234bc224b33f6ea19f0b542528a77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Thu, 30 Jan 2025 15:52:44 +0000 Subject: [PATCH 7/7] fix: options to variable --- .github/.devcontainer/devcontainer.json | 2 +- .../.devcontainer/quarto-computing-dependencies/install.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/.devcontainer/devcontainer.json b/.github/.devcontainer/devcontainer.json index 0f63525..14df094 100644 --- a/.github/.devcontainer/devcontainer.json +++ b/.github/.devcontainer/devcontainer.json @@ -11,7 +11,7 @@ "remoteUser": "vscode", "features": { "./quarto-computing-dependencies": { - "rDeps": "rmarkdown", + "rDeps": "rmarkdown,httpgd", "pythonDeps": "jupyter,papermill", "juliaDeps": "IJulia" }//, diff --git a/.github/.devcontainer/quarto-computing-dependencies/install.sh b/.github/.devcontainer/quarto-computing-dependencies/install.sh index 66221a1..a53403d 100755 --- a/.github/.devcontainer/quarto-computing-dependencies/install.sh +++ b/.github/.devcontainer/quarto-computing-dependencies/install.sh @@ -6,9 +6,9 @@ export DEBIAN_FRONTEND=noninteractive USERNAME=${USERNAME:-${_REMOTE_USER:-"automatic"}} -R_DEPS=${R_DEPS:-"rmarkdown"} -PYTHON_DEPS=${PYTHON_DEPS:-"jupyter,papermill"} -JULIA_DEPS=${JULIA_DEPS:-"IJulia"} +R_DEPS=${RDEPS:-"rmarkdown"} +PYTHON_DEPS=${PYTHONDEPS:-"jupyter,papermill"} +JULIA_DEPS=${JULIADEPS:-"IJulia"} set -e