From 71c146e09cf5cb786057d0c9fadb539ceedb2a59 Mon Sep 17 00:00:00 2001 From: Anurag Singh Date: Sat, 31 Oct 2026 18:28:36 +0530 Subject: [PATCH] Support PyArrow 26 in the Python SDK Raise the pyarrow upper bound to <27.0.0 and add the 26 tox environment and Gradle task so the dependency postcommit covers it. PyArrow 26 requires NumPy 2, so that environment installs NumPy 2 while the older environments stay on 1.26.4. --- sdks/python/setup.py | 2 +- sdks/python/test-suites/tox/py311/build.gradle | 4 ++++ sdks/python/tox.ini | 7 +++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/sdks/python/setup.py b/sdks/python/setup.py index d79df248c988..d8c853908af9 100644 --- a/sdks/python/setup.py +++ b/sdks/python/setup.py @@ -153,7 +153,7 @@ def cythonize(*args, **kwargs): # Generally try to cover versions released in the last two years. # Update python/sdks/tox.ini to cover the same pyarrow versions # when updating the bounds here. - 'pyarrow>=14.0.1,<26.0.0', + 'pyarrow>=14.0.1,<27.0.0', ] # must update the below "docs" and "test" for extras_require diff --git a/sdks/python/test-suites/tox/py311/build.gradle b/sdks/python/test-suites/tox/py311/build.gradle index 27f7904896dc..55c052fea34d 100644 --- a/sdks/python/test-suites/tox/py311/build.gradle +++ b/sdks/python/test-suites/tox/py311/build.gradle @@ -84,6 +84,10 @@ toxTask "testPy311pyarrow-25", "py311-pyarrow-25", "${posargs}" test.dependsOn "testPy311pyarrow-25" postCommitPyDep.dependsOn "testPy311pyarrow-25" +toxTask "testPy311pyarrow-26", "py311-pyarrow-26", "${posargs}" +test.dependsOn "testPy311pyarrow-26" +postCommitPyDep.dependsOn "testPy311pyarrow-26" + // Create a test task for each supported minor version of pandas. // Keep in sync with [testenv:py311-pandas-...] in tox.ini. toxTask "testPy311pandas-22", "py311-pandas-22", "${posargs}" diff --git a/sdks/python/tox.ini b/sdks/python/tox.ini index ac583f3b6c79..8274e37d3942 100644 --- a/sdks/python/tox.ini +++ b/sdks/python/tox.ini @@ -344,7 +344,7 @@ extras = test commands = bash {toxinidir}/scripts/pytest_validates_runner.sh {envname} {toxinidir}/apache_beam/runners/portability/prism_runner_test.py {posargs} -[testenv:py311-pyarrow-{17,18,19,20,21,22,23,24,25}] +[testenv:py311-pyarrow-{17,18,19,20,21,22,23,24,25,26}] deps = # Test against versions of pyarrow released in last ~2 years. 17: pyarrow>=17,<18 @@ -356,7 +356,10 @@ deps = 23: pyarrow>=23,<24 24: pyarrow>=24,<25 25: pyarrow>=25,<26 - numpy==1.26.4 + 26: pyarrow>=26,<27 + # PyArrow 26 requires NumPy 2; the earlier versions stay on NumPy 1. + {17,18,19,20,21,22,23,24,25}: numpy==1.26.4 + 26: numpy>=2.0.0,<2.5.0 commands = # Log pyarrow and numpy version for debugging /bin/sh -c "pip freeze | grep -E '(pyarrow|numpy)'"