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

GH-43519: [Python] Set up wheel building for Python 3.13 #43539

Merged
merged 35 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ed4e9d1
Set up CI for Python 3.13
lysnikolaou Aug 2, 2024
58617a6
Address feedback
lysnikolaou Aug 5, 2024
cca8c65
Update env
lysnikolaou Aug 6, 2024
b6cabf0
Handle two cp313-cp313* directories in /opt/python in manylinux
lysnikolaou Aug 6, 2024
b5d172b
Fix build issues
lysnikolaou Aug 7, 2024
7040788
Update dev/tasks/python-wheels/github.linux.yml
lysnikolaou Aug 7, 2024
1d03354
Address feedback; remove 3.6-7 checks and wrap long bash line
lysnikolaou Aug 7, 2024
511f31d
Remove wrong semicolon
lysnikolaou Aug 7, 2024
f33cf7d
Merge branch 'main' into setup-ci-313
lysnikolaou Aug 7, 2024
7685c96
Address feedback; use python_image_tag and install numpy nightly
lysnikolaou Aug 8, 2024
6b36d3f
Fix CI; Add python_image_tag arg & install numpy>2 in 3.13
lysnikolaou Aug 8, 2024
14185ab
Add pre and extra index url in requirements files; pin to pandas>=3 o…
lysnikolaou Aug 9, 2024
3ed915c
Update python/requirements-wheel-test.txt
jorisvandenbossche Aug 9, 2024
13c28c3
Merge branch 'main' into setup-ci-313
lysnikolaou Aug 9, 2024
975d5ec
Only use testbench when not in 3.13
lysnikolaou Aug 9, 2024
b662379
Update ci/scripts/python_wheel_macos_build.sh
lysnikolaou Aug 9, 2024
1b836c7
Fix link in install_python.sh
lysnikolaou Aug 9, 2024
4f5c3f6
Set env correctly in macOS
lysnikolaou Aug 12, 2024
93b06a3
Remove --platform when running pip intall
lysnikolaou Aug 12, 2024
89965c1
Fix pip install setuptools in install_gcs_testbench
lysnikolaou Aug 12, 2024
eab3cfd
Use PYTHON_VERSION environment variable in install_gcs_testbench
lysnikolaou Aug 12, 2024
489bae6
Update ci/docker/python-wheel-manylinux-test.dockerfile
jorisvandenbossche Aug 13, 2024
00efbd9
Debug python version
lysnikolaou Aug 13, 2024
62d27d3
more debugging
jorisvandenbossche Aug 13, 2024
4332b6e
fix and undo debugging
jorisvandenbossche Aug 13, 2024
0b5b2aa
Fix manylinux installing testbench
lysnikolaou Aug 13, 2024
825bb98
Fix typo
lysnikolaou Aug 13, 2024
d2e4347
Correctly set python build arg and PYTHON_VERSION env var
lysnikolaou Aug 13, 2024
7ddac07
Update python/requirements-wheel-test.txt
jorisvandenbossche Aug 13, 2024
09fd530
Merge branch 'main' into setup-ci-313
lysnikolaou Aug 15, 2024
e12e2f5
Update ci/docker/python-wheel-manylinux-test.dockerfile
lysnikolaou Aug 15, 2024
3e3e5cc
Merge remote-tracking branch 'upstream/main' into setup-ci-313
jorisvandenbossche Aug 20, 2024
1e9e387
pin to numpy 2.1.0 now it is released
jorisvandenbossche Aug 20, 2024
ef520ba
Merge remote-tracking branch 'upstream/main' into setup-ci-313
jorisvandenbossche Aug 22, 2024
747a630
Merge remote-tracking branch 'upstream/main' into setup-ci-313
jorisvandenbossche Aug 22, 2024
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
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ VCPKG="943c5ef1c8f6b5e6ced092b242c8299caae2ff01" # 2024.04.26 Release
# ci/docker/python-wheel-windows-vs2019.dockerfile.
# This is a workaround for our CI problem that "archery docker build" doesn't
# use pulled built images in dev/tasks/python-wheels/github.windows.yml.
PYTHON_WHEEL_WINDOWS_IMAGE_REVISION=2024-06-18
PYTHON_WHEEL_WINDOWS_IMAGE_REVISION=2024-08-06

