Skip to content

Commit db286c4

Browse files
speedstorm1copybara-github
authored andcommitted
feat: add support for Python v3.13
PiperOrigin-RevId: 822257006
1 parent ce35218 commit db286c4

File tree

10 files changed

+65
-15
lines changed

10 files changed

+65
-15
lines changed

.github/sync-repo-settings.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ branchProtectionRules:
2020
- 'Presubmit - Unit Tests Python 3.10'
2121
- 'Presubmit - Unit Tests Python 3.11'
2222
- 'Presubmit - Unit Tests Python 3.12'
23+
- 'Presubmit - Unit Tests Python 3.13'
2324
- 'Presubmit - Unit Tests Ray 2.9.3'
2425
- 'Presubmit - Unit Tests Ray 2.33.0'
2526
- 'Presubmit - Unit Tests Ray 2.42.0 (Python 3.10)'
2627
- 'Presubmit - Unit Tests Ray 2.42.0 (Python 3.11)'
2728
- 'Presubmit - Unit Tests Ray 2.47.1 (Python 3.11)'
2829
- 'Presubmit - Unit Tests LangChain (Python 3.9)'
2930
- 'Presubmit - Unit Tests LangChain (Python 3.10)'
30-
- 'Presubmit - Unit Tests LangChain (Python 3.11)'
31+
- 'Presubmit - Unit Tests LangChain (Python 3.11)'
32+
- 'Presubmit - Unit Tests LangChain (Python 3.12)'
33+
- 'Presubmit - Unit Tests LangChain (Python 3.13)'

.github/workflows/mypy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
strategy:
1818
matrix:
19-
python-version: ['3.9', '3.10', '3.11', '3.12']
19+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
2020

2121
steps:
2222
- name: Checkout code

noxfile.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@
5151
"recommonmark",
5252
)
5353

