Skip to content

Commit 7e30073

Browse files
chalmerlowegcf-owl-bot[bot]sinhasubhamsurbhigarg92
authored
chore(python): Add support for Python 3.14 (#1456)
This PR adds support for Python 3.14 to the library. Key changes include: Key changes include: - Updates to `owlbot.py` to include Python 3.14. - Adding Python 3.14 to the test matrix in `.github/workflows/presubmit.yaml`. - Verified `setup.py` includes the Python 3.14 classifier. - Verified `CONTRIBUTING.rst` includes Python 3.14. - Verified `noxfile.py` updates for 3.14. - Updated Kokoro configurations in `.kokoro/presubmit/` to use `system-3.14` session. - Updated `librarian.py` to account for post-processing. - Fixed a concurrency issue in `tests/unit/test_spanner.py` to make the test suite pass on Python 3.14. Towards internal issue: b/375664027 --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: gcf-owl-bot[bot] <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Subham Sinha <35077434+sinhasubham@users.noreply.github.com> Co-authored-by: surbhigarg92 <surbhigarg.92@gmail.com>
1 parent f1ebc43 commit 7e30073

File tree

12 files changed

+90
-82
lines changed

12 files changed

+90
-82
lines changed

.github/workflows/integration-tests-against-emulator-with-regular-session.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Setup Python
2222
uses: actions/setup-python@v6
2323
with:
24-
python-version: 3.13
24+
python-version: 3.14
2525
- name: Install nox
2626
run: python -m pip install nox
2727
- name: Run system tests

.github/workflows/integration-tests-against-emulator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Setup Python
2222
uses: actions/setup-python@v6
2323
with:
24-
python-version: 3.13
24+
python-version: 3.14
2525
- name: Install nox
2626
run: python -m pip install nox
2727
- name: Run system tests

.github/workflows/mock_server_tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Setup Python
1515
uses: actions/setup-python@v6
1616
with:
17-
python-version: 3.13
17+
python-version: 3.14
1818
- name: Install nox
1919
run: python -m pip install nox
2020
- name: Run mock server tests

.github/workflows/presubmit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
strategy:
2828
fail-fast: false
2929
matrix:
30-
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
30+
python: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
3131

3232
steps:
3333
- name: Checkout code

.kokoro/presubmit/integration-regular-sessions-enabled.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Only run a subset of all nox sessions
44
env_vars: {
55
key: "NOX_SESSION"
6-
value: "unit-3.9 unit-3.12 system-3.12"
6+
value: "unit-3.9 unit-3.14 system-3.14"
77
}
88

99
env_vars: {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
# Only run this nox session.
44
env_vars: {
55
key: "NOX_SESSION"
6-
value: "system-3.12"
7-
}
6+
value: "system-3.14"
7+
}

.librarian/generator-input/librarian.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@
209209
cov_level=98,
210210
split_system_tests=True,
211211
system_test_extras=["tracing"],
212-
system_test_python_versions=["3.12"]
212+
system_test_python_versions=["3.12"],
213+
unit_test_python_versions=["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
213214
)
214215
s.move(
215216
templated_files,
@@ -224,6 +225,12 @@
224225
# Update samples folder in CONTRIBUTING.rst
225226
s.replace("CONTRIBUTING.rst", "samples/snippets", "samples/samples")
226227

228+
s.replace(
229+
"noxfile.py",
230+
'''session.python in \("3.11", "3.12", "3.13"\)''',
231+
'''session.python in ("3.11", "3.12", "3.13", "3.14")'''
232+
)
233+
227234
# ----------------------------------------------------------------------------
228235
# Samples templates
229236
# ----------------------------------------------------------------------------

CONTRIBUTING.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,14 @@ We support:
226226
- `Python 3.11`_
227227
- `Python 3.12`_
228228
- `Python 3.13`_
229+
- `Python 3.14`_
229230

230231
.. _Python 3.9: https://docs.python.org/3.9/
231232
.. _Python 3.10: https://docs.python.org/3.10/
232233
.. _Python 3.11: https://docs.python.org/3.11/
233234
.. _Python 3.12: https://docs.python.org/3.12/
234235
.. _Python 3.13: https://docs.python.org/3.13/
236+
.. _Python 3.14: https://docs.python.org/3.14/
235237

236238

237239
Supported versions can be found in our ``noxfile.py`` `config`_.

noxfile.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@
3535
DEFAULT_PYTHON_VERSION = "3.14"
3636

3737
DEFAULT_MOCK_SERVER_TESTS_PYTHON_VERSION = "3.12"
38-
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.12"]
38+
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.14"]
3939

4040
UNIT_TEST_PYTHON_VERSIONS: List[str] = [
4141
"3.9",
4242
"3.10",
4343
"3.11",
4444
"3.12",
4545
"3.13",
46+
"3.14",
4647
]
4748
UNIT_TEST_STANDARD_DEPENDENCIES = [
4849
"mock",
@@ -81,6 +82,7 @@
8182
"unit-3.11",
8283
"unit-3.12",
8384
"unit-3.13",
85+
"unit-3.14",
8486
"system",
8587
"cover",
8688
"lint",
@@ -195,7 +197,12 @@ def install_unittest_dependencies(session, *constraints):
195197
def unit(session, protobuf_implementation):
196198
# Install all test dependencies, then install this package in-place.
197199

198-
if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"):
200+
if protobuf_implementation == "cpp" and session.python in (
201+
"3.11",
202+
"3.12",
203+
"3.13",
204+
"3.14",
205+
):
199206
session.skip("cpp implementation is not supported in python 3.11+")
200207

201208
constraints_path = str(
@@ -213,6 +220,7 @@ def unit(session, protobuf_implementation):
213220
session.run(
214221
"py.test",
215222
"--quiet",
223+
"-s",
216224
f"--junitxml=unit_{session.python}_sponge_log.xml",
217225
"--cov=google",
218226
"--cov=tests/unit",
@@ -326,7 +334,12 @@ def system(session, protobuf_implementation, database_dialect):
326334
"Only run system tests on real Spanner with one protobuf implementation to speed up the build"
327335
)
328336

329-
if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"):
337+
if protobuf_implementation == "cpp" and session.python in (
338+
"3.11",
339+
"3.12",
340+
"3.13",
341+
"3.14",
342+
):
330343
session.skip("cpp implementation is not supported in python 3.11+")
331344

332345
# Install pyopenssl for mTLS testing.
@@ -470,7 +483,7 @@ def docfx(session):
470483
)
471484

472485

473-
@nox.session(python="3.13")
486+
@nox.session(python="3.14")
474487
@nox.parametrize(
475488
"protobuf_implementation,database_dialect",
476489
[
@@ -485,7 +498,12 @@ def docfx(session):
485498
def prerelease_deps(session, protobuf_implementation, database_dialect):
486499
"""Run all tests with prerelease versions of dependencies installed."""
487500

488-
if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"):
501+
if protobuf_implementation == "cpp" and session.python in (
502+
"3.11",
503+
"3.12",
504+
"3.13",
505+
"3.14",
506+
):
489507
session.skip("cpp implementation is not supported in python 3.11+")
490508

491509
# Install all dependencies

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
"Programming Language :: Python :: 3.10",
8888
"Programming Language :: Python :: 3.11",
8989
"Programming Language :: Python :: 3.12",
90+
"Programming Language :: Python :: 3.14",
9091
"Operating System :: OS Independent",
9192
"Topic :: Internet",
9293
],

0 commit comments

Comments
 (0)