Skip to content

Commit 3e9384b

Browse files
GH-43519: [Python] Set up wheel building for Python 3.13 (#43539)
### Rationale for this change Like #43519 mentionies, now that the first `rc` is out, it's probably time to add CI coverage for Python 3.13 (and also start building wheels). ### What changes are included in this PR? I'm fairly new to the build/CI processes of the project, but I tried to follow the same template as #37901. I'll follow up afterwards with adding CI coverage for the free-threaded build as well. * GitHub Issue: #43519 Lead-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com> Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
1 parent b4f7efe commit 3e9384b

16 files changed

+62
-27
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ VCPKG="943c5ef1c8f6b5e6ced092b242c8299caae2ff01" # 2024.04.26 Release
9595
# ci/docker/python-wheel-windows-vs2019.dockerfile.
9696
# This is a workaround for our CI problem that "archery docker build" doesn't
9797
# use pulled built images in dev/tasks/python-wheels/github.windows.yml.
98-
PYTHON_WHEEL_WINDOWS_IMAGE_REVISION=2024-06-18
98+
PYTHON_WHEEL_WINDOWS_IMAGE_REVISION=2024-08-06
9999

100100
# Use conanio/${CONAN_BASE}:{CONAN_VERSION} for "docker-compose run --rm conan".
101101
# See https://github.com/conan-io/conan-docker-tools#readme and

ci/docker/python-wheel-manylinux-test.dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
# under the License.
1717

1818
ARG arch
19-
ARG python
20-
FROM ${arch}/python:${python}
19+
ARG python_image_tag
20+
FROM ${arch}/python:${python_image_tag}
2121

2222
# RUN pip install --upgrade pip
2323

@@ -27,4 +27,5 @@ COPY python/requirements-wheel-test.txt /arrow/python/
2727
RUN pip install -r /arrow/python/requirements-wheel-test.txt
2828

2929
COPY ci/scripts/install_gcs_testbench.sh /arrow/ci/scripts/
30-
RUN PYTHON=python /arrow/ci/scripts/install_gcs_testbench.sh default
30+
ARG python
31+
RUN PYTHON_VERSION=${python} /arrow/ci/scripts/install_gcs_testbench.sh default

ci/docker/python-wheel-manylinux.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ RUN vcpkg install \
103103
# Configure Python for applications running in the bash shell of this Dockerfile
104104
ARG python=3.8
105105
ENV PYTHON_VERSION=${python}
106-
RUN PYTHON_ROOT=$(find /opt/python -name cp${PYTHON_VERSION/./}-*) && \
106+
RUN PYTHON_ROOT=$(find /opt/python -name cp${PYTHON_VERSION/./}-cp${PYTHON_VERSION/./}) && \
107107
echo "export PATH=$PYTHON_ROOT/bin:\$PATH" >> /etc/profile.d/python.sh
108108

109109
SHELL ["/bin/bash", "-i", "-c"]

ci/docker/python-wheel-windows-test-vs2019.dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ ARG python=3.8
4040
RUN (if "%python%"=="3.8" setx PYTHON_VERSION "3.8.10" && setx PATH "%PATH%;C:\Python38;C:\Python38\Scripts") & \
4141
(if "%python%"=="3.9" setx PYTHON_VERSION "3.9.13" && setx PATH "%PATH%;C:\Python39;C:\Python39\Scripts") & \
4242
(if "%python%"=="3.10" setx PYTHON_VERSION "3.10.11" && setx PATH "%PATH%;C:\Python310;C:\Python310\Scripts") & \
43-
(if "%python%"=="3.11" setx PYTHON_VERSION "3.11.5" && setx PATH "%PATH%;C:\Python311;C:\Python311\Scripts") & \
44-
(if "%python%"=="3.12" setx PYTHON_VERSION "3.12.0" && setx PATH "%PATH%;C:\Python312;C:\Python312\Scripts")
43+
(if "%python%"=="3.11" setx PYTHON_VERSION "3.11.9" && setx PATH "%PATH%;C:\Python311;C:\Python311\Scripts") & \
44+
(if "%python%"=="3.12" setx PYTHON_VERSION "3.12.4" && setx PATH "%PATH%;C:\Python312;C:\Python312\Scripts") & \
45+
(if "%python%"=="3.13" setx PYTHON_VERSION "3.13.0-rc1" && setx PATH "%PATH%;C:\Python313;C:\Python313\Scripts")
4546

4647
# Install archiver to extract xz archives
47-
RUN choco install -r -y --no-progress python --version=%PYTHON_VERSION% & \
48+
RUN choco install -r -y --pre --no-progress python --version=%PYTHON_VERSION% & \
4849
python -m pip install --no-cache-dir -U pip setuptools & \
4950
choco install --no-progress -r -y archiver

ci/docker/python-wheel-windows-vs2019.dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ ARG python=3.8
8383
RUN (if "%python%"=="3.8" setx PYTHON_VERSION "3.8.10" && setx PATH "%PATH%;C:\Python38;C:\Python38\Scripts") & \
8484
(if "%python%"=="3.9" setx PYTHON_VERSION "3.9.13" && setx PATH "%PATH%;C:\Python39;C:\Python39\Scripts") & \
8585
(if "%python%"=="3.10" setx PYTHON_VERSION "3.10.11" && setx PATH "%PATH%;C:\Python310;C:\Python310\Scripts") & \
86-
(if "%python%"=="3.11" setx PYTHON_VERSION "3.11.5" && setx PATH "%PATH%;C:\Python311;C:\Python311\Scripts") & \
87-
(if "%python%"=="3.12" setx PYTHON_VERSION "3.12.0" && setx PATH "%PATH%;C:\Python312;C:\Python312\Scripts")
88-
RUN choco install -r -y --no-progress python --version=%PYTHON_VERSION%
86+
(if "%python%"=="3.11" setx PYTHON_VERSION "3.11.9" && setx PATH "%PATH%;C:\Python311;C:\Python311\Scripts") & \
87+
(if "%python%"=="3.12" setx PYTHON_VERSION "3.12.4" && setx PATH "%PATH%;C:\Python312;C:\Python312\Scripts") & \
88+
(if "%python%"=="3.13" setx PYTHON_VERSION "3.13.0-rc1" && setx PATH "%PATH%;C:\Python313;C:\Python313\Scripts")
89+
RUN choco install -r -y --pre --no-progress python --version=%PYTHON_VERSION%
8990
RUN python -m pip install -U pip setuptools
9091

9192
COPY python/requirements-wheel-build.txt arrow/python/

ci/scripts/install_gcs_testbench.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ version=$1
4141
if [[ "${version}" -eq "default" ]]; then
4242
version="v0.39.0"
4343
# Latests versions of Testbench require newer setuptools
44-
${PYTHON:-python3} -m pip install --upgrade setuptools
44+
python3 -m pip install --upgrade setuptools
4545
fi
4646

47-
${PYTHON:-python3} -m pip install \
48-
"https://github.com/googleapis/storage-testbench/archive/${version}.tar.gz"
47+
# This script is run with PYTHON undefined in some places,
48+
# but those only use older pythons.
49+
if [[ -z "${PYTHON_VERSION}" ]] || [[ "${PYTHON_VERSION}" != "3.13" ]]; then
50+
python3 -m pip install \
51+
"https://github.com/googleapis/storage-testbench/archive/${version}.tar.gz"
52+
fi

ci/scripts/install_python.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ declare -A versions
2828
versions=([3.8]=3.8.10
2929
[3.9]=3.9.13
3030
[3.10]=3.10.11
31-
[3.11]=3.11.5
32-
[3.12]=3.12.0)
31+
[3.11]=3.11.9
32+
[3.12]=3.12.4
33+
[3.13]=3.13.0)
3334

