From 0271915971b68c2eb4b5cc6119dd740b8a6e2c0b Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 15 Oct 2025 15:05:36 +0000 Subject: [PATCH] feat: Add support for Python 3.14 --- packages/google-apps-script-type/noxfile.py | 32 +++++++++++++++---- packages/google-apps-script-type/setup.py | 3 ++ .../testing/constraints-3.10.txt | 2 ++ .../testing/constraints-3.11.txt | 2 ++ .../testing/constraints-3.12.txt | 2 ++ .../testing/constraints-3.13.txt | 1 + .../testing/constraints-3.14.txt | 12 +++++++ .../testing/constraints-3.7.txt | 2 ++ .../testing/constraints-3.8.txt | 2 ++ .../testing/constraints-3.9.txt | 2 ++ 10 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 packages/google-apps-script-type/testing/constraints-3.14.txt diff --git a/packages/google-apps-script-type/noxfile.py b/packages/google-apps-script-type/noxfile.py index 3474f2ff6787..3880fe307568 100644 --- a/packages/google-apps-script-type/noxfile.py +++ b/packages/google-apps-script-type/noxfile.py @@ -35,9 +35,15 @@ "3.11", "3.12", "3.13", + "3.14", ] -DEFAULT_PYTHON_VERSION = ALL_PYTHON[-1] +DEFAULT_PYTHON_VERSION = "3.14" + +# TODO(https://github.com/googleapis/gapic-generator-python/issues/2450): +# Switch this to Python 3.15 alpha1 +# https://peps.python.org/pep-0790/ +PREVIEW_PYTHON_VERSION = "3.14" CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -57,7 +63,7 @@ UNIT_TEST_EXTRAS: List[str] = [] UNIT_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {} -SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] +SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ALL_PYTHON SYSTEM_TEST_STANDARD_DEPENDENCIES = [ "mock", "pytest", @@ -222,7 +228,14 @@ def install_unittest_dependencies(session, *constraints): def unit(session, protobuf_implementation): # Install all test dependencies, then install this package in-place. - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"): + # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): + # Remove this check once support for Protobuf 3.x is dropped. + if protobuf_implementation == "cpp" and session.python in ( + "3.11", + "3.12", + "3.13", + "3.14", + ): session.skip("cpp implementation is not supported in python 3.11+") constraints_path = str( @@ -230,7 +243,7 @@ def unit(session, protobuf_implementation): ) install_unittest_dependencies(session, "-c", constraints_path) - # TODO(https://github.com/googleapis/synthtool/issues/1976): + # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): # Remove the 'cpp' implementation once support for Protobuf 3.x is dropped. # The 'cpp' implementation requires Protobuf<4. if protobuf_implementation == "cpp": @@ -420,7 +433,7 @@ def docfx(session): ) -@nox.session(python=DEFAULT_PYTHON_VERSION) +@nox.session(python=PREVIEW_PYTHON_VERSION) @nox.parametrize( "protobuf_implementation", ["python", "upb", "cpp"], @@ -433,7 +446,14 @@ def prerelease_deps(session, protobuf_implementation): `pip install --pre `. """ - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"): + # TODO(https://github.com/googleapis/gapic-generator-python/issues/2388): + # Remove this check once support for Protobuf 3.x is dropped. + if protobuf_implementation == "cpp" and session.python in ( + "3.11", + "3.12", + "3.13", + "3.14", + ): session.skip("cpp implementation is not supported in python 3.11+") # Install all dependencies diff --git a/packages/google-apps-script-type/setup.py b/packages/google-apps-script-type/setup.py index 2a6034d397c1..bf3c1d89124b 100644 --- a/packages/google-apps-script-type/setup.py +++ b/packages/google-apps-script-type/setup.py @@ -43,6 +43,8 @@ # Exclude incompatible versions of `google-auth` # See https://github.com/googleapis/google-cloud-python/issues/12364 "google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0", + "grpcio >= 1.33.2, < 2.0.0", + "grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'", "proto-plus >= 1.22.3, <2.0.0", "proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'", "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", @@ -84,6 +86,7 @@ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Operating System :: OS Independent", "Topic :: Internet", ], diff --git a/packages/google-apps-script-type/testing/constraints-3.10.txt b/packages/google-apps-script-type/testing/constraints-3.10.txt index ed7f9aed2559..93e6826f2af9 100644 --- a/packages/google-apps-script-type/testing/constraints-3.10.txt +++ b/packages/google-apps-script-type/testing/constraints-3.10.txt @@ -2,5 +2,7 @@ # This constraints file is required for unit tests. # List all library dependencies and extras in this file. google-api-core +google-auth +grpcio proto-plus protobuf diff --git a/packages/google-apps-script-type/testing/constraints-3.11.txt b/packages/google-apps-script-type/testing/constraints-3.11.txt index ed7f9aed2559..93e6826f2af9 100644 --- a/packages/google-apps-script-type/testing/constraints-3.11.txt +++ b/packages/google-apps-script-type/testing/constraints-3.11.txt @@ -2,5 +2,7 @@ # This constraints file is required for unit tests. # List all library dependencies and extras in this file. google-api-core +google-auth +grpcio proto-plus protobuf diff --git a/packages/google-apps-script-type/testing/constraints-3.12.txt b/packages/google-apps-script-type/testing/constraints-3.12.txt index ed7f9aed2559..93e6826f2af9 100644 --- a/packages/google-apps-script-type/testing/constraints-3.12.txt +++ b/packages/google-apps-script-type/testing/constraints-3.12.txt @@ -2,5 +2,7 @@ # This constraints file is required for unit tests. # List all library dependencies and extras in this file. google-api-core +google-auth +grpcio proto-plus protobuf diff --git a/packages/google-apps-script-type/testing/constraints-3.13.txt b/packages/google-apps-script-type/testing/constraints-3.13.txt index c20a77817caa..1e93c60e50aa 100644 --- a/packages/google-apps-script-type/testing/constraints-3.13.txt +++ b/packages/google-apps-script-type/testing/constraints-3.13.txt @@ -7,5 +7,6 @@ # Then this file should have google-cloud-foo>=1 google-api-core>=2 google-auth>=2 +grpcio>=1 proto-plus>=1 protobuf>=6 diff --git a/packages/google-apps-script-type/testing/constraints-3.14.txt b/packages/google-apps-script-type/testing/constraints-3.14.txt new file mode 100644 index 000000000000..1e93c60e50aa --- /dev/null +++ b/packages/google-apps-script-type/testing/constraints-3.14.txt @@ -0,0 +1,12 @@ +# We use the constraints file for the latest Python version +# (currently this file) to check that the latest +# major versions of dependencies are supported in setup.py. +# List all library dependencies and extras in this file. +# Require the latest major version be installed for each dependency. +# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0", +# Then this file should have google-cloud-foo>=1 +google-api-core>=2 +google-auth>=2 +grpcio>=1 +proto-plus>=1 +protobuf>=6 diff --git a/packages/google-apps-script-type/testing/constraints-3.7.txt b/packages/google-apps-script-type/testing/constraints-3.7.txt index a77f12bc13e4..5d29dea38698 100644 --- a/packages/google-apps-script-type/testing/constraints-3.7.txt +++ b/packages/google-apps-script-type/testing/constraints-3.7.txt @@ -6,5 +6,7 @@ # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.34.1 google-auth==2.14.1 +# TODO(https://github.com/googleapis/gapic-generator-python/issues/2453) +# Add the minimum supported version of grpcio to constraints files proto-plus==1.22.3 protobuf==3.20.2 diff --git a/packages/google-apps-script-type/testing/constraints-3.8.txt b/packages/google-apps-script-type/testing/constraints-3.8.txt index ed7f9aed2559..93e6826f2af9 100644 --- a/packages/google-apps-script-type/testing/constraints-3.8.txt +++ b/packages/google-apps-script-type/testing/constraints-3.8.txt @@ -2,5 +2,7 @@ # This constraints file is required for unit tests. # List all library dependencies and extras in this file. google-api-core +google-auth +grpcio proto-plus protobuf diff --git a/packages/google-apps-script-type/testing/constraints-3.9.txt b/packages/google-apps-script-type/testing/constraints-3.9.txt index ed7f9aed2559..93e6826f2af9 100644 --- a/packages/google-apps-script-type/testing/constraints-3.9.txt +++ b/packages/google-apps-script-type/testing/constraints-3.9.txt @@ -2,5 +2,7 @@ # This constraints file is required for unit tests. # List all library dependencies and extras in this file. google-api-core +google-auth +grpcio proto-plus protobuf