Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add 3.13 support, properly support building pre-releases #99

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ deps:
npm install

docker-build:
@cd builder && docker-compose build --parallel
@cd builder && docker compose build --parallel

AWS_ACCOUNT_ID:=$(shell aws sts get-caller-identity --output text --query 'Account')
AWS_REGION := us-east-1
Expand All @@ -16,13 +16,13 @@ docker-push: ecr-login docker-build
done

docker-down:
@cd builder && docker-compose down
@cd builder && docker compose down

docker-build-python: docker-build
@cd builder && docker-compose up
@cd builder && docker compose up

docker-shell-python-env:
@cd builder && docker-compose run --entrypoint /bin/bash ubuntu-2004
@cd builder && docker compose run --entrypoint /bin/bash ubuntu-2004

ecr-login:
(aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com)
Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ To test the Python builds locally, you can build the images:
make docker-build

# Or build the image for a single platform
(cd builder && docker-compose build ubuntu-2004)
(cd builder && docker compose build ubuntu-2404)
```

Then run the build script:
Expand All @@ -228,16 +228,15 @@ Then run the build script:
# Build Python for all platforms
PYTHON_VERSION=3.11.9 make docker-build-python

# Build pre-release version for all platforms
PYTHON_VERSION=3.13.0rc3 make docker-build-python

# Build Python for a single platform
(cd builder && PYTHON_VERSION=3.11.9 docker-compose up ubuntu-2004)
(cd builder && PYTHON_VERSION=3.11.9 docker compose up ubuntu-2404)

# Alternatively, run the build script from within a container
docker run -it --rm --entrypoint "/bin/bash" python-builds:ubuntu-2004
docker run -it --rm --entrypoint "/bin/bash" python-builds:ubuntu-2404

# Build Python 3.11.9
PYTHON_VERSION=3.11.9 ./build.sh


# Build a prerelease version of Python (e.g., alpha or beta)
PYTHON_VERSION=rc PYTHON_TARBALL_URL=https://www.python.org/ftp/python/3.11.0/Python-3.11.0b3.tgz ./build.sh
```
23 changes: 18 additions & 5 deletions builder/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,26 @@ archive_python() {

# fetch_python_source() - $1 as python version
fetch_python_source() {
echo "Downloading python-${1}"
wget -q "https://www.python.org/ftp/python/${1}/Python-${1}.tgz" -O /tmp/python-${1}.tgz
echo "Extracting python-${1}"
tar xf /tmp/python-${1}.tgz -C /tmp
rm /tmp/python-${1}.tgz
local version="$1"

# Extract base version before the release candidate identifier (if any)
local base_version=$(echo "$version" | sed -E 's/(rc[0-9]+)//')

# Check if the version includes 'rc' to identify release candidate versions
if [[ "$version" =~ rc[0-9]+ ]]; then
echo "Downloading Python release candidate version: python-${version}"
wget -q "https://www.python.org/ftp/python/${base_version}/Python-${version}.tgz" -O /tmp/python-${version}.tgz
else
echo "Downloading stable Python version: python-${version}"
wget -q "https://www.python.org/ftp/python/${version}/Python-${version}.tgz" -O /tmp/python-${version}.tgz
fi

echo "Extracting python-${version}"
tar xf /tmp/python-${version}.tgz -C /tmp
rm /tmp/python-${version}.tgz
}


# compile_python() - $1 as python version
compile_python() {
local VERSION=${1}
Expand Down
2 changes: 1 addition & 1 deletion handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import requests

PYTHON_SRC_URL = "https://www.python.org/ftp/python/"
PYTHON_MINOR_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12"]
PYTHON_MINOR_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
batch_client = boto3.client("batch", region_name="us-east-1")
sns_client = boto3.client('sns', region_name='us-east-1')

Expand Down