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

ARROW-17487: [Python][Packaging][CI] Add support for Python 3.11 #14499

Merged
merged 19 commits into from Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
d874841
ARROW-17487: [Python][Packaging][CI] Add support for Python 3.11
raulcd Oct 25, 2022
f98e6ce
ARROW-17487: [Python][Packaging] Update minor version for python 3.10
raulcd Oct 25, 2022
d52df67
Update trove classifier to include Python 3.11
raulcd Oct 25, 2022
4463e9b
Fix python package to install on MacOS
raulcd Oct 25, 2022
a250381
Update all python minor versions to latest
raulcd Oct 25, 2022
3ca1270
Set numpy for test wheel requirements to supported version for 3.11
raulcd Oct 26, 2022
f105c4f
Fix requirements-wheel-test.txt after local testing
raulcd Oct 26, 2022
b485d34
Add missing correct version of numpy for MacOS ARM wheels
raulcd Oct 26, 2022
b7c7599
Apply fix for _fs tests
raulcd Oct 26, 2022
d830ec1
Try upgrading storage-testbench and required grpcio which is supposed…
raulcd Oct 26, 2022
4a7e800
Do not build MacOS universal2 wheels for Python 3.11
raulcd Oct 27, 2022
b664bee
Use latest available Python macosx10.9.pkg build instead of only source
raulcd Oct 27, 2022
209c970
Use latest available Python on chocolatey instead of latest
raulcd Oct 27, 2022
43ad787
Delete wrongly committed patch
raulcd Oct 27, 2022
f501468
Add python 3.11 to the wheels versions to be tested on verify-release…
raulcd Nov 3, 2022
a655655
Remove workaround that required building grpcio on macOS arm64
raulcd Nov 3, 2022
6f79c8f
Remove universal2 wheels being generated for Python 3.9 and 3.10. Rem…
raulcd Nov 4, 2022
db9ff9f
Validate whether new generated wheel on Pypi is the issue
raulcd Nov 4, 2022
c933cb3
Revert pinning wheel package and pin new recently published version o…
raulcd Nov 4, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions ci/docker/python-wheel-windows-test-vs2017.dockerfile
Expand Up @@ -37,7 +37,8 @@ RUN wmic product where "name like 'python%%'" call uninstall /nointeractive && \
ARG python=3.8
RUN (if "%python%"=="3.7" setx PYTHON_VERSION "3.7.9" && setx PATH "%PATH%;C:\Python37;C:\Python37\Scripts") & \
(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.7" && setx PATH "%PATH%;C:\Python39;C:\Python39\Scripts") & \
(if "%python%"=="3.10" setx PYTHON_VERSION "3.10.2" && setx PATH "%PATH%;C:\Python310;C:\Python310\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.8" && setx PATH "%PATH%;C:\Python310;C:\Python310\Scripts") & \
(if "%python%"=="3.11" setx PYTHON_VERSION "3.11.0" && setx PATH "%PATH%;C:\Python311;C:\Python311\Scripts")
RUN choco install -r -y --no-progress python --version=%PYTHON_VERSION%
RUN python -m pip install -U pip setuptools
5 changes: 3 additions & 2 deletions ci/docker/python-wheel-windows-vs2017.dockerfile
Expand Up @@ -80,8 +80,9 @@ RUN wmic product where "name like 'python%%'" call uninstall /nointeractive && \
ARG python=3.8
RUN (if "%python%"=="3.7" setx PYTHON_VERSION "3.7.9" && setx PATH "%PATH%;C:\Python37;C:\Python37\Scripts") & \
(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.7" && setx PATH "%PATH%;C:\Python39;C:\Python39\Scripts") & \
(if "%python%"=="3.10" setx PYTHON_VERSION "3.10.2" && setx PATH "%PATH%;C:\Python310;C:\Python310\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.8" && setx PATH "%PATH%;C:\Python310;C:\Python310\Scripts") & \
(if "%python%"=="3.11" setx PYTHON_VERSION "3.11.0" && setx PATH "%PATH%;C:\Python311;C:\Python311\Scripts")
RUN choco install -r -y --no-progress python --version=%PYTHON_VERSION%
RUN python -m pip install -U pip setuptools

Expand Down
11 changes: 1 addition & 10 deletions ci/scripts/install_gcs_testbench.sh
Expand Up @@ -34,18 +34,9 @@ case "$(uname -m)" in
;;
esac

case "$(uname -s)-$(uname -m)" in
Darwin-arm64)
# Workaround for https://github.com/grpc/grpc/issues/28387 .
# Build grpcio instead of using wheel.
# storage-testbench 0.27.0 pins grpcio to 1.46.1.
${PYTHON:-python3} -m pip install --no-binary :all: "grpcio==1.46.1"
;;
esac

version=$1
if [[ "${version}" -eq "default" ]]; then
version="v0.27.0"
version="v0.32.0"
fi

${PYTHON:-python3} -m pip install \
Expand Down
7 changes: 4 additions & 3 deletions ci/scripts/install_python.sh
Expand Up @@ -27,8 +27,9 @@ platforms=([windows]=Windows
declare -A versions
versions=([3.7]=3.7.9
[3.8]=3.8.10
[3.9]=3.9.9
[3.10]=3.10.1)
[3.9]=3.9.13
[3.10]=3.10.8
[3.11]=3.11.0)

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

if [ "$(uname -m)" = "arm64" ] || [ "$version" = "3.10" ]; then
if [ "$(uname -m)" = "arm64" ] || [ "$version" = "3.10" ] || [ "$version" = "3.11" ]; then
fname="python-${full_version}-macos11.pkg"
else
fname="python-${full_version}-macosx10.9.pkg"
Expand Down
4 changes: 1 addition & 3 deletions ci/scripts/python_wheel_macos_build.sh
Expand Up @@ -41,8 +41,6 @@ if [ $arch = "arm64" ]; then
export CMAKE_OSX_ARCHITECTURES="arm64"
elif [ $arch = "x86_64" ]; then
export CMAKE_OSX_ARCHITECTURES="x86_64"
elif [ $arch = "universal2" ]; then
export CMAKE_OSX_ARCHITECTURES="x86_64;arm64"
else
echo "Unexpected architecture: $arch"
exit 1
Expand All @@ -58,7 +56,7 @@ pip install \
--target $PIP_SITE_PACKAGES \
--platform $PIP_TARGET_PLATFORM \
-r ${source_dir}/python/requirements-wheel-build.txt
pip install "delocate>=0.9"
pip install "delocate>=0.10.3"

echo "=== (${PYTHON_VERSION}) Building Arrow C++ libraries ==="
: ${ARROW_DATASET:=ON}
Expand Down
26 changes: 3 additions & 23 deletions dev/release/verify-release-candidate.sh
Expand Up @@ -1019,7 +1019,7 @@ test_linux_wheels() {
local arch="x86_64"
fi

local python_versions="${TEST_PYTHON_VERSIONS:-3.7m 3.8 3.9 3.10}"
local python_versions="${TEST_PYTHON_VERSIONS:-3.7m 3.8 3.9 3.10 3.11}"
local platform_tags="manylinux_2_17_${arch}.manylinux2014_${arch}"

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

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

Expand All @@ -1067,26 +1067,6 @@ test_macos_wheels() {
${ARROW_DIR}/ci/scripts/python_wheel_unix_test.sh ${ARROW_SOURCE_DIR}
done
done

# verify arm64 and universal2 wheels using an universal2 python binary
# the interpreter should be installed from python.org:
# https://www.python.org/ftp/python/3.9.6/python-3.9.6-macosx10.9.pkg
if [ "$(uname -m)" = "arm64" ]; then
for pyver in 3.9 3.10; do
local python="/Library/Frameworks/Python.framework/Versions/${pyver}/bin/python${pyver}"

# create and activate a virtualenv for testing as arm64
for arch in "arm64" "x86_64"; do
show_header "Testing Python ${pyver} universal2 wheel on ${arch}"
VENV_ENV=wheel-${pyver}-universal2-${arch} PYTHON=${python} maybe_setup_virtualenv || continue
# install pyarrow's universal2 wheel
pip install pyarrow-${VERSION}-cp${pyver/.}-cp${pyver/.}-macosx_11_0_universal2.whl
# check the imports and execute the unittests
INSTALL_PYARROW=OFF ARROW_FLIGHT=${check_flight} \
arch -${arch} ${ARROW_DIR}/ci/scripts/python_wheel_unix_test.sh ${ARROW_SOURCE_DIR}
done
done
fi
}

test_wheels() {
Expand Down
54 changes: 0 additions & 54 deletions dev/tasks/python-wheels/github.osx.arm64.yml
Expand Up @@ -87,46 +87,6 @@ jobs:
pip install --upgrade pip wheel
arrow/ci/scripts/python_wheel_macos_build.sh arm64 $(pwd)/arrow $(pwd)/build

{% if arch == "universal2" %}
- name: Install AMD64 Packages
env:
VCPKG_DEFAULT_TRIPLET: amd64-osx-static-release
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=parquet \
--x-feature=s3

- name: Build AMD64 Wheel
env:
ARROW_SIMD_LEVEL: "NONE"
VCPKG_DEFAULT_TRIPLET: amd64-osx-static-release
run: |
$PYTHON -m venv build-amd64-env
source build-amd64-env/bin/activate
pip install --upgrade pip wheel
arch -x86_64 arrow/ci/scripts/python_wheel_macos_build.sh x86_64 $(pwd)/arrow $(pwd)/build

- name: Fuse AMD64 and ARM64 wheels
run: |
source build-amd64-env/bin/activate
pip install delocate

amd64_wheel=$(ls arrow/python/repaired_wheels/pyarrow*x86_64.whl)
arm64_wheel=$(ls arrow/python/repaired_wheels/pyarrow*arm64.whl)
echo "Fusing ${amd64_wheel} and ${arm64_wheel} into an universal2 wheel..."
delocate-fuse $amd64_wheel $arm64_wheel -w .

fused_wheel=$(ls *x86_64.whl)
rm arrow/python/repaired_wheels/*.whl
mv $fused_wheel arrow/python/repaired_wheels/${fused_wheel/x86_64/universal2}
{% endif %}

- uses: actions/upload-artifact@v3
with:
name: wheel
Expand All @@ -148,20 +108,6 @@ jobs:
PYTHON=python arrow/ci/scripts/install_gcs_testbench.sh default
arrow/ci/scripts/python_wheel_unix_test.sh $(pwd)/arrow

{% if arch == "universal2" %}
- name: Test Wheel on AMD64
shell: bash
env:
PYTEST_ADDOPTS: "-k 'not test_cancellation'"
run: |
$PYTHON -m venv test-amd64-env
source test-amd64-env/bin/activate
pip install --upgrade pip wheel
arch -x86_64 pip install -r arrow/python/requirements-wheel-test.txt
PYTHON=python arch -x86_64 arrow/ci/scripts/install_gcs_testbench.sh default
arch -x86_64 arrow/ci/scripts/python_wheel_unix_test.sh $(pwd)/arrow
{% endif %}

- name: Upload artifacts
shell: bash
run: |
Expand Down
17 changes: 4 additions & 13 deletions dev/tasks/tasks.yml
Expand Up @@ -427,7 +427,8 @@ tasks:
{% for python_version, python_tag, abi_tag in [("3.7", "cp37", "cp37m"),
("3.8", "cp38", "cp38"),
("3.9", "cp39", "cp39"),
("3.10", "cp310", "cp310")] %}
("3.10", "cp310", "cp310"),
("3.11", "cp311", "cp311")] %}

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

Expand Down Expand Up @@ -488,7 +489,7 @@ tasks:
artifacts:
- pyarrow-{no_rc_version}-cp38-cp38-macosx_11_0_arm64.whl

{% for python_version, python_tag in [("3.9", "cp39"), ("3.10", "cp310")] %}
{% for python_version, python_tag in [("3.9", "cp39"), ("3.10", "cp310"), ("3.11", "cp311")] %}
wheel-macos-big-sur-{{ python_tag }}-arm64:
ci: github
template: python-wheels/github.osx.arm64.yml
Expand All @@ -498,16 +499,6 @@ tasks:
macos_deployment_target: "11.0"
artifacts:
- pyarrow-{no_rc_version}-{{ python_tag }}-{{ python_tag }}-macosx_11_0_arm64.whl

wheel-macos-big-sur-{{ python_tag }}-universal2:
ci: github
template: python-wheels/github.osx.arm64.yml
params:
arch: universal2
python_version: "{{ python_version }}"
macos_deployment_target: "10.14"
artifacts:
- pyarrow-{no_rc_version}-{{ python_tag }}-{{ python_tag }}-macosx_10_14_universal2.whl
{% endfor %}

{############################ Python sdist ####################################}
Expand Down Expand Up @@ -1193,7 +1184,7 @@ tasks:
UBUNTU: 20.04
image: ubuntu-cpp-thread-sanitizer

{% for python_version in ["3.7", "3.8", "3.9", "3.10"] %}
{% for python_version in ["3.7", "3.8", "3.9", "3.10", "3.11"] %}
test-conda-python-{{ python_version }}:
ci: github
template: docker-tests/github.linux.yml
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Expand Up @@ -953,7 +953,7 @@ services:
args:
arch: ${ARCH}
arch_short: ${ARCH_SHORT}
base: quay.io/pypa/manylinux2014_${ARCH_ALIAS}:2021-10-11-14ac00e
base: quay.io/pypa/manylinux2014_${ARCH_ALIAS}:2022-10-25-fbea779
vcpkg: ${VCPKG}
python: ${PYTHON}
manylinux: 2014
Expand Down
11 changes: 9 additions & 2 deletions python/pyarrow/_fs.pyx
Expand Up @@ -78,6 +78,12 @@ cdef CFileType _unwrap_file_type(FileType ty) except *:
assert 0


def _file_type_to_string(ty):
# Python 3.11 changed str(IntEnum) to return the string representation
# of the integer value: https://github.com/python/cpython/issues/94763
return f"{ty.__class__.__name__}.{ty._name_}"
raulcd marked this conversation as resolved.
Show resolved Hide resolved


cdef class FileInfo(_Weakrefable):
"""
FileSystem entry info.
Expand Down Expand Up @@ -185,9 +191,10 @@ cdef class FileInfo(_Weakrefable):
except ValueError:
return ''

s = '<FileInfo for {!r}: type={}'.format(self.path, str(self.type))
s = (f'<FileInfo for {self.path!r}: '
f'type={_file_type_to_string(self.type)}')
if self.is_file:
s += ', size={}'.format(self.size)
s += f', size={self.size}'
s += '>'
return s

Expand Down
15 changes: 10 additions & 5 deletions python/requirements-wheel-test.txt
Expand Up @@ -8,14 +8,19 @@ pytz
tzdata; sys_platform == 'win32'

numpy==1.19.5; platform_system == "Linux" and platform_machine == "aarch64" and python_version < "3.7"
numpy==1.21.3; platform_system == "Linux" and platform_machine == "aarch64" and python_version >= "3.7"
numpy==1.21.3; platform_system == "Linux" and platform_machine == "aarch64" and python_version >= "3.7" and python_version < "3.11"
numpy==1.23.4; platform_system == "Linux" and platform_machine == "aarch64" and python_version >= "3.11"
numpy==1.19.5; platform_system == "Linux" and platform_machine != "aarch64" and python_version < "3.9"
numpy==1.21.3; platform_system == "Linux" and platform_machine != "aarch64" and python_version >= "3.9"
numpy==1.21.3; platform_system == "Darwin" and platform_machine == "arm64"
numpy==1.21.3; platform_system == "Linux" and platform_machine != "aarch64" and python_version >= "3.9" and python_version < "3.11"
numpy==1.23.4; platform_system == "Linux" and platform_machine != "aarch64" and python_version >= "3.11"
numpy==1.21.3; platform_system == "Darwin" and platform_machine == "arm64" and python_version < "3.11"
numpy==1.23.4; platform_system == "Darwin" and platform_machine == "arm64" and python_version >= "3.11"
numpy==1.19.5; platform_system == "Darwin" and platform_machine != "arm64" and python_version < "3.9"
numpy==1.21.3; platform_system == "Darwin" and platform_machine != "arm64" and python_version >= "3.9"
numpy==1.21.3; platform_system == "Darwin" and platform_machine != "arm64" and python_version >= "3.9" and python_version < "3.11"
numpy==1.23.4; platform_system == "Darwin" and platform_machine != "arm64" and python_version >= "3.11"
numpy==1.19.5; platform_system == "Windows" and python_version < "3.9"
numpy==1.21.3; platform_system == "Windows" and python_version >= "3.9"
numpy==1.21.3; platform_system == "Windows" and python_version >= "3.9" and python_version < "3.11"
numpy==1.23.4; platform_system == "Windows" and python_version >= "3.11"
raulcd marked this conversation as resolved.
Show resolved Hide resolved

pandas<1.1.0; platform_system == "Linux" and platform_machine != "aarch64" and python_version < "3.8"
pandas; platform_system == "Linux" and platform_machine != "aarch64" and python_version >= "3.8"
Expand Down
1 change: 1 addition & 0 deletions python/setup.py
Expand Up @@ -764,6 +764,7 @@ def has_ext_modules(foo):
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
],
license='Apache License, Version 2.0',
maintainer='Apache Arrow Developers',
Expand Down