# Use conanio/${CONAN_BASE}:{CONAN_VERSION} for "docker-compose run --rm conan".
# See https://github.com/conan-io/conan-docker-tools#readme and
Expand Down
7 changes: 4 additions & 3 deletions ci/docker/python-wheel-manylinux-test.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
# under the License.

ARG arch
ARG python
FROM ${arch}/python:${python}
ARG python_image_tag
FROM ${arch}/python:${python_image_tag}

# RUN pip install --upgrade pip

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

COPY ci/scripts/install_gcs_testbench.sh /arrow/ci/scripts/
RUN PYTHON=python /arrow/ci/scripts/install_gcs_testbench.sh default
ARG python
RUN PYTHON_VERSION=${python} /arrow/ci/scripts/install_gcs_testbench.sh default
jorisvandenbossche marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion ci/docker/python-wheel-manylinux.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ RUN vcpkg install \
# Configure Python for applications running in the bash shell of this Dockerfile
ARG python=3.8
ENV PYTHON_VERSION=${python}
RUN PYTHON_ROOT=$(find /opt/python -name cp${PYTHON_VERSION/./}-*) && \
RUN PYTHON_ROOT=$(find /opt/python -name cp${PYTHON_VERSION/./}-cp${PYTHON_VERSION/./}) && \
echo "export PATH=$PYTHON_ROOT/bin:\$PATH" >> /etc/profile.d/python.sh

SHELL ["/bin/bash", "-i", "-c"]
Expand Down
7 changes: 4 additions & 3 deletions ci/docker/python-wheel-windows-test-vs2019.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ ARG python=3.8
RUN (if "%python%"=="3.8" setx PYTHON_VERSION "3.8.10" && setx PATH "%PATH%;C:\Python38;C:\Python38\Scripts") & \
(if "%python%"=="3.9" setx PYTHON_VERSION "3.9.13" && setx PATH "%PATH%;C:\Python39;C:\Python39\Scripts") & \
(if "%python%"=="3.10" setx PYTHON_VERSION "3.10.11" && setx PATH "%PATH%;C:\Python310;C:\Python310\Scripts") & \
(if "%python%"=="3.11" setx PYTHON_VERSION "3.11.5" && setx PATH "%PATH%;C:\Python311;C:\Python311\Scripts") & \
(if "%python%"=="3.12" setx PYTHON_VERSION "3.12.0" && setx PATH "%PATH%;C:\Python312;C:\Python312\Scripts")
(if "%python%"=="3.11" setx PYTHON_VERSION "3.11.9" && setx PATH "%PATH%;C:\Python311;C:\Python311\Scripts") & \
(if "%python%"=="3.12" setx PYTHON_VERSION "3.12.4" && setx PATH "%PATH%;C:\Python312;C:\Python312\Scripts") & \
(if "%python%"=="3.13" setx PYTHON_VERSION "3.13.0-rc1" && setx PATH "%PATH%;C:\Python313;C:\Python313\Scripts")

# Install archiver to extract xz archives
RUN choco install -r -y --no-progress python --version=%PYTHON_VERSION% & \
RUN choco install -r -y --pre --no-progress python --version=%PYTHON_VERSION% & \
python -m pip install --no-cache-dir -U pip setuptools & \
choco install --no-progress -r -y archiver
7 changes: 4 additions & 3 deletions ci/docker/python-wheel-windows-vs2019.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ ARG python=3.8
RUN (if "%python%"=="3.8" setx PYTHON_VERSION "3.8.10" && setx PATH "%PATH%;C:\Python38;C:\Python38\Scripts") & \
(if "%python%"=="3.9" setx PYTHON_VERSION "3.9.13" && setx PATH "%PATH%;C:\Python39;C:\Python39\Scripts") & \
(if "%python%"=="3.10" setx PYTHON_VERSION "3.10.11" && setx PATH "%PATH%;C:\Python310;C:\Python310\Scripts") & \
(if "%python%"=="3.11" setx PYTHON_VERSION "3.11.5" && setx PATH "%PATH%;C:\Python311;C:\Python311\Scripts") & \
(if "%python%"=="3.12" setx PYTHON_VERSION "3.12.0" && setx PATH "%PATH%;C:\Python312;C:\Python312\Scripts")
RUN choco install -r -y --no-progress python --version=%PYTHON_VERSION%
(if "%python%"=="3.11" setx PYTHON_VERSION "3.11.9" && setx PATH "%PATH%;C:\Python311;C:\Python311\Scripts") & \
(if "%python%"=="3.12" setx PYTHON_VERSION "3.12.4" && setx PATH "%PATH%;C:\Python312;C:\Python312\Scripts") & \
(if "%python%"=="3.13" setx PYTHON_VERSION "3.13.0-rc1" && setx PATH "%PATH%;C:\Python313;C:\Python313\Scripts")
RUN choco install -r -y --pre --no-progress python --version=%PYTHON_VERSION%
RUN python -m pip install -U pip setuptools