3435
if [ "$#" -ne 2 ]; then
3536
echo "Usage: $0 <platform> <version>"
@@ -46,7 +47,14 @@ full_version=${versions[$2]}
4647
if [ $platform = "macOS" ]; then
4748
echo "Downloading Python installer..."
4849

49-
if [ "$(uname -m)" = "arm64" ] || [ "$version" = "3.10" ] || [ "$version" = "3.11" ] || [ "$version" = "3.12" ]; then
50+
if [ "$version" = "3.13" ];
51+
then
52+
fname="python-${full_version}rc1-macos11.pkg"
53+
elif [ "$(uname -m)" = "arm64" ] || \
54+
[ "$version" = "3.10" ] || \
55+
[ "$version" = "3.11" ] || \
56+
[ "$version" = "3.12" ];
57+
then
5058
fname="python-${full_version}-macos11.pkg"
5159
else
5260
fname="python-${full_version}-macosx10.9.pkg"

ci/scripts/python_wheel_macos_build.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,11 @@ fi
4848

4949
echo "=== (${PYTHON_VERSION}) Install Python build dependencies ==="
5050
export PIP_SITE_PACKAGES=$(python -c 'import site; print(site.getsitepackages()[0])')
51-
export PIP_TARGET_PLATFORM="macosx_${MACOSX_DEPLOYMENT_TARGET//./_}_${arch}"
5251

5352
pip install \
5453
--upgrade \
5554
--only-binary=:all: \
5655
--target $PIP_SITE_PACKAGES \
57-
--platform $PIP_TARGET_PLATFORM \
5856
-r ${source_dir}/python/requirements-wheel-build.txt
5957
pip install "delocate>=0.10.3"
6058

dev/release/verify-release-candidate.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,7 +1146,7 @@ test_linux_wheels() {
11461146
local arch="x86_64"
11471147
fi
11481148

1149-
local python_versions="${TEST_PYTHON_VERSIONS:-3.8 3.9 3.10 3.11 3.12}"
1149+
local python_versions="${TEST_PYTHON_VERSIONS:-3.8 3.9 3.10 3.11 3.12 3.13}"
11501150
local platform_tags="${TEST_WHEEL_PLATFORM_TAGS:-manylinux_2_17_${arch}.manylinux2014_${arch} manylinux_2_28_${arch}}"
11511151

11521152
for python in ${python_versions}; do
@@ -1170,11 +1170,11 @@ test_macos_wheels() {
11701170

11711171
# apple silicon processor
11721172
if [ "$(uname -m)" = "arm64" ]; then
1173-
local python_versions="3.8 3.9 3.10 3.11 3.12"
1173+
local python_versions="3.8 3.9 3.10 3.11 3.12 3.13"
11741174
local platform_tags="macosx_11_0_arm64"
11751175
local check_flight=OFF
11761176
else
1177-
local python_versions="3.8 3.9 3.10 3.11 3.12"
1177+
local python_versions="3.8 3.9 3.10 3.11 3.12 3.13"
11781178
local platform_tags="macosx_10_15_x86_64"
11791179
fi
11801180

dev/tasks/python-wheels/github.linux.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ jobs:
3636
ARCHERY_USE_LEGACY_DOCKER_COMPOSE: 1
3737
{% endif %}
3838
PYTHON: "{{ python_version }}"
39+
{% if python_version == "3.13" %}
40+
PYTHON_IMAGE_TAG: "3.13-rc"
41+
{% else %}
42+
PYTHON_IMAGE_TAG: "{{ python_version }}"
43+
{% endif %}
3944

4045
steps:
4146
{{ macros.github_checkout_arrow()|indent }}

0 commit comments

Comments
 (0)