Skip to content

Commit

Permalink
Install prebuilt Python binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
kenmuse committed Oct 20, 2024
1 parent 5adf953 commit 4e7698c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
17 changes: 17 additions & 0 deletions .devcontainer/features/python-deadsnakes/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -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": {}
}
}
16 changes: 16 additions & 0 deletions .devcontainer/features/python-deadsnakes/install.sh
Original file line number Diff line number Diff line change
@@ -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/*

0 comments on commit 4e7698c

Please sign in to comment.