54-
UNIT_TEST_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12"]
55-
UNIT_TEST_LANGCHAIN_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12"]
56-
UNIT_TEST_AG2_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12"]
57-
UNIT_TEST_LLAMA_INDEX_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12"]
54+
UNIT_TEST_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"]
55+
UNIT_TEST_LANGCHAIN_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"]
56+
UNIT_TEST_AG2_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"]
57+
UNIT_TEST_LLAMA_INDEX_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"]
5858
PYTHON_TO_RAY_VERSIONS = {
5959
"3.10": ["2.9.3", "2.33.0", "2.42.0"],
6060
"3.11": ["2.42.0", "2.47.1"],

owlbot.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
templated_files = common.py_library(
100100
cov_level=98,
101101
system_test_python_versions=["3.9"],
102-
unit_test_python_versions=["3.9", "3.10", "3.11", "3.12"],
102+
unit_test_python_versions=["3.9", "3.10", "3.11", "3.12", "3.13"],
103103
unit_test_extras=["testing"],
104104
system_test_extras=["testing"],
105105
microgenerator=True,
@@ -126,10 +126,12 @@
126126
".kokoro/samples/python3.10/common.cfg",
127127
".kokoro/samples/python3.11/common.cfg",
128128
".kokoro/samples/python3.12/common.cfg",
129+
".kokoro/samples/python3.13/common.cfg",
129130
".kokoro/samples/python3.9/periodic.cfg",
130131
".kokoro/samples/python3.10/periodic.cfg",
131132
".kokoro/samples/python3.11/periodic.cfg",
132133
".kokoro/samples/python3.12/periodic.cfg",
134+
".kokoro/samples/python3.13/periodic.cfg",
133135
".github/auto-label.yaml",
134136
".github/blunderbuss.yml",
135137
".github/CODEOWNERS",

setup.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@
5353
tensorboard_extra_require = profiler_extra_require
5454

5555
metadata_extra_require = ["pandas >= 1.0.0", "numpy>=1.15.0"]
56-
xai_extra_require = ["tensorflow >=2.3.0, <3.0.0"]
56+
xai_extra_require = ["tensorflow >=2.3.0, <3.0.0; python_version<'3.13'"]
5757
lit_extra_require = [
58-
"tensorflow >= 2.3.0, <3.0.0",
58+
"tensorflow >= 2.3.0, <3.0.0; python_version<'3.13'",
5959
"pandas >= 1.0.0",
6060
"lit-nlp == 0.4.0",
61-
"explainable-ai-sdk >= 1.0.0",
61+
"explainable-ai-sdk >= 1.0.0; python_version<'3.13'",
6262
]
6363
featurestore_extra_require = [
6464
"google-cloud-bigquery-storage",
@@ -131,7 +131,7 @@
131131
"ray[train]",
132132
# Framework version constraints copied from testing_extra_require
133133
"scikit-learn<1.6.0",
134-
"tensorflow",
134+
"tensorflow; python_version<'3.13'",
135135
"torch >= 2.0.0, < 2.1.0",
136136
"xgboost",
137137
"xgboost_ray",
@@ -250,20 +250,23 @@
250250
# google-api-core 2.x is required since kfp requires protobuf > 4
251251
"google-api-core >= 2.11, < 3.0.0",
252252
"grpcio-testing",
253+
"grpcio-tools >= 1.63.0; python_version>='3.13'",
253254
"ipython",
254-
"kfp >= 2.6.0, < 3.0.0",
255+
"kfp >= 2.6.0, < 3.0.0; python_version<'3.13'",
255256
"pytest-asyncio",
257+
"pytest-cov",
258+
"mock",
256259
"pytest-xdist",
257260
"scikit-learn<1.6.0; python_version<='3.10'",
258261
"scikit-learn; python_version>'3.10'",
259262
# Lazy import requires > 2.12.0
260263
"tensorflow == 2.14.1; python_version<='3.11'",
261-
"tensorflow == 2.19.0; python_version>'3.11'",
264+
"tensorflow == 2.19.0; python_version>'3.11' and python_version<'3.13'",
262265
"protobuf <= 5.29.4",
263266
# TODO(jayceeli) torch 2.1.0 has conflict with pyfakefs, will check if
264267
# future versions fix this issue
265268
"torch >= 2.0.0, < 2.1.0; python_version<='3.11'",
266-
"torch >= 2.2.0; python_version>'3.11'",
269+
"torch >= 2.2.0; python_version>'3.11' and python_version<'3.13'",
267270
"requests-toolbelt <= 1.0.0",
268271
"immutabledict",
269272
"xgboost",
@@ -300,7 +303,8 @@
300303
"proto-plus >= 1.22.3, <2.0.0",
301304
"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",
302305
"packaging >= 14.3",
303-
"google-cloud-storage >= 1.32.0, < 3.0.0",
306+
"google-cloud-storage >= 1.32.0, < 3.0.0; python_version<'3.13'",
307+
"google-cloud-storage >= 2.10.0, < 3.0.0; python_version>='3.13'",
304308
"google-cloud-bigquery >= 1.15.0, < 4.0.0, !=3.20.0",
305309
"google-cloud-resource-manager >= 1.3.3, < 3.0.0",
306310
"shapely < 3.0.0",
@@ -348,6 +352,7 @@
348352
"Programming Language :: Python :: 3.10",
349353
"Programming Language :: Python :: 3.11",
350354
"Programming Language :: Python :: 3.12",
355+
"Programming Language :: Python :: 3.13",
351356
"Topic :: Internet",
352357
"Topic :: Software Development :: Libraries :: Python Modules",
353358
],

testing/constraints-3.13.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# -*- coding: utf-8 -*-
2+
# This constraints file is required for unit tests.
3+
# List all library dependencies and extras in this file.
4+
google-api-core==2.21.0 # Tests google-api-core with rest async support
5+
google-auth==2.35.0 # Tests google-auth with rest async support
6+
proto-plus
7+
mock==4.0.2
8+
google-cloud-storage==2.10.0 # Increased for kfp 2.0 compatibility
9+
packaging==24.1 # Increased to unbreak canonicalize_version error (b/377774673)
10+
pytest-xdist==3.3.1 # Pinned to unbreak unit tests
11+
ray==2.5.0 # Pinned until 2.9.3 is verified for Ray tests
12+
ipython==8.22.2 # Pinned to unbreak TypeAliasType import error
13+
google-adk==0.0.2
14+
google-genai>=1.10.0
15+
google-vizier==0.1.21

tests/unit/aiplatform/test_explain_saved_model_metadata_builder_tf1_test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
#
1717

1818
import pytest
19+
import sys
20+
21+
if sys.version_info >= (3, 13):
22+
pytest.skip("Tensorflow not available for Python 3.13+", allow_module_level=True)
23+
1924
import tensorflow.compat.v1 as tf
2025

2126
from google.cloud.aiplatform import models
@@ -27,6 +32,7 @@
2732

2833

2934
@pytest.mark.usefixtures("google_auth_mock")
35+
@pytest.mark.skipif(tf is None, reason="Tensorflow not available for Python 3.13+")
3036
class SavedModelMetadataBuilderTF1Test(tf.test.TestCase):
3137
def _set_up(self):
3238
self.sess = tf.Session(graph=tf.Graph())

tests/unit/aiplatform/test_explain_saved_model_metadata_builder_tf2_test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
#
1717

1818
import pytest
19+
import sys
20+
21+
if sys.version_info >= (3, 13):
22+
pytest.skip("Tensorflow not available for Python 3.13+", allow_module_level=True)
23+
1924
import tensorflow as tf
2025
import numpy as np
2126

tests/unit/aiplatform/test_logdir_loader.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121
import shutil
2222
import tempfile
2323

24+
import sys
25+
26+
import pytest
27+
28+
if sys.version_info >= (3, 13):
29+
pytest.skip("Tensorflow not available for Python 3.13+", allow_module_level=True)
30+
2431
from google.cloud.aiplatform.tensorboard import logdir_loader
2532
import tensorflow as tf
2633

tests/unit/aiplatform/test_uploader_utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020
from unittest import mock
2121

2222
from absl.testing import absltest
23+
import sys
24+
25+
import pytest
26+
27+
if sys.version_info >= (3, 13):
28+
pytest.skip("Tensorboard not available for Python 3.13+", allow_module_level=True)
29+
2330
from google.cloud.aiplatform.tensorboard import uploader_utils
2431

2532

0 commit comments

Comments
 (0)