diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 4f0f845..599aa8f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -127,8 +127,8 @@ "version": "22.10.0", "nvmVersion": "latest" }, - "ghcr.io/devcontainers/features/python:1": { - "version": "3.13.0" + "./features/python-deadsnakes": { + "pythonVersion": "3.13" } }, "otherPortsAttributes": { diff --git a/.devcontainer/features/python-deadsnakes/devcontainer-feature.json b/.devcontainer/features/python-deadsnakes/devcontainer-feature.json new file mode 100644 index 0000000..f7dea2c --- /dev/null +++ b/.devcontainer/features/python-deadsnakes/devcontainer-feature.json @@ -0,0 +1,17 @@ +{ + "id": "local.python-deadsnakes", + "version": "1.0.0", + "name": "Python (Deadsnakes PPA)", + "description": "Installs prebuilt Python version from the deadsnakes PPA", + "options": { + "pythonVersion": { + "type": "string", + "proposals": ["3.12", "3.13", "3.14"], + "default": "3.13", + "description": "Select or enter the Python version (deadsnakes)." + } + }, + "dependsOn": { + "./features/common-deps": {} + } +} diff --git a/.devcontainer/features/python-deadsnakes/install.sh b/.devcontainer/features/python-deadsnakes/install.sh new file mode 100755 index 0000000..26ce706 --- /dev/null +++ b/.devcontainer/features/python-deadsnakes/install.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -euo pipefail + +PYTHONVERSION=${PYTHONVERSION:-"3.13"} + +if [ "$(id -u)" -ne "0" ]; then echo "Must be run as root or with sudo"; exit 1; fi +export DEBIAN_FRONTEND=noninteractive + +add-apt-repository ppa:deadsnakes/ppa +apt-get update -qq +apt-get install -y -qq python${PYTHONVERSION} > /dev/null + +# Clean up +apt clean +rm -rf /var/lib/apt/lists/*