diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index bf7f5a3939..3d243becde 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -20,6 +20,7 @@ branchProtectionRules: - 'Presubmit - Unit Tests Python 3.10' - 'Presubmit - Unit Tests Python 3.11' - 'Presubmit - Unit Tests Python 3.12' + - 'Presubmit - Unit Tests Python 3.13' - 'Presubmit - Unit Tests Ray 2.9.3' - 'Presubmit - Unit Tests Ray 2.33.0' - 'Presubmit - Unit Tests Ray 2.42.0 (Python 3.10)' @@ -27,4 +28,6 @@ branchProtectionRules: - 'Presubmit - Unit Tests Ray 2.47.1 (Python 3.11)' - 'Presubmit - Unit Tests LangChain (Python 3.9)' - 'Presubmit - Unit Tests LangChain (Python 3.10)' - - 'Presubmit - Unit Tests LangChain (Python 3.11)' \ No newline at end of file + - 'Presubmit - Unit Tests LangChain (Python 3.11)' + - 'Presubmit - Unit Tests LangChain (Python 3.12)' + - 'Presubmit - Unit Tests LangChain (Python 3.13)' \ No newline at end of file diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index c471f1f8c4..5f5db93807 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.9', '3.10', '3.11', '3.12'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] steps: - name: Checkout code diff --git a/noxfile.py b/noxfile.py index 098bde167f..3462705e70 100644 --- a/noxfile.py +++ b/noxfile.py @@ -51,10 +51,10 @@ "recommonmark", ) -UNIT_TEST_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12"] -UNIT_TEST_LANGCHAIN_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12"] -UNIT_TEST_AG2_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12"] -UNIT_TEST_LLAMA_INDEX_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12"] +UNIT_TEST_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"] +UNIT_TEST_LANGCHAIN_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"] +UNIT_TEST_AG2_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"] +UNIT_TEST_LLAMA_INDEX_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"] PYTHON_TO_RAY_VERSIONS = { "3.10": ["2.9.3", "2.33.0", "2.42.0"], "3.11": ["2.42.0", "2.47.1"], diff --git a/owlbot.py b/owlbot.py index 7e8fa20db9..3502167e14 100644 --- a/owlbot.py +++ b/owlbot.py @@ -99,7 +99,7 @@ templated_files = common.py_library( cov_level=98, system_test_python_versions=["3.9"], - unit_test_python_versions=["3.9", "3.10", "3.11", "3.12"], + unit_test_python_versions=["3.9", "3.10", "3.11", "3.12", "3.13"], unit_test_extras=["testing"], system_test_extras=["testing"], microgenerator=True, @@ -126,10 +126,12 @@ ".kokoro/samples/python3.10/common.cfg", ".kokoro/samples/python3.11/common.cfg", ".kokoro/samples/python3.12/common.cfg", + ".kokoro/samples/python3.13/common.cfg", ".kokoro/samples/python3.9/periodic.cfg", ".kokoro/samples/python3.10/periodic.cfg", ".kokoro/samples/python3.11/periodic.cfg", ".kokoro/samples/python3.12/periodic.cfg", + ".kokoro/samples/python3.13/periodic.cfg", ".github/auto-label.yaml", ".github/blunderbuss.yml", ".github/CODEOWNERS", diff --git a/setup.py b/setup.py index d2c8583c6e..83041fd847 100644 --- a/setup.py +++ b/setup.py @@ -53,12 +53,12 @@ tensorboard_extra_require = profiler_extra_require metadata_extra_require = ["pandas >= 1.0.0", "numpy>=1.15.0"] -xai_extra_require = ["tensorflow >=2.3.0, <3.0.0"] +xai_extra_require = ["tensorflow >=2.3.0, <3.0.0; python_version<'3.13'"] lit_extra_require = [ - "tensorflow >= 2.3.0, <3.0.0", + "tensorflow >= 2.3.0, <3.0.0; python_version<'3.13'", "pandas >= 1.0.0", "lit-nlp == 0.4.0", - "explainable-ai-sdk >= 1.0.0", + "explainable-ai-sdk >= 1.0.0; python_version<'3.13'", ] featurestore_extra_require = [ "google-cloud-bigquery-storage", @@ -131,7 +131,7 @@ "ray[train]", # Framework version constraints copied from testing_extra_require "scikit-learn<1.6.0", - "tensorflow", + "tensorflow; python_version<'3.13'", "torch >= 2.0.0, < 2.1.0", "xgboost", "xgboost_ray", @@ -250,20 +250,23 @@ # google-api-core 2.x is required since kfp requires protobuf > 4 "google-api-core >= 2.11, < 3.0.0", "grpcio-testing", + "grpcio-tools >= 1.63.0; python_version>='3.13'", "ipython", - "kfp >= 2.6.0, < 3.0.0", + "kfp >= 2.6.0, < 3.0.0; python_version<'3.13'", "pytest-asyncio", + "pytest-cov", + "mock", "pytest-xdist", "scikit-learn<1.6.0; python_version<='3.10'", "scikit-learn; python_version>'3.10'", # Lazy import requires > 2.12.0 "tensorflow == 2.14.1; python_version<='3.11'", - "tensorflow == 2.19.0; python_version>'3.11'", + "tensorflow == 2.19.0; python_version>'3.11' and python_version<'3.13'", "protobuf <= 5.29.4", # TODO(jayceeli) torch 2.1.0 has conflict with pyfakefs, will check if # future versions fix this issue "torch >= 2.0.0, < 2.1.0; python_version<='3.11'", - "torch >= 2.2.0; python_version>'3.11'", + "torch >= 2.2.0; python_version>'3.11' and python_version<'3.13'", "requests-toolbelt <= 1.0.0", "immutabledict", "xgboost", @@ -300,7 +303,8 @@ "proto-plus >= 1.22.3, <2.0.0", "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", "packaging >= 14.3", - "google-cloud-storage >= 1.32.0, < 3.0.0", + "google-cloud-storage >= 1.32.0, < 3.0.0; python_version<'3.13'", + "google-cloud-storage >= 2.10.0, < 3.0.0; python_version>='3.13'", "google-cloud-bigquery >= 1.15.0, < 4.0.0, !=3.20.0", "google-cloud-resource-manager >= 1.3.3, < 3.0.0", "shapely < 3.0.0", @@ -348,6 +352,7 @@ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Internet", "Topic :: Software Development :: Libraries :: Python Modules", ], diff --git a/testing/constraints-3.13.txt b/testing/constraints-3.13.txt new file mode 100644 index 0000000000..110ffaed08 --- /dev/null +++ b/testing/constraints-3.13.txt @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core==2.21.0 # Tests google-api-core with rest async support +google-auth==2.35.0 # Tests google-auth with rest async support +proto-plus +mock==4.0.2 +google-cloud-storage==2.10.0 # Increased for kfp 2.0 compatibility +packaging==24.1 # Increased to unbreak canonicalize_version error (b/377774673) +pytest-xdist==3.3.1 # Pinned to unbreak unit tests +ray==2.5.0 # Pinned until 2.9.3 is verified for Ray tests +ipython==8.22.2 # Pinned to unbreak TypeAliasType import error +google-adk==0.0.2 +google-genai>=1.10.0 +google-vizier==0.1.21 \ No newline at end of file diff --git a/tests/unit/aiplatform/test_explain_saved_model_metadata_builder_tf1_test.py b/tests/unit/aiplatform/test_explain_saved_model_metadata_builder_tf1_test.py index d80356642a..c7c1b410be 100644 --- a/tests/unit/aiplatform/test_explain_saved_model_metadata_builder_tf1_test.py +++ b/tests/unit/aiplatform/test_explain_saved_model_metadata_builder_tf1_test.py @@ -16,6 +16,11 @@ # import pytest +import sys + +if sys.version_info >= (3, 13): + pytest.skip("Tensorflow not available for Python 3.13+", allow_module_level=True) + import tensorflow.compat.v1 as tf from google.cloud.aiplatform import models @@ -27,6 +32,7 @@ @pytest.mark.usefixtures("google_auth_mock") +@pytest.mark.skipif(tf is None, reason="Tensorflow not available for Python 3.13+") class SavedModelMetadataBuilderTF1Test(tf.test.TestCase): def _set_up(self): self.sess = tf.Session(graph=tf.Graph()) diff --git a/tests/unit/aiplatform/test_explain_saved_model_metadata_builder_tf2_test.py b/tests/unit/aiplatform/test_explain_saved_model_metadata_builder_tf2_test.py index 3f6be1dc3d..fc46d43aec 100644 --- a/tests/unit/aiplatform/test_explain_saved_model_metadata_builder_tf2_test.py +++ b/tests/unit/aiplatform/test_explain_saved_model_metadata_builder_tf2_test.py @@ -16,6 +16,11 @@ # import pytest +import sys + +if sys.version_info >= (3, 13): + pytest.skip("Tensorflow not available for Python 3.13+", allow_module_level=True) + import tensorflow as tf import numpy as np diff --git a/tests/unit/aiplatform/test_logdir_loader.py b/tests/unit/aiplatform/test_logdir_loader.py index e22f41fdd5..c2e22a2b19 100644 --- a/tests/unit/aiplatform/test_logdir_loader.py +++ b/tests/unit/aiplatform/test_logdir_loader.py @@ -21,6 +21,13 @@ import shutil import tempfile +import sys + +import pytest + +if sys.version_info >= (3, 13): + pytest.skip("Tensorflow not available for Python 3.13+", allow_module_level=True) + from google.cloud.aiplatform.tensorboard import logdir_loader import tensorflow as tf diff --git a/tests/unit/aiplatform/test_uploader_utils.py b/tests/unit/aiplatform/test_uploader_utils.py index bb11d92128..6b11986aa8 100644 --- a/tests/unit/aiplatform/test_uploader_utils.py +++ b/tests/unit/aiplatform/test_uploader_utils.py @@ -20,6 +20,13 @@ from unittest import mock from absl.testing import absltest +import sys + +import pytest + +if sys.version_info >= (3, 13): + pytest.skip("Tensorboard not available for Python 3.13+", allow_module_level=True) + from google.cloud.aiplatform.tensorboard import uploader_utils