From f9361c6df1298f32860d3fa1ef8c5150d3d3a36e Mon Sep 17 00:00:00 2001 From: aIbrahiim Date: Fri, 20 Feb 2026 18:08:55 +0200 Subject: [PATCH 1/6] Fix PreCommit YAML Xlang job hanging --- .../apache/beam/gradle/BeamModulePlugin.groovy | 18 ++++++++++++++---- sdks/python/constraints.txt | 7 +++++++ sdks/python/setup.py | 10 +++++++++- 3 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 sdks/python/constraints.txt diff --git a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy index 76f380c94bb8..92650753da83 100644 --- a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy +++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy @@ -3121,10 +3121,11 @@ class BeamModulePlugin implements Plugin { // TODO: https://github.com/apache/beam/issues/29022 // pip 23.3 is failing due to Hash mismatch between expected SHA of the packaged and actual SHA. // until it is resolved on pip's side, don't use pip's cache. - // pip 25.1 casues :sdks:python:installGcpTest stuck. Pin to 25.0.1 for now. + // Use pip 26.0.1 for improved resolution performance and bug fixes. See #34798. args '-c', ". ${project.ext.envdir}/bin/activate && " + - "pip install --pre --retries 10 --upgrade pip==25.0.1 --no-cache-dir && " + - "pip install --pre --retries 10 --upgrade tox --no-cache-dir" + "pip install --pre --retries 10 --upgrade pip==26.0.1 --no-cache-dir && " + + "pip install --pre --retries 10 --upgrade tox --no-cache-dir && " + + "pip install uv" } } // Gradle will delete outputs whenever it thinks they are stale. Putting a @@ -3169,9 +3170,18 @@ class BeamModulePlugin implements Plugin { packages += ",${extra}" } + def pythonSdkDir = project.project(":sdks:python").projectDir + def constraintsPath = "${pythonSdkDir}/constraints.txt" + def constraintFile = project.file(constraintsPath) + def constraintFlag = constraintFile.exists() ? "--constraint ${constraintsPath}" : "" + + // Use uv instead of pip - pip was hitting resolution-too-deep on tensorflow->keras->namex/optree. + // Include namex/optree as explicit deps to constrain resolution. + def anchorPkgs = "namex==0.0.9 optree==0.16.0" + def installCmd = ". ${project.ext.envdir}/bin/activate && uv pip install ${constraintFlag} ${anchorPkgs} ${distTarBall}[${packages}]".replaceAll(/ +/, ' ').trim() project.exec { executable 'sh' - args '-c', ". ${project.ext.envdir}/bin/activate && pip install --pre --retries 10 ${distTarBall}[${packages}]" + args '-c', installCmd } } } diff --git a/sdks/python/constraints.txt b/sdks/python/constraints.txt new file mode 100644 index 000000000000..82ab7484763a --- /dev/null +++ b/sdks/python/constraints.txt @@ -0,0 +1,7 @@ +# Pins for installGcpTest - reduces backtracking and avoids numpy 1.x vs 2.x ABI issues. +numpy>=1.26.0,<2.0.0 +googleapis-common-protos==1.63.0 +grpc-google-iam-v1>=0.12.4,<1.0.0 +google-api-core==2.16.2 +optree==0.16.0 +namex==0.0.9 diff --git a/sdks/python/setup.py b/sdks/python/setup.py index 19aab312f274..6ce0dba094a4 100644 --- a/sdks/python/setup.py +++ b/sdks/python/setup.py @@ -541,6 +541,9 @@ def get_portability_package_data(): # tensorflow-transform requires dill, but doesn't set dill as a # hard requirement in setup.py. 'dill', + # keras pulls in namex/optree without version bounds - pin to avoid resolver issues + 'namex==0.0.9', + 'optree==0.16.0', 'tensorflow-transform', # Comment out xgboost as it is breaking presubmit python ml # tests due to tag check introduced since pip 24.2 @@ -549,8 +552,13 @@ def get_portability_package_data(): ] + ml_base, 'p312_ml_test': [ 'datatable', + 'namex==0.0.9', + 'optree==0.16.0', + ] + ml_base, + 'p313_ml_test': [ + 'namex==0.0.9', + 'optree==0.16.0', ] + ml_base, - 'p313_ml_test': ml_base, 'aws': ['boto3>=1.9,<2'], 'azure': [ 'azure-storage-blob>=12.3.2,<13', From 89b4b5e0b80731943149dd7596feb93768507af3 Mon Sep 17 00:00:00 2001 From: aIbrahiim Date: Mon, 23 Feb 2026 16:56:09 +0200 Subject: [PATCH 2/6] Fix Python 3.13 dependency resolution for installGcpTest --- .../apache/beam/gradle/BeamModulePlugin.groovy | 7 +++++-- sdks/python/constraints.txt | 17 +++++++++++++++++ sdks/python/setup.py | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy index 92650753da83..747aacfdbb4d 100644 --- a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy +++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy @@ -3171,14 +3171,17 @@ class BeamModulePlugin implements Plugin { } def pythonSdkDir = project.project(":sdks:python").projectDir - def constraintsPath = "${pythonSdkDir}/constraints.txt" + // Python 3.13 requires numpy>=2.1.0; constraints.txt pins numpy<2 for py310-312. + def constraintsName = "3.13".equals(project.ext.pythonVersion) ? "constraints_py313.txt" : "constraints.txt" + def constraintsPath = "${pythonSdkDir}/${constraintsName}" def constraintFile = project.file(constraintsPath) def constraintFlag = constraintFile.exists() ? "--constraint ${constraintsPath}" : "" // Use uv instead of pip - pip was hitting resolution-too-deep on tensorflow->keras->namex/optree. // Include namex/optree as explicit deps to constrain resolution. + // --prerelease allow: envoy-data-plane depends on betterproto==2.0.0b6 (beta). def anchorPkgs = "namex==0.0.9 optree==0.16.0" - def installCmd = ". ${project.ext.envdir}/bin/activate && uv pip install ${constraintFlag} ${anchorPkgs} ${distTarBall}[${packages}]".replaceAll(/ +/, ' ').trim() + def installCmd = ". ${project.ext.envdir}/bin/activate && uv pip install --prerelease allow ${constraintFlag} ${anchorPkgs} ${distTarBall}[${packages}]".replaceAll(/ +/, ' ').trim() project.exec { executable 'sh' args '-c', installCmd diff --git a/sdks/python/constraints.txt b/sdks/python/constraints.txt index 82ab7484763a..e1a3a070457c 100644 --- a/sdks/python/constraints.txt +++ b/sdks/python/constraints.txt @@ -1,3 +1,20 @@ +# +# 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. +# + # Pins for installGcpTest - reduces backtracking and avoids numpy 1.x vs 2.x ABI issues. numpy>=1.26.0,<2.0.0 googleapis-common-protos==1.63.0 diff --git a/sdks/python/setup.py b/sdks/python/setup.py index 6ce0dba094a4..9c0aeb9cd06f 100644 --- a/sdks/python/setup.py +++ b/sdks/python/setup.py @@ -541,7 +541,7 @@ def get_portability_package_data(): # tensorflow-transform requires dill, but doesn't set dill as a # hard requirement in setup.py. 'dill', - # keras pulls in namex/optree without version bounds - pin to avoid resolver issues + # keras deps namex/optree lack version bounds - pin to avoid resolver issues 'namex==0.0.9', 'optree==0.16.0', 'tensorflow-transform', From dbda4f4dfebab813eeba23616a7de11826e6030e Mon Sep 17 00:00:00 2001 From: aIbrahiim Date: Tue, 24 Feb 2026 00:37:38 +0200 Subject: [PATCH 3/6] Fix Python 3.13 deps and resolver issues --- .../beam/gradle/BeamModulePlugin.groovy | 6 ++---- sdks/python/constraints.txt | 7 +++---- sdks/python/pyproject.toml | 5 +++-- sdks/python/setup.py | 21 ++++++++++--------- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy index 747aacfdbb4d..e081fdcc50ff 100644 --- a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy +++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy @@ -3171,16 +3171,14 @@ class BeamModulePlugin implements Plugin { } def pythonSdkDir = project.project(":sdks:python").projectDir - // Python 3.13 requires numpy>=2.1.0; constraints.txt pins numpy<2 for py310-312. - def constraintsName = "3.13".equals(project.ext.pythonVersion) ? "constraints_py313.txt" : "constraints.txt" - def constraintsPath = "${pythonSdkDir}/${constraintsName}" + def constraintsPath = "${pythonSdkDir}/constraints.txt" def constraintFile = project.file(constraintsPath) def constraintFlag = constraintFile.exists() ? "--constraint ${constraintsPath}" : "" // Use uv instead of pip - pip was hitting resolution-too-deep on tensorflow->keras->namex/optree. // Include namex/optree as explicit deps to constrain resolution. // --prerelease allow: envoy-data-plane depends on betterproto==2.0.0b6 (beta). - def anchorPkgs = "namex==0.0.9 optree==0.16.0" + def anchorPkgs = "namex>=0.0.9,<0.2.0 optree>=0.16.0,<0.19.0" def installCmd = ". ${project.ext.envdir}/bin/activate && uv pip install --prerelease allow ${constraintFlag} ${anchorPkgs} ${distTarBall}[${packages}]".replaceAll(/ +/, ' ').trim() project.exec { executable 'sh' diff --git a/sdks/python/constraints.txt b/sdks/python/constraints.txt index e1a3a070457c..ad5728e5d9c1 100644 --- a/sdks/python/constraints.txt +++ b/sdks/python/constraints.txt @@ -15,10 +15,9 @@ # limitations under the License. # -# Pins for installGcpTest - reduces backtracking and avoids numpy 1.x vs 2.x ABI issues. -numpy>=1.26.0,<2.0.0 +# Pins for installGcpTest. numpy handled via setup.py python_version markers. googleapis-common-protos==1.63.0 grpc-google-iam-v1>=0.12.4,<1.0.0 google-api-core==2.16.2 -optree==0.16.0 -namex==0.0.9 +optree>=0.16.0,<0.19.0 +namex>=0.0.9,<0.2.0 diff --git a/sdks/python/pyproject.toml b/sdks/python/pyproject.toml index c705dcb438cf..d17bffb8c14e 100644 --- a/sdks/python/pyproject.toml +++ b/sdks/python/pyproject.toml @@ -26,8 +26,9 @@ requires = [ "mypy-protobuf==3.5.0", # Avoid https://github.com/pypa/virtualenv/issues/2006 "distlib==0.3.9", - # Numpy headers - "numpy>=1.14.3,<2.5.0", # Update setup.py as well. + # Numpy headers. py313 requires 2.1+; py<3.13 use 1.x for pandas ABI compat. + "numpy>=1.26.0,<2.0.0; python_version < '3.13'", + "numpy>=2.1.0; python_version >= '3.13'", # having cython here will create wheels that are platform dependent. "cython>=3.0,<4", ## deps for generating external transform wrappers: diff --git a/sdks/python/setup.py b/sdks/python/setup.py index 9c0aeb9cd06f..ba8c54f45b09 100644 --- a/sdks/python/setup.py +++ b/sdks/python/setup.py @@ -384,9 +384,10 @@ def get_portability_package_data(): 'grpcio>=1.67.0; python_version >= "3.13"', 'httplib2>=0.8,<0.32.0', 'jsonpickle>=3.0.0,<4.0.0', - # numpy can have breaking changes in minor versions. - # Use a strict upper bound. - 'numpy>=1.14.3,<2.5.0', # Update pyproject.toml as well. + # numpy can have breaking changes in minor versions. py310-312: use 1.x + # to avoid pandas ABI mismatch. py313: NumPy 1.x doesn't support Python 3.13. + 'numpy>=1.26.0,<2.0.0; python_version < "3.13"', + 'numpy>=2.1.0; python_version >= "3.13"', 'objsize>=0.6.1,<0.8.0', 'packaging>=22.0', 'pillow', @@ -541,9 +542,9 @@ def get_portability_package_data(): # tensorflow-transform requires dill, but doesn't set dill as a # hard requirement in setup.py. 'dill', - # keras deps namex/optree lack version bounds - pin to avoid resolver issues - 'namex==0.0.9', - 'optree==0.16.0', + # keras deps namex/optree lack version bounds - constrain to avoid resolver issues + 'namex>=0.0.9,<0.2.0', + 'optree>=0.16.0,<0.19.0', 'tensorflow-transform', # Comment out xgboost as it is breaking presubmit python ml # tests due to tag check introduced since pip 24.2 @@ -552,12 +553,12 @@ def get_portability_package_data(): ] + ml_base, 'p312_ml_test': [ 'datatable', - 'namex==0.0.9', - 'optree==0.16.0', + 'namex>=0.0.9,<0.2.0', + 'optree>=0.16.0,<0.19.0', ] + ml_base, 'p313_ml_test': [ - 'namex==0.0.9', - 'optree==0.16.0', + 'namex>=0.0.9,<0.2.0', + 'optree>=0.16.0,<0.19.0', ] + ml_base, 'aws': ['boto3>=1.9,<2'], 'azure': [ From 970964355962f14f622fcef587f9f2ceec3bdf04 Mon Sep 17 00:00:00 2001 From: aIbrahiim Date: Tue, 24 Feb 2026 00:51:29 +0200 Subject: [PATCH 4/6] fix numpy 1.x in base_image_requirements for py<3.13 --- sdks/python/container/ml/py310/base_image_requirements.txt | 2 +- sdks/python/container/ml/py310/gpu_image_requirements.txt | 2 +- sdks/python/container/ml/py311/base_image_requirements.txt | 2 +- sdks/python/container/ml/py311/gpu_image_requirements.txt | 2 +- sdks/python/container/ml/py312/base_image_requirements.txt | 2 +- sdks/python/container/ml/py312/gpu_image_requirements.txt | 2 +- sdks/python/container/py310/base_image_requirements.txt | 2 +- sdks/python/container/py311/base_image_requirements.txt | 2 +- sdks/python/container/py312/base_image_requirements.txt | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sdks/python/container/ml/py310/base_image_requirements.txt b/sdks/python/container/ml/py310/base_image_requirements.txt index 9817ce616a6c..a89189c903d0 100644 --- a/sdks/python/container/ml/py310/base_image_requirements.txt +++ b/sdks/python/container/ml/py310/base_image_requirements.txt @@ -145,7 +145,7 @@ multidict==6.7.1 namex==0.1.0 networkx==3.4.2 nltk==3.9.2 -numpy==2.2.6 +numpy==1.26.4 oauth2client==4.1.3 objsize==0.7.1 opentelemetry-api==1.39.1 diff --git a/sdks/python/container/ml/py310/gpu_image_requirements.txt b/sdks/python/container/ml/py310/gpu_image_requirements.txt index f43dd2745aba..f02261d99584 100644 --- a/sdks/python/container/ml/py310/gpu_image_requirements.txt +++ b/sdks/python/container/ml/py310/gpu_image_requirements.txt @@ -172,7 +172,7 @@ networkx==3.4.2 ninja==1.13.0 nltk==3.9.2 numba==0.61.2 -numpy==2.2.6 +numpy==1.26.4 nvidia-cublas-cu12==12.6.4.1 nvidia-cuda-cupti-cu12==12.6.80 nvidia-cuda-nvrtc-cu12==12.6.77 diff --git a/sdks/python/container/ml/py311/base_image_requirements.txt b/sdks/python/container/ml/py311/base_image_requirements.txt index 571cdb28c767..78297cd5925c 100644 --- a/sdks/python/container/ml/py311/base_image_requirements.txt +++ b/sdks/python/container/ml/py311/base_image_requirements.txt @@ -143,7 +143,7 @@ multidict==6.7.1 namex==0.1.0 networkx==3.6.1 nltk==3.9.2 -numpy==2.4.2 +numpy==1.26.4 oauth2client==4.1.3 objsize==0.7.1 opentelemetry-api==1.39.1 diff --git a/sdks/python/container/ml/py311/gpu_image_requirements.txt b/sdks/python/container/ml/py311/gpu_image_requirements.txt index f44a8ff9be00..bb9469364878 100644 --- a/sdks/python/container/ml/py311/gpu_image_requirements.txt +++ b/sdks/python/container/ml/py311/gpu_image_requirements.txt @@ -170,7 +170,7 @@ networkx==3.6.1 ninja==1.13.0 nltk==3.9.2 numba==0.61.2 -numpy==2.2.6 +numpy==1.26.4 nvidia-cublas-cu12==12.6.4.1 nvidia-cuda-cupti-cu12==12.6.80 nvidia-cuda-nvrtc-cu12==12.6.77 diff --git a/sdks/python/container/ml/py312/base_image_requirements.txt b/sdks/python/container/ml/py312/base_image_requirements.txt index fdc80fd0ccb4..6f505c817a3b 100644 --- a/sdks/python/container/ml/py312/base_image_requirements.txt +++ b/sdks/python/container/ml/py312/base_image_requirements.txt @@ -142,7 +142,7 @@ multidict==6.7.1 namex==0.1.0 networkx==3.6.1 nltk==3.9.2 -numpy==2.4.2 +numpy==1.26.4 oauth2client==4.1.3 objsize==0.7.1 opentelemetry-api==1.39.1 diff --git a/sdks/python/container/ml/py312/gpu_image_requirements.txt b/sdks/python/container/ml/py312/gpu_image_requirements.txt index a9b13f834d1a..5c711e7fcf18 100644 --- a/sdks/python/container/ml/py312/gpu_image_requirements.txt +++ b/sdks/python/container/ml/py312/gpu_image_requirements.txt @@ -169,7 +169,7 @@ networkx==3.6.1 ninja==1.13.0 nltk==3.9.2 numba==0.61.2 -numpy==2.2.6 +numpy==1.26.4 nvidia-cublas-cu12==12.6.4.1 nvidia-cuda-cupti-cu12==12.6.80 nvidia-cuda-nvrtc-cu12==12.6.77 diff --git a/sdks/python/container/py310/base_image_requirements.txt b/sdks/python/container/py310/base_image_requirements.txt index 1f78a4935f73..8f290074d385 100644 --- a/sdks/python/container/py310/base_image_requirements.txt +++ b/sdks/python/container/py310/base_image_requirements.txt @@ -126,7 +126,7 @@ mock==5.2.0 more-itertools==10.8.0 multidict==6.7.1 nltk==3.9.2 -numpy==2.2.6 +numpy==1.26.4 oauth2client==4.1.3 objsize==0.7.1 opentelemetry-api==1.39.1 diff --git a/sdks/python/container/py311/base_image_requirements.txt b/sdks/python/container/py311/base_image_requirements.txt index e41f72af87e3..ec796606536e 100644 --- a/sdks/python/container/py311/base_image_requirements.txt +++ b/sdks/python/container/py311/base_image_requirements.txt @@ -124,7 +124,7 @@ mock==5.2.0 more-itertools==10.8.0 multidict==6.7.1 nltk==3.9.2 -numpy==2.4.2 +numpy==1.26.4 oauth2client==4.1.3 objsize==0.7.1 opentelemetry-api==1.39.1 diff --git a/sdks/python/container/py312/base_image_requirements.txt b/sdks/python/container/py312/base_image_requirements.txt index 2f7820d01d68..03958cf374e2 100644 --- a/sdks/python/container/py312/base_image_requirements.txt +++ b/sdks/python/container/py312/base_image_requirements.txt @@ -123,7 +123,7 @@ mock==5.2.0 more-itertools==10.8.0 multidict==6.7.1 nltk==3.9.2 -numpy==2.4.2 +numpy==1.26.4 oauth2client==4.1.3 objsize==0.7.1 opentelemetry-api==1.39.1 From d03ed0554b0902313a7e8a016ade8443b23f95bc Mon Sep 17 00:00:00 2001 From: aIbrahiim Date: Tue, 24 Feb 2026 01:13:34 +0200 Subject: [PATCH 5/6] revert namex/optree to exact pins for installGcpTest --- .../org/apache/beam/gradle/BeamModulePlugin.groovy | 2 +- sdks/python/constraints.txt | 4 ++-- sdks/python/setup.py | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy index e081fdcc50ff..3a928f2a3229 100644 --- a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy +++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy @@ -3178,7 +3178,7 @@ class BeamModulePlugin implements Plugin { // Use uv instead of pip - pip was hitting resolution-too-deep on tensorflow->keras->namex/optree. // Include namex/optree as explicit deps to constrain resolution. // --prerelease allow: envoy-data-plane depends on betterproto==2.0.0b6 (beta). - def anchorPkgs = "namex>=0.0.9,<0.2.0 optree>=0.16.0,<0.19.0" + def anchorPkgs = "namex==0.0.9 optree==0.16.0" def installCmd = ". ${project.ext.envdir}/bin/activate && uv pip install --prerelease allow ${constraintFlag} ${anchorPkgs} ${distTarBall}[${packages}]".replaceAll(/ +/, ' ').trim() project.exec { executable 'sh' diff --git a/sdks/python/constraints.txt b/sdks/python/constraints.txt index ad5728e5d9c1..5e40078b4000 100644 --- a/sdks/python/constraints.txt +++ b/sdks/python/constraints.txt @@ -19,5 +19,5 @@ googleapis-common-protos==1.63.0 grpc-google-iam-v1>=0.12.4,<1.0.0 google-api-core==2.16.2 -optree>=0.16.0,<0.19.0 -namex>=0.0.9,<0.2.0 +optree==0.16.0 +namex==0.0.9 diff --git a/sdks/python/setup.py b/sdks/python/setup.py index ba8c54f45b09..3c1fddbce158 100644 --- a/sdks/python/setup.py +++ b/sdks/python/setup.py @@ -542,9 +542,9 @@ def get_portability_package_data(): # tensorflow-transform requires dill, but doesn't set dill as a # hard requirement in setup.py. 'dill', - # keras deps namex/optree lack version bounds - constrain to avoid resolver issues - 'namex>=0.0.9,<0.2.0', - 'optree>=0.16.0,<0.19.0', + # keras deps namex/optree lack version bounds - pin to avoid resolver issues + 'namex==0.0.9', + 'optree==0.16.0', 'tensorflow-transform', # Comment out xgboost as it is breaking presubmit python ml # tests due to tag check introduced since pip 24.2 @@ -553,12 +553,12 @@ def get_portability_package_data(): ] + ml_base, 'p312_ml_test': [ 'datatable', - 'namex>=0.0.9,<0.2.0', - 'optree>=0.16.0,<0.19.0', + 'namex==0.0.9', + 'optree==0.16.0', ] + ml_base, 'p313_ml_test': [ - 'namex>=0.0.9,<0.2.0', - 'optree>=0.16.0,<0.19.0', + 'namex==0.0.9', + 'optree==0.16.0', ] + ml_base, 'aws': ['boto3>=1.9,<2'], 'azure': [ From 7c0a8d3b4fa550dc9320c32fa2e7d57e947ed447 Mon Sep 17 00:00:00 2001 From: aIbrahiim Date: Tue, 24 Feb 2026 02:00:53 +0200 Subject: [PATCH 6/6] Fix setup.py lint and constraints for py313 --- sdks/python/constraints.txt | 5 +++-- sdks/python/setup.py | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sdks/python/constraints.txt b/sdks/python/constraints.txt index 5e40078b4000..c591d73e48d6 100644 --- a/sdks/python/constraints.txt +++ b/sdks/python/constraints.txt @@ -16,8 +16,9 @@ # # Pins for installGcpTest. numpy handled via setup.py python_version markers. -googleapis-common-protos==1.63.0 +# Use google-api-core 2.29.0 for py313 compat (2.16.2 lacks it). +googleapis-common-protos==1.72.0 grpc-google-iam-v1>=0.12.4,<1.0.0 -google-api-core==2.16.2 +google-api-core==2.29.0 optree==0.16.0 namex==0.0.9 diff --git a/sdks/python/setup.py b/sdks/python/setup.py index 3c1fddbce158..828333444064 100644 --- a/sdks/python/setup.py +++ b/sdks/python/setup.py @@ -384,8 +384,8 @@ def get_portability_package_data(): 'grpcio>=1.67.0; python_version >= "3.13"', 'httplib2>=0.8,<0.32.0', 'jsonpickle>=3.0.0,<4.0.0', - # numpy can have breaking changes in minor versions. py310-312: use 1.x - # to avoid pandas ABI mismatch. py313: NumPy 1.x doesn't support Python 3.13. + # numpy: py310-312 use 1.x; py313 needs 2.x (1.x unsupported; avoids # pylint: disable=line-too-long + # pandas ABI mismatch). 'numpy>=1.26.0,<2.0.0; python_version < "3.13"', 'numpy>=2.1.0; python_version >= "3.13"', 'objsize>=0.6.1,<0.8.0', @@ -542,7 +542,7 @@ def get_portability_package_data(): # tensorflow-transform requires dill, but doesn't set dill as a # hard requirement in setup.py. 'dill', - # keras deps namex/optree lack version bounds - pin to avoid resolver issues + # namex/optree: pin to avoid resolver issues (lack version bounds) # pylint: disable=line-too-long 'namex==0.0.9', 'optree==0.16.0', 'tensorflow-transform',