COPY python/requirements-wheel-build.txt arrow/python/
Expand Down
10 changes: 7 additions & 3 deletions ci/scripts/install_gcs_testbench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@ version=$1
if [[ "${version}" -eq "default" ]]; then
version="v0.39.0"
# Latests versions of Testbench require newer setuptools
${PYTHON:-python3} -m pip install --upgrade setuptools
python3 -m pip install --upgrade setuptools
fi

${PYTHON:-python3} -m pip install \
"https://github.com/googleapis/storage-testbench/archive/${version}.tar.gz"
# This script is run with PYTHON undefined in some places,
# but those only use older pythons.
if [[ -z "${PYTHON_VERSION}" ]] || [[ "${PYTHON_VERSION}" != "3.13" ]]; then
python3 -m pip install \
"https://github.com/googleapis/storage-testbench/archive/${version}.tar.gz"
fi
14 changes: 11 additions & 3 deletions ci/scripts/install_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ declare -A versions
versions=([3.8]=3.8.10
[3.9]=3.9.13
[3.10]=3.10.11
[3.11]=3.11.5
[3.12]=3.12.0)
[3.11]=3.11.9
[3.12]=3.12.4
[3.13]=3.13.0)

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

if [ "$(uname -m)" = "arm64" ] || [ "$version" = "3.10" ] || [ "$version" = "3.11" ] || [ "$version" = "3.12" ]; then
if [ "$version" = "3.13" ];
then
fname="python-${full_version}rc1-macos11.pkg"
elif [ "$(uname -m)" = "arm64" ] || \
[ "$version" = "3.10" ] || \
[ "$version" = "3.11" ] || \
[ "$version" = "3.12" ];
then
fname="python-${full_version}-macos11.pkg"
else
fname="python-${full_version}-macosx10.9.pkg"
lysnikolaou marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
2 changes: 0 additions & 2 deletions ci/scripts/python_wheel_macos_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,11 @@ fi

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

pip install \
--upgrade \
--only-binary=:all: \
--target $PIP_SITE_PACKAGES \
--platform $PIP_TARGET_PLATFORM \
-r ${source_dir}/python/requirements-wheel-build.txt
pip install "delocate>=0.10.3"

Expand Down
6 changes: 3 additions & 3 deletions dev/release/verify-release-candidate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ test_linux_wheels() {
local arch="x86_64"
fi

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

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

# apple silicon processor
if [ "$(uname -m)" = "arm64" ]; then
local python_versions="3.8 3.9 3.10 3.11 3.12"
local python_versions="3.8 3.9 3.10 3.11 3.12 3.13"
local platform_tags="macosx_11_0_arm64"
local check_flight=OFF
else
local python_versions="3.8 3.9 3.10 3.11 3.12"
local python_versions="3.8 3.9 3.10 3.11 3.12 3.13"
local platform_tags="macosx_10_15_x86_64"
fi

Expand Down
5 changes: 5 additions & 0 deletions dev/tasks/python-wheels/github.linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ jobs:
ARCHERY_USE_LEGACY_DOCKER_COMPOSE: 1
{% endif %}
PYTHON: "{{ python_version }}"
{% if python_version == "3.13" %}
PYTHON_IMAGE_TAG: "3.13-rc"
{% else %}
PYTHON_IMAGE_TAG: "{{ python_version }}"
{% endif %}

steps:
{{ macros.github_checkout_arrow()|indent }}
Expand Down
2 changes: 1 addition & 1 deletion dev/tasks/python-wheels/github.osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
source test-env/bin/activate
pip install --upgrade pip wheel
arch -{{ arch }} pip install -r arrow/python/requirements-wheel-test.txt
PYTHON=python arch -{{ arch }} arrow/ci/scripts/install_gcs_testbench.sh default
PYTHON_VERSION={{ python_version }} arch -{{ arch }} arrow/ci/scripts/install_gcs_testbench.sh default
arch -{{ arch }} arrow/ci/scripts/python_wheel_unix_test.sh $(pwd)/arrow

{{ macros.github_upload_releases("arrow/python/repaired_wheels/*.whl")|indent }}
Expand Down
3 changes: 2 additions & 1 deletion dev/tasks/tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@ tasks:
("3.9", "cp39", "cp39"),
("3.10", "cp310", "cp310"),
("3.11", "cp311", "cp311"),
("3.12", "cp312", "cp312")] %}
("3.12", "cp312", "cp312"),
("3.13", "cp313", "cp313")] %}

{############################## Wheel Linux ##################################}

Expand Down
9 changes: 6 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1096,9 +1096,10 @@ services:
args:
arch: ${ARCH}
arch_short: ${ARCH_SHORT}
base: quay.io/pypa/manylinux2014_${ARCH_ALIAS}:2024-02-04-ea37246
base: quay.io/pypa/manylinux2014_${ARCH_ALIAS}:2024-08-03-32dfa47
vcpkg: ${VCPKG}
python: ${PYTHON}
python_image_tag: ${PYTHON_IMAGE_TAG}
manylinux: 2014
context: .
dockerfile: ci/docker/python-wheel-manylinux.dockerfile
Expand All @@ -1119,9 +1120,10 @@ services:
args:
arch: ${ARCH}
arch_short: ${ARCH_SHORT}
base: quay.io/pypa/manylinux_2_28_${ARCH_ALIAS}:2024-02-04-ea37246
base: quay.io/pypa/manylinux_2_28_${ARCH_ALIAS}:2024-08-03-32dfa47
vcpkg: ${VCPKG}
python: ${PYTHON}
python_image_tag: ${PYTHON_IMAGE_TAG}
manylinux: 2_28
context: .
dockerfile: ci/docker/python-wheel-manylinux.dockerfile
Expand All @@ -1135,7 +1137,7 @@ services:
command: /arrow/ci/scripts/python_wheel_manylinux_build.sh

python-wheel-manylinux-test-imports:
image: ${ARCH}/python:${PYTHON}
image: ${ARCH}/python:${PYTHON_IMAGE_TAG}
shm_size: 2G
volumes:
- .:/arrow:delegated
Expand All @@ -1151,6 +1153,7 @@ services:
args:
arch: ${ARCH}
python: ${PYTHON}
python_image_tag: ${PYTHON_IMAGE_TAG}
context: .
dockerfile: ci/docker/python-wheel-manylinux-test.dockerfile
cache_from:
Expand Down
1 change: 1 addition & 0 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ classifiers = [
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
]
maintainers = [
{name = "Apache Arrow Developers", email = "dev@arrow.apache.org"}
Expand Down
5 changes: 5 additions & 0 deletions python/requirements-wheel-build.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Remove pre and extra index url once there's NumPy and Cython wheels for 3.13
# on PyPI
pitrou marked this conversation as resolved.
Show resolved Hide resolved
--pre
--extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple"

cython>=0.29.31
oldest-supported-numpy>=0.14; python_version<'3.9'
numpy>=2.0.0; python_version>='3.9'
Expand Down
7 changes: 7 additions & 0 deletions python/requirements-wheel-test.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Remove pre and extra index url once there's NumPy and Cython wheels for 3.13
# on PyPI
--pre
jorisvandenbossche marked this conversation as resolved.
Show resolved Hide resolved
--prefer-binary
--extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple"

cffi
cython
hypothesis
Expand All @@ -12,5 +18,6 @@ tzdata; sys_platform == 'win32'
numpy~=1.21.3; python_version < "3.11"
numpy~=1.23.2; python_version == "3.11"
numpy~=1.26.0; python_version == "3.12"
numpy~=2.1.0; python_version >= "3.13"

pandas
Loading