From 4618729e9b41163cda3056a3fde497a0c0d7178f Mon Sep 17 00:00:00 2001 From: Ayush Agrawal Date: Tue, 28 Oct 2025 16:34:56 -0700 Subject: [PATCH] feat: add initial support for Python v3.14 PiperOrigin-RevId: 825257152 --- .github/sync-repo-settings.yaml | 1 + .github/workflows/mypy.yml | 2 +- .kokoro/presubmit/unit_3-14.cfg | 13 +++++++++++++ noxfile.py | 8 ++++---- owlbot.py | 2 +- setup.py | 6 ++++-- testing/constraints-3.14.txt | 16 ++++++++++++++++ 7 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 .kokoro/presubmit/unit_3-14.cfg create mode 100644 testing/constraints-3.14.txt diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index 3d243becde..6f0623238b 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -21,6 +21,7 @@ branchProtectionRules: - 'Presubmit - Unit Tests Python 3.11' - 'Presubmit - Unit Tests Python 3.12' - 'Presubmit - Unit Tests Python 3.13' + - 'Presubmit - Unit Tests Python 3.14' - 'Presubmit - Unit Tests Ray 2.9.3' - 'Presubmit - Unit Tests Ray 2.33.0' - 'Presubmit - Unit Tests Ray 2.42.0 (Python 3.10)' diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 5f5db93807..696465849a 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', '3.13'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] steps: - name: Checkout code diff --git a/.kokoro/presubmit/unit_3-14.cfg b/.kokoro/presubmit/unit_3-14.cfg new file mode 100644 index 0000000000..9016ae932b --- /dev/null +++ b/.kokoro/presubmit/unit_3-14.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Run unit tests for Python 3.14 +env_vars: { + key: "NOX_SESSION" + value: "unit-3.14" +} + +# Run unit tests in parallel, splitting up by file +env_vars: { + key: "PYTEST_ADDOPTS" + value: "-n=auto --dist=loadscope" +} diff --git a/noxfile.py b/noxfile.py index aa95bf9992..de5801f370 100644 --- a/noxfile.py +++ b/noxfile.py @@ -53,10 +53,10 @@ "recommonmark", ) -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"] +UNIT_TEST_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] +UNIT_TEST_LANGCHAIN_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] +UNIT_TEST_AG2_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] +UNIT_TEST_LLAMA_INDEX_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] 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 3502167e14..569c043bfa 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", "3.13"], + unit_test_python_versions=["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"], unit_test_extras=["testing"], system_test_extras=["testing"], microgenerator=True, diff --git a/setup.py b/setup.py index b973f6935f..8e5e3e62c8 100644 --- a/setup.py +++ b/setup.py @@ -57,7 +57,7 @@ lit_extra_require = [ "tensorflow >= 2.3.0, <3.0.0; python_version<'3.13'", "pandas >= 1.0.0", - "lit-nlp == 0.4.0", + "lit-nlp == 0.4.0; python_version<'3.14'", "explainable-ai-sdk >= 1.0.0; python_version<'3.13'", ] featurestore_extra_require = [ @@ -249,7 +249,7 @@ # aiohttp is required for async rest tests (need google-auth[aiohttp], # but can't specify extras in constraints files) "aiohttp", - "bigframes; python_version>='3.10'", + "bigframes; python_version>='3.10' and python_version<'3.14'", # google-api-core 2.x is required since kfp requires protobuf > 4 "google-api-core >= 2.11, < 3.0.0", "grpcio-testing", @@ -260,6 +260,7 @@ "pytest-cov", "mock", "pytest-xdist", + "Pillow", "scikit-learn<1.6.0; python_version<='3.10'", "scikit-learn; python_version>'3.10'", # Lazy import requires > 2.12.0 @@ -356,6 +357,7 @@ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Topic :: Internet", "Topic :: Software Development :: Libraries :: Python Modules", ], diff --git a/testing/constraints-3.14.txt b/testing/constraints-3.14.txt new file mode 100644 index 0000000000..a1fae03754 --- /dev/null +++ b/testing/constraints-3.14.txt @@ -0,0 +1,16 @@ +# -*- 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 +pyarrow>=18.0.0 \ No newline at end of file