Skip to content

Commit 68bf245

Browse files
authored
Switch from Python DevContainer feature to OS-provided (#41)
* Switch from Python DevContainer feature to OS-provided The DevContainer feature "python" always re-builds Python from source. This is a big issue for the build performance of the container, especially for cross-builds for arm64. Hence, we switch to use the OS-provided Python. Note that this implies a change in patch version (from "3.12.11" to "3.12.3"), which should not be an issue. * fix: install fixed git-lfs version * minor cleanup * fix: check if builder already exists
1 parent 700e882 commit 68bf245

7 files changed

Lines changed: 26 additions & 13 deletions

File tree

scripts/create_builder.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
#!/usr/bin/env bash
22
set -euxo pipefail
33

4-
docker buildx create --name multiarch --driver docker-container --use
4+
if ! docker buildx inspect multiarch &>/dev/null; then
5+
docker buildx create --name multiarch --driver docker-container --use
6+
else
7+
docker buildx use multiarch
8+
fi

src/s-core-devcontainer/.devcontainer/devcontainer-lock.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@
2020
"resolved": "ghcr.io/devcontainers/features/git-lfs@sha256:71c2b371cf12ab7fcec47cf17369c6f59156100dad9abf9e4c593049d789de72",
2121
"integrity": "sha256:71c2b371cf12ab7fcec47cf17369c6f59156100dad9abf9e4c593049d789de72"
2222
},
23-
"ghcr.io/devcontainers/features/python": {
24-
"version": "1.7.1",
25-
"resolved": "ghcr.io/devcontainers/features/python@sha256:cf9b6d879790a594b459845b207c5e1762a0c8f954bb8033ff396e497f9c301b",
26-
"integrity": "sha256:cf9b6d879790a594b459845b207c5e1762a0c8f954bb8033ff396e497f9c301b"
27-
},
2823
"ghcr.io/devcontainers/features/rust": {
2924
"version": "1.5.0",
3025
"resolved": "ghcr.io/devcontainers/features/rust@sha256:0c55e65f2e3df736e478f26ee4d5ed41bae6b54dac1318c443e31444c8ed283c",

src/s-core-devcontainer/.devcontainer/devcontainer.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"ppa": "true"
1111
},
1212
"ghcr.io/devcontainers/features/git-lfs": {
13-
// Installs the latest version from the Distribution
13+
"version": "3.7.0",
1414
"autoPull": "false" // do not automatically pull LFS files when creating the container
1515
},
1616
"ghcr.io/devcontainers/features/common-utils": {
@@ -26,9 +26,6 @@
2626
// In case we want this, the feature needs to be replaced with a custom installation script.
2727
"version": "20"
2828
},
29-
"ghcr.io/devcontainers/features/python": {
30-
"version": "3.12.11"
31-
},
3229
"ghcr.io/devcontainers/features/rust": {
3330
"version": "1.83.0",
3431
"components": [
@@ -50,7 +47,6 @@
5047
"ghcr.io/devcontainers/features/common-utils",
5148
"ghcr.io/devcontainers-community/features/llvm",
5249
"ghcr.io/devcontainers/features/rust",
53-
"ghcr.io/devcontainers/features/python",
5450
"./s-core-local"
5551
],
5652
"remoteUser": "vscode",

src/s-core-devcontainer/.devcontainer/s-core-local/install.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ apt-get install -y graphviz="${graphviz_version}*"
3030
# Protobuf compiler, via APT (needed by FEO)
3131
apt-get install -y protobuf-compiler="${protobuf_compiler_version}*"
3232

33+
# Python, via APT
34+
apt-get install -y python${python_version} python3-pip python3-venv
35+
# The following packages correspond to the list of packages installed by the
36+
# devcontainer feature "python" (cf. https://github.com/devcontainers/features/tree/main/src/python )
37+
apt-get install -y flake8 python3-autopep8 black python3-yapf mypy pydocstyle pycodestyle bandit pipenv virtualenv python3-pytest pylint
38+
3339
# Bazelisk, directly from GitHub
3440
# Using the existing devcontainer feature is not optimal:
3541
# - it does not check the SHA256 checksum of the downloaded file

src/s-core-devcontainer/.devcontainer/s-core-local/tests/test_default.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ check "validate graphviz has the correct version" bash -c "dpkg -s graphviz | gr
1313
# Other build-related tools
1414
check "validate protoc is working and has the correct version" bash -c "protoc --version | grep 'libprotoc ${protobuf_compiler_version}'"
1515

16+
# Python-related tools (a selected sub-set; others may be added later)
17+
check "validate python3 is working and has the correct version" bash -c "python3 --version | grep '${python_version}'"
18+
check "validate pip3 is working and has the correct version" bash -c "pip3 --version | grep '${python_version}'"
19+
check "validate black is working and has the correct version" bash -c "black --version | grep '${python_version}'"
20+
# cannot grep versions as they do not match the Python version
21+
check "validate virtualenv is working" bash -c "virtualenv --version"
22+
check "validate flake8 is working" bash -c "flake8 --version"
23+
check "validate pytest is working" bash -c "pytest --version"
24+
check "validate pylint is working" bash -c "pylint --version"
25+
1626
# Bazel-related tools
1727
check "validate bazelisk is working and has the correct version" bash -c "bazelisk version | grep '${bazelisk_version}'"
1828
check "validate bazel is working and has the correct version" bash -c "bazel version | grep '${bazel_version}'"

src/s-core-devcontainer/.devcontainer/s-core-local/versions.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ qemu_system_arm:
1010
sshpass:
1111
version: 1.09
1212

13+
python:
14+
version: "3.12"
15+
1316
bazel:
1417
# https://github.com/bazelbuild/bazel/releases -- latest version as of 2025-09-24
1518
version: 8.4.1

src/s-core-devcontainer/test-project/test.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ source "${SCRIPT_DIR}/../../../scripts/test-utils.sh" vscode
77

88
# Common tooling
99
check "validate git is working and has the correct version" bash -c "git --version | grep '2.49.0'"
10-
check "validate git-lfs is working and has the correct version" bash -c "git lfs version | grep '3.7.0' "
11-
check "validate python3 is working and has the correct version" bash -c "python3 --version | grep '3.12.11'"
10+
check "validate git-lfs is working and has the correct version" bash -c "git lfs version | grep '3.7.0'"
1211

1312
# C++ tooling
1413
check "validate clangd is working and has the correct version" bash -c "clangd --version | grep '20.1.8'"

0 commit comments

Comments
 (0)