-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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-44421: [Python] Add configuration for building & testing free-threaded wheels on Windows #44804
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# NOTE: You must update PYTHON_WHEEL_WINDOWS_TEST_IMAGE_REVISION in .env | ||
# when you update this file. | ||
|
||
ARG base | ||
# https://github.com/hadolint/hadolint/wiki/DL3006 | ||
# (Hadolint does not expand variables and thinks '${base}' is an untagged image) | ||
# hadolint ignore=DL3006 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a comment that explains what is DL3006? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Uh, sure. But is hadolint actually useful? It seems terribly limited. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any useful hadolint alternative? I'm OK with migrating to it from hadolint. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have no idea. I can add a comment in the meantime. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I've added comments. But this is polluting the source code with pointless comments and making it less readable. |
||
FROM ${base} | ||
|
||
ARG python=3.13 | ||
|
||
SHELL ["powershell", "-NoProfile", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] | ||
RUN $filename = 'python-3.13.1-amd64.exe'; \ | ||
$url = 'https://www.python.org/ftp/python/3.13.1/' + $filename; \ | ||
Invoke-WebRequest -Uri $url -OutFile $filename; \ | ||
Start-Process -FilePath $filename -ArgumentList '/quiet', 'Include_freethreaded=1' -Wait | ||
|
||
ENV PYTHON_CMD="py -${python}t" | ||
|
||
SHELL ["cmd", "/S", "/C"] | ||
RUN %PYTHON_CMD% -m pip install -U pip setuptools | ||
|
||
COPY python/requirements-wheel-test.txt C:/arrow/python/ | ||
# Cython and Pandas wheels for 3.13 free-threaded are not released yet | ||
RUN %PYTHON_CMD% -m pip install \ | ||
--extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \ | ||
--pre \ | ||
--prefer-binary \ | ||
-r C:/arrow/python/requirements-wheel-test.txt | ||
# cffi-based tests would crash when importing cffi. | ||
# hadolint ignore=DL3059 | ||
RUN %PYTHON_CMD% -m pip uninstall -y cffi | ||
|
||
ENV PYTHON="${python}t" | ||
ENV PYTHON_GIL=0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# NOTE: You must update PYTHON_WHEEL_WINDOWS_IMAGE_REVISION in .env | ||
# when you update this file. | ||
|
||
ARG base | ||
# https://github.com/hadolint/hadolint/wiki/DL3006 | ||
# (Hadolint does not expand variables and thinks '${base}' is an untagged image) | ||
# hadolint ignore=DL3006 | ||
FROM ${base} | ||
|
||
ARG python=3.13 | ||
|
||
SHELL ["powershell", "-NoProfile", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] | ||
RUN $filename = 'python-3.13.1-amd64.exe'; \ | ||
$url = 'https://www.python.org/ftp/python/3.13.1/' + $filename; \ | ||
Invoke-WebRequest -Uri $url -OutFile $filename; \ | ||
Start-Process -FilePath $filename -ArgumentList '/quiet', 'Include_freethreaded=1' -Wait | ||
|
||
ENV PYTHON_CMD="py -${python}t" | ||
|
||
SHELL ["cmd", "/S", "/C"] | ||
RUN %PYTHON_CMD% -m pip install -U pip setuptools | ||
|
||
COPY python/requirements-wheel-build.txt C:/arrow/python/ | ||
# Cython wheels for 3.13 free-threaded are not released yet | ||
RUN %PYTHON_CMD% -m pip install \ | ||
--extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \ | ||
--pre \ | ||
--prefer-binary \ | ||
cython | ||
RUN %PYTHON_CMD% -m pip install -r C:/arrow/python/requirements-wheel-build.txt | ||
|
||
ENV PYTHON="${python}t" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# NOTE: You must update PYTHON_WHEEL_WINDOWS_TEST_IMAGE_REVISION in .env | ||
# when you update this file. | ||
|
||
# based on mcr.microsoft.com/windows/servercore:ltsc2019 | ||
# contains choco and vs2019 preinstalled | ||
FROM abrarov/msvc-2019:2.11.0 | ||
|
||
# hadolint shell=cmd.exe | ||
|
||
# Add unix tools to path | ||
RUN setx path "%path%;C:\Program Files\Git\usr\bin" | ||
|
||
# 1. Remove previous installations of Python from the base image | ||
# NOTE: a more recent base image (tried with 2.12.1) comes with Python 3.9.7 | ||
# and the MSI installers are failing to remove pip and tcl/tk "products" making | ||
# the subsequent choco python installation step failing for installing Python | ||
# version 3.9.* due to existing python version | ||
# 2. Install Minio for S3 testing. | ||
RUN wmic product where "name like 'python%%'" call uninstall /nointeractive && \ | ||
rm -rf Python* && \ | ||
curl https://dl.min.io/server/minio/release/windows-amd64/archive/minio.RELEASE.2024-09-13T20-26-02Z \ | ||
--output "C:\Windows\Minio.exe" | ||
|
||
# Install archiver to extract xz archives (for timezone database). | ||
# Install the GCS testbench using a well-known Python version. | ||
# NOTE: cannot use pipx's `--fetch-missing-python` because of | ||
# https://github.com/pypa/pipx/issues/1521, therefore download Python ourselves. | ||
RUN choco install --no-progress -r -y archiver && \ | ||
choco install -r -y --pre --no-progress python --version=3.11.9 | ||
ENV PIPX_BIN_DIR=C:\\Windows\\ | ||
ENV PIPX_PYTHON="C:\Python311\python.exe" | ||
COPY ci/scripts/install_gcs_testbench.bat C:/arrow/ci/scripts/ | ||
RUN call "C:\arrow\ci\scripts\install_gcs_testbench.bat" && \ | ||
storage-testbench -h |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# NOTE: You must update PYTHON_WHEEL_WINDOWS_IMAGE_REVISION in .env | ||
# when you update this file. | ||
|
||
# based on mcr.microsoft.com/windows/servercore:ltsc2019 | ||
# contains choco and vs2019 preinstalled | ||
FROM abrarov/msvc-2019:2.11.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why would we? That would make things more complicated. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because I felt that |
||
|
||
# Install CMake and Ninja | ||
ARG cmake=3.31.2 | ||
RUN choco install --no-progress -r -y cmake --version=%cmake% --installargs 'ADD_CMAKE_TO_PATH=System' && \ | ||
choco install --no-progress -r -y gzip wget ninja | ||
|
||
# Add unix tools to path | ||
RUN setx path "%path%;C:\Program Files\Git\usr\bin" | ||
|
||
# Install vcpkg | ||
# | ||
# Compiling vcpkg itself from a git tag doesn't work anymore since vcpkg has | ||
# started to ship precompiled binaries for the vcpkg-tool. | ||
ARG vcpkg | ||
COPY ci/vcpkg/*.patch \ | ||
ci/vcpkg/*windows*.cmake \ | ||
arrow/ci/vcpkg/ | ||
COPY ci/scripts/install_vcpkg.sh arrow/ci/scripts/ | ||
ENV VCPKG_ROOT=C:\\vcpkg | ||
RUN bash arrow/ci/scripts/install_vcpkg.sh /c/vcpkg %vcpkg% && \ | ||
setx PATH "%PATH%;%VCPKG_ROOT%" | ||
|
||
# Configure vcpkg and install dependencies | ||
# NOTE: use windows batch environment notation for build arguments in RUN | ||
# statements but bash notation in ENV statements | ||
# VCPKG_FORCE_SYSTEM_BINARIES=1 spare around ~750MB of image size if the system | ||
# cmake's and ninja's versions are recent enough | ||
ARG build_type=release | ||
ENV CMAKE_BUILD_TYPE=${build_type} \ | ||
VCPKG_OVERLAY_TRIPLETS=C:\\arrow\\ci\\vcpkg \ | ||
VCPKG_DEFAULT_TRIPLET=amd64-windows-static-md-${build_type} \ | ||
VCPKG_FEATURE_FLAGS="manifests" | ||
COPY ci/vcpkg/vcpkg.json arrow/ci/vcpkg/ | ||
# cannot use the S3 feature here because while aws-sdk-cpp=1.9.160 contains | ||
# ssl related fixes as well as we can patch the vcpkg portfile to support | ||
# arm machines it hits ARROW-15141 where we would need to fall back to 1.8.186 | ||
# but we cannot patch those portfiles since vcpkg-tool handles the checkout of | ||
# previous versions => use bundled S3 build | ||
RUN vcpkg install \ | ||
--clean-after-build \ | ||
--x-install-root=%VCPKG_ROOT%\installed \ | ||
--x-manifest-root=arrow/ci/vcpkg \ | ||
--x-feature=flight \ | ||
--x-feature=gcs \ | ||
--x-feature=json \ | ||
--x-feature=orc \ | ||
--x-feature=parquet \ | ||
--x-feature=s3 | ||
|
||
# Remove previous installations of Python from the base image | ||
# NOTE: a more recent base image (tried with 2.12.1) comes with Python 3.9.7 | ||
# and the MSI installers are failing to remove pip and tcl/tk "products" making | ||
# the subsequent choco python installation step failing for installing Python | ||
# version 3.9.* due to existing Python version | ||
RUN wmic product where "name like 'python%%'" call uninstall /nointeractive && \ | ||
rm -rf Python* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this match
python-wheel-windows-vs2019-base.dockerfile
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not, but this is asking for more and more things that are outside of the scope of this PR...
Also, the diagnostics emitted by hadolint don't seem terribly useful, especially when we have to silence most of them.