From da7524f61ebecfeac6dab5003fbb764477b16b6a Mon Sep 17 00:00:00 2001 From: Rongxin Liu Date: Sat, 27 Sep 2025 10:00:15 -0400 Subject: [PATCH 1/9] build and install customized python insider extension --- Dockerfile | 11 +++++++++++ devcontainer.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 759d7e8b..81f6b711 100644 --- a/Dockerfile +++ b/Dockerfile @@ -100,6 +100,17 @@ RUN npm install --global @vscode/vsce yarn && \ rm --force --recursive design50.vsix && \ npm uninstall --global vsce yarn +# Pull Python VS Code extension and remove run +RUN cd /tmp && \ + git clone --branch v2025.14.0 --depth 1 https://github.com/microsoft/vscode-python.git && \ + cd vscode-python && \ + # Remove the editor/title/run entry and save back to package.json + jq 'del(.contributes.menus."editor/title/run")' package.json > package.tmp.json && mv package.tmp.json package.json && \ + npm install && \ + npm run build && \ + mv ms-python-insiders.vsix /opt/cs50/extensions && \ + cd /tmp && \ + rm --force --recursive vscode-python # Final stage FROM cs50/cli:${TAG} diff --git a/devcontainer.json b/devcontainer.json index f0c499f1..88590bd1 100644 --- a/devcontainer.json +++ b/devcontainer.json @@ -16,6 +16,7 @@ "/opt/cs50/extensions/ddb50-2.0.0.vsix", "/opt/cs50/extensions/phpliteadmin-0.0.1.vsix", "/opt/cs50/extensions/style50-0.0.1.vsix", + "/opt/cs50/extensions/ms-python-insiders.vsix", "cs50.extension-uninstaller", "inferrinizzard.prettier-sql-vscode", "mathematic.vscode-pdf", @@ -33,7 +34,6 @@ "ms-ceintl.vscode-language-pack-zh-hans", "ms-ceintl.vscode-language-pack-zh-hant", "ms-python.autopep8", - "ms-python.python", "ms-vscode.cpptools", "ms-vscode.hexeditor", "ms-vsliveshare.vsliveshare", From 8bc6f8f0be3f49d313ae695477bc54bcaddb3150 Mon Sep 17 00:00:00 2001 From: Rongxin Liu Date: Sat, 27 Sep 2025 10:15:06 -0400 Subject: [PATCH 2/9] use npm package command --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 81f6b711..713681c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -100,14 +100,14 @@ RUN npm install --global @vscode/vsce yarn && \ rm --force --recursive design50.vsix && \ npm uninstall --global vsce yarn -# Pull Python VS Code extension and remove run +# Pull Python VS Code extension and remove run button from editor title menu RUN cd /tmp && \ git clone --branch v2025.14.0 --depth 1 https://github.com/microsoft/vscode-python.git && \ cd vscode-python && \ # Remove the editor/title/run entry and save back to package.json jq 'del(.contributes.menus."editor/title/run")' package.json > package.tmp.json && mv package.tmp.json package.json && \ npm install && \ - npm run build && \ + npm run package && \ mv ms-python-insiders.vsix /opt/cs50/extensions && \ cd /tmp && \ rm --force --recursive vscode-python From ce5060deba4c93062f2f973ce6879328f03e0a77 Mon Sep 17 00:00:00 2001 From: Rongxin Liu Date: Sat, 27 Sep 2025 11:58:40 -0400 Subject: [PATCH 3/9] remove run button from Python and debugger extensions in Dockerfile --- Dockerfile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 713681c0..036b7459 100644 --- a/Dockerfile +++ b/Dockerfile @@ -100,7 +100,7 @@ RUN npm install --global @vscode/vsce yarn && \ rm --force --recursive design50.vsix && \ npm uninstall --global vsce yarn -# Pull Python VS Code extension and remove run button from editor title menu +# Remove the run button from both the main Python extension and the debugger extension RUN cd /tmp && \ git clone --branch v2025.14.0 --depth 1 https://github.com/microsoft/vscode-python.git && \ cd vscode-python && \ @@ -112,6 +112,17 @@ RUN cd /tmp && \ cd /tmp && \ rm --force --recursive vscode-python +RUN cd /tmp && \ + git clone --branch v2025.10.0 --depth 1 https://github.com/microsoft/vscode-python-debugger.git && \ + cd vscode-python-debugger && \ + # Remove the editor/title/run entry and save back to package.json + jq 'del(.contributes.menus."editor/title/run")' package.json > package.tmp.json && mv package.tmp.json package.json && \ + npm install && \ + npm run vsce-package && \ + mv python-debugger.vsix /opt/cs50/extensions && \ + cd /tmp && \ + rm --force --recursive vscode-python-debugger + # Final stage FROM cs50/cli:${TAG} From 1a1949d3f74c3cc20914b37ae9d7e8105fd375ca Mon Sep 17 00:00:00 2001 From: Rongxin Liu Date: Sat, 27 Sep 2025 12:00:32 -0400 Subject: [PATCH 4/9] add python-debugger extension to devcontainer configuration --- devcontainer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/devcontainer.json b/devcontainer.json index 88590bd1..1121cee7 100644 --- a/devcontainer.json +++ b/devcontainer.json @@ -16,6 +16,7 @@ "/opt/cs50/extensions/ddb50-2.0.0.vsix", "/opt/cs50/extensions/phpliteadmin-0.0.1.vsix", "/opt/cs50/extensions/style50-0.0.1.vsix", + "/opt/cs50/extensions/python-debugger.vsix", "/opt/cs50/extensions/ms-python-insiders.vsix", "cs50.extension-uninstaller", "inferrinizzard.prettier-sql-vscode", From 3c59de870f16bec902c0f5bfd2c5c99da33db265 Mon Sep 17 00:00:00 2001 From: Rongxin Liu Date: Sat, 27 Sep 2025 12:10:52 -0400 Subject: [PATCH 5/9] remove run button from python environments extensions --- Dockerfile | 13 ++++++++++++- devcontainer.json | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 036b7459..0403f99b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -100,7 +100,7 @@ RUN npm install --global @vscode/vsce yarn && \ rm --force --recursive design50.vsix && \ npm uninstall --global vsce yarn -# Remove the run button from both the main Python extension and the debugger extension +# Remove the run button from both the main Python extension, debugger, and environments extensions RUN cd /tmp && \ git clone --branch v2025.14.0 --depth 1 https://github.com/microsoft/vscode-python.git && \ cd vscode-python && \ @@ -123,6 +123,17 @@ RUN cd /tmp && \ cd /tmp && \ rm --force --recursive vscode-python-debugger +RUN cd /tmp && \ + git clone --branch v1.8.0 --depth 1 https://github.com/microsoft/vscode-python-environments.git && \ + cd vscode-python-environments && \ + # Remove the editor/title/run entry and save back to package.json + jq 'del(.contributes.menus."editor/title/run")' package.json > package.tmp.json && mv package.tmp.json package.json && \ + npm install && \ + npm run vsce-package && \ + mv ms-python-envs-insiders.vsix /opt/cs50/extensions && \ + cd /tmp && \ + rm --force --recursive vscode-python-environments + # Final stage FROM cs50/cli:${TAG} diff --git a/devcontainer.json b/devcontainer.json index 1121cee7..27c2c792 100644 --- a/devcontainer.json +++ b/devcontainer.json @@ -17,6 +17,7 @@ "/opt/cs50/extensions/phpliteadmin-0.0.1.vsix", "/opt/cs50/extensions/style50-0.0.1.vsix", "/opt/cs50/extensions/python-debugger.vsix", + "/opt/cs50/extensions/ms-python-envs-insiders.vsix", "/opt/cs50/extensions/ms-python-insiders.vsix", "cs50.extension-uninstaller", "inferrinizzard.prettier-sql-vscode", From 81765e8e6801cd640abe33484b54e9f5538a1bb2 Mon Sep 17 00:00:00 2001 From: Rongxin Liu Date: Sat, 27 Sep 2025 12:24:24 -0400 Subject: [PATCH 6/9] refactor Dockerfile to dynamically build Python extensions using the latest tags --- Dockerfile | 55 ++++++++++++++++++++++++------------------------------ 1 file changed, 24 insertions(+), 31 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0403f99b..11ec11df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -100,39 +100,32 @@ RUN npm install --global @vscode/vsce yarn && \ rm --force --recursive design50.vsix && \ npm uninstall --global vsce yarn -# Remove the run button from both the main Python extension, debugger, and environments extensions -RUN cd /tmp && \ - git clone --branch v2025.14.0 --depth 1 https://github.com/microsoft/vscode-python.git && \ - cd vscode-python && \ - # Remove the editor/title/run entry and save back to package.json - jq 'del(.contributes.menus."editor/title/run")' package.json > package.tmp.json && mv package.tmp.json package.json && \ - npm install && \ - npm run package && \ - mv ms-python-insiders.vsix /opt/cs50/extensions && \ - cd /tmp && \ - rm --force --recursive vscode-python +# This builds custom versions of Microsoft's Python extensions without the "Run Python File" button RUN cd /tmp && \ - git clone --branch v2025.10.0 --depth 1 https://github.com/microsoft/vscode-python-debugger.git && \ - cd vscode-python-debugger && \ - # Remove the editor/title/run entry and save back to package.json - jq 'del(.contributes.menus."editor/title/run")' package.json > package.tmp.json && mv package.tmp.json package.json && \ - npm install && \ - npm run vsce-package && \ - mv python-debugger.vsix /opt/cs50/extensions && \ - cd /tmp && \ - rm --force --recursive vscode-python-debugger - -RUN cd /tmp && \ - git clone --branch v1.8.0 --depth 1 https://github.com/microsoft/vscode-python-environments.git && \ - cd vscode-python-environments && \ - # Remove the editor/title/run entry and save back to package.json - jq 'del(.contributes.menus."editor/title/run")' package.json > package.tmp.json && mv package.tmp.json package.json && \ - npm install && \ - npm run vsce-package && \ - mv ms-python-envs-insiders.vsix /opt/cs50/extensions && \ - cd /tmp && \ - rm --force --recursive vscode-python-environments + # Process each extension: format is "repo-name|build-command|output-filename" + for ext in \ + "vscode-python|package|ms-python-insiders.vsix" \ + "vscode-python-debugger|vsce-package|python-debugger.vsix" \ + "vscode-python-environments|vsce-package|ms-python-envs-insiders.vsix"; \ + do \ + IFS='|' read -r repo build_cmd output_file <<< "$ext" && \ + # Fetch the latest release tag from GitHub API + echo "Fetching latest release for $repo..." && \ + latest_tag=$(curl -s "https://api.github.com/repos/microsoft/$repo/releases/latest" | jq -r .tag_name) && \ + echo "Using version: $latest_tag" && \ + # Clone the repository at the latest release tag + git clone --branch "$latest_tag" --depth 1 "https://github.com/microsoft/$repo.git" && \ + cd "$repo" && \ + # Modify package.json to remove the "Run Python File" button from the editor title bar + jq 'del(.contributes.menus."editor/title/run")' package.json > package.tmp.json && \ + mv package.tmp.json package.json && \ + npm install && \ + npm run "$build_cmd" && \ + mv "$output_file" /opt/cs50/extensions && \ + cd /tmp && \ + rm --force --recursive "$repo"; \ + done # Final stage FROM cs50/cli:${TAG} From 91591c87c43f43235765969ed3969c52910d6ae5 Mon Sep 17 00:00:00 2001 From: Rongxin Liu Date: Sat, 27 Sep 2025 12:26:18 -0400 Subject: [PATCH 7/9] update comment --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 11ec11df..b9cffc6d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -117,7 +117,7 @@ RUN cd /tmp && \ # Clone the repository at the latest release tag git clone --branch "$latest_tag" --depth 1 "https://github.com/microsoft/$repo.git" && \ cd "$repo" && \ - # Modify package.json to remove the "Run Python File" button from the editor title bar + # Modify package.json to remove the editor/title/run contributions if it exists jq 'del(.contributes.menus."editor/title/run")' package.json > package.tmp.json && \ mv package.tmp.json package.json && \ npm install && \ From 7e968529ccca61049931fc590d1c42fbf9703903 Mon Sep 17 00:00:00 2001 From: Rongxin Liu Date: Sat, 27 Sep 2025 12:30:55 -0400 Subject: [PATCH 8/9] use cut --- Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b9cffc6d..bde46380 100644 --- a/Dockerfile +++ b/Dockerfile @@ -101,7 +101,7 @@ RUN npm install --global @vscode/vsce yarn && \ npm uninstall --global vsce yarn -# This builds custom versions of Microsoft's Python extensions without the "Run Python File" button +# Build custom versions of Microsoft's Python extensions to remove the "Run Button" RUN cd /tmp && \ # Process each extension: format is "repo-name|build-command|output-filename" for ext in \ @@ -109,7 +109,10 @@ RUN cd /tmp && \ "vscode-python-debugger|vsce-package|python-debugger.vsix" \ "vscode-python-environments|vsce-package|ms-python-envs-insiders.vsix"; \ do \ - IFS='|' read -r repo build_cmd output_file <<< "$ext" && \ + # Parse the pipe-delimited string + repo=$(echo "$ext" | cut -d'|' -f1) && \ + build_cmd=$(echo "$ext" | cut -d'|' -f2) && \ + output_file=$(echo "$ext" | cut -d'|' -f3) && \ # Fetch the latest release tag from GitHub API echo "Fetching latest release for $repo..." && \ latest_tag=$(curl -s "https://api.github.com/repos/microsoft/$repo/releases/latest" | jq -r .tag_name) && \ From 97794278dc2fcd4c49c3cd646b5bba9ef23e3b47 Mon Sep 17 00:00:00 2001 From: Rongxin Liu Date: Sat, 27 Sep 2025 13:26:15 -0400 Subject: [PATCH 9/9] update Dockerfile to clone the latest commit from the main branch instead of fetching the latest release tag --- Dockerfile | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index bde46380..0636454e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -113,12 +113,8 @@ RUN cd /tmp && \ repo=$(echo "$ext" | cut -d'|' -f1) && \ build_cmd=$(echo "$ext" | cut -d'|' -f2) && \ output_file=$(echo "$ext" | cut -d'|' -f3) && \ - # Fetch the latest release tag from GitHub API - echo "Fetching latest release for $repo..." && \ - latest_tag=$(curl -s "https://api.github.com/repos/microsoft/$repo/releases/latest" | jq -r .tag_name) && \ - echo "Using version: $latest_tag" && \ - # Clone the repository at the latest release tag - git clone --branch "$latest_tag" --depth 1 "https://github.com/microsoft/$repo.git" && \ + # Clone the latest commit from the main branch + git clone --depth 1 "https://github.com/microsoft/$repo.git" && \ cd "$repo" && \ # Modify package.json to remove the editor/title/run contributions if it exists jq 'del(.contributes.menus."editor/title/run")' package.json > package.tmp.json && \