Skip to content

Commit 5802b55

Browse files
authored
feat: Add support for Python 3.14 (#14723)
Towards b/375664027
1 parent 435f822 commit 5802b55

File tree

10 files changed

+54
-6
lines changed

10 files changed

+54
-6
lines changed

packages/google-apps-script-type/noxfile.py

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,15 @@
3535
"3.11",
3636
"3.12",
3737
"3.13",
38+
"3.14",
3839
]
3940

40-
DEFAULT_PYTHON_VERSION = ALL_PYTHON[-1]
41+
DEFAULT_PYTHON_VERSION = "3.14"
42+
43+
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2450):
44+
# Switch this to Python 3.15 alpha1
45+
# https://peps.python.org/pep-0790/
46+
PREVIEW_PYTHON_VERSION = "3.14"
4147

4248
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
4349

@@ -57,7 +63,7 @@
5763
UNIT_TEST_EXTRAS: List[str] = []
5864
UNIT_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {}
5965

60-
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
66+
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ALL_PYTHON
6167
SYSTEM_TEST_STANDARD_DEPENDENCIES = [
6268
"mock",
6369
"pytest",
@@ -222,15 +228,22 @@ def install_unittest_dependencies(session, *constraints):
222228
def unit(session, protobuf_implementation):
223229
# Install all test dependencies, then install this package in-place.
224230

225-
if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"):
231+
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2388):
232+
# Remove this check once support for Protobuf 3.x is dropped.
233+
if protobuf_implementation == "cpp" and session.python in (
234+
"3.11",
235+
"3.12",
236+
"3.13",
237+
"3.14",
238+
):
226239
session.skip("cpp implementation is not supported in python 3.11+")
227240

228241
constraints_path = str(
229242
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
230243
)
231244
install_unittest_dependencies(session, "-c", constraints_path)
232245

233-
# TODO(https://github.com/googleapis/synthtool/issues/1976):
246+
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2388):
234247
# Remove the 'cpp' implementation once support for Protobuf 3.x is dropped.
235248
# The 'cpp' implementation requires Protobuf<4.
236249
if protobuf_implementation == "cpp":
@@ -420,7 +433,7 @@ def docfx(session):
420433
)
421434

422435

423-
@nox.session(python=DEFAULT_PYTHON_VERSION)
436+
@nox.session(python=PREVIEW_PYTHON_VERSION)
424437
@nox.parametrize(
425438
"protobuf_implementation",
426439
["python", "upb", "cpp"],
@@ -433,7 +446,14 @@ def prerelease_deps(session, protobuf_implementation):
433446
`pip install --pre <package>`.
434447
"""
435448

436-
if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"):
449+
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2388):
450+
# Remove this check once support for Protobuf 3.x is dropped.
451+
if protobuf_implementation == "cpp" and session.python in (
452+
"3.11",
453+
"3.12",
454+
"3.13",
455+
"3.14",
456+
):
437457
session.skip("cpp implementation is not supported in python 3.11+")
438458

439459
# Install all dependencies

packages/google-apps-script-type/setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
# Exclude incompatible versions of `google-auth`
4444
# See https://github.com/googleapis/google-cloud-python/issues/12364
4545
"google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0",
46+
"grpcio >= 1.33.2, < 2.0.0",
47+
"grpcio >= 1.75.1, < 2.0.0; python_version >= '3.14'",
4648
"proto-plus >= 1.22.3, <2.0.0",
4749
"proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'",
4850
"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 @@
8486
"Programming Language :: Python :: 3.11",
8587
"Programming Language :: Python :: 3.12",
8688
"Programming Language :: Python :: 3.13",
89+
"Programming Language :: Python :: 3.14",
8790
"Operating System :: OS Independent",
8891
"Topic :: Internet",
8992
],

packages/google-apps-script-type/testing/constraints-3.10.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
# This constraints file is required for unit tests.
33
# List all library dependencies and extras in this file.
44
google-api-core
5+
google-auth
6+
grpcio
57
proto-plus
68
protobuf

packages/google-apps-script-type/testing/constraints-3.11.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
# This constraints file is required for unit tests.
33
# List all library dependencies and extras in this file.
44
google-api-core
5+
google-auth
6+
grpcio
57
proto-plus
68
protobuf

packages/google-apps-script-type/testing/constraints-3.12.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
# This constraints file is required for unit tests.
33
# List all library dependencies and extras in this file.
44
google-api-core
5+
google-auth
6+
grpcio
57
proto-plus
68
protobuf

packages/google-apps-script-type/testing/constraints-3.13.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
# Then this file should have google-cloud-foo>=1
88
google-api-core>=2
99
google-auth>=2
10+
grpcio>=1
1011
proto-plus>=1
1112
protobuf>=6
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# We use the constraints file for the latest Python version
2+
# (currently this file) to check that the latest
3+
# major versions of dependencies are supported in setup.py.
4+
# List all library dependencies and extras in this file.
5+
# Require the latest major version be installed for each dependency.
6+
# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0",
7+
# Then this file should have google-cloud-foo>=1
8+
google-api-core>=2
9+
google-auth>=2
10+
grpcio>=1
11+
proto-plus>=1
12+
protobuf>=6

packages/google-apps-script-type/testing/constraints-3.7.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@
66
# Then this file should have google-cloud-foo==1.14.0
77
google-api-core==1.34.1
88
google-auth==2.14.1
9+
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2453)
10+
# Add the minimum supported version of grpcio to constraints files
911
proto-plus==1.22.3
1012
protobuf==3.20.2

packages/google-apps-script-type/testing/constraints-3.8.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
# This constraints file is required for unit tests.
33
# List all library dependencies and extras in this file.
44
google-api-core
5+
google-auth
6+
grpcio
57
proto-plus
68
protobuf

packages/google-apps-script-type/testing/constraints-3.9.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
# This constraints file is required for unit tests.
33
# List all library dependencies and extras in this file.
44
google-api-core
5+
google-auth
6+
grpcio
57
proto-plus
68
protobuf

0 commit comments

Comments
 (0)