Skip to content

Commit 6be3df6

Browse files
daniel-sancheohmayrgcf-owl-bot[bot]gkevinzhengparthea
authored
feat: Add support for python 3.14 (#1065)
This PR adds python 3.14 support to the python-logging package. Expanding off of Omair's work here: #1055 --------- Co-authored-by: ohmayr <omairn@google.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Kevin Zheng <kevzheng@google.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 36fb427 commit 6be3df6

File tree

13 files changed

+141
-22
lines changed

13 files changed

+141
-22
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Build logs will be here
4+
action {
5+
define_artifacts {
6+
regex: "**/*sponge_log.xml"
7+
}
8+
}
9+
10+
# Specify which tests to run
11+
env_vars: {
12+
key: "RUN_TESTS_SESSION"
13+
value: "py-3.14"
14+
}
15+
16+
# Declare build specific Cloud project.
17+
env_vars: {
18+
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
19+
value: "python-docs-samples-tests-314"
20+
}
21+
22+
env_vars: {
23+
key: "TRAMPOLINE_BUILD_FILE"
24+
value: "github/python-logging/.kokoro/test-samples.sh"
25+
}
26+
27+
# Configure the docker image for kokoro-trampoline.
28+
env_vars: {
29+
key: "TRAMPOLINE_IMAGE"
30+
value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
31+
}
32+
33+
# Download secrets for samples
34+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
35+
36+
# Download trampoline resources.
37+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
38+
39+
# Use the trampoline script to run in docker.
40+
build_file: "python-logging/.kokoro/trampoline_v2.sh"
41+
42+
43+
#############################################
44+
# this section merged from .kokoro/common_env_vars.cfg using owlbot.py
45+
46+
env_vars: {
47+
key: "PRODUCT_AREA_LABEL"
48+
value: "observability"
49+
}
50+
env_vars: {
51+
key: "PRODUCT_LABEL"
52+
value: "logging"
53+
}
54+
env_vars: {
55+
key: "LANGUAGE_LABEL"
56+
value: "python"
57+
}
58+
59+
###################################################
60+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "True"
6+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "True"
6+
}
7+
8+
env_vars: {
9+
key: "TRAMPOLINE_BUILD_FILE"
10+
value: "github/python-logging/.kokoro/test-samples-against-head.sh"
11+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "False"
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "True"
6+
}

.librarian/generator-input/librarian.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ def place_before(path, text, *before_text, escape=None):
9696
"google-cloud-testutils",
9797
"opentelemetry-sdk"
9898
],
99-
system_test_python_versions=["3.12"],
99+
system_test_python_versions=["3.14"],
100+
unit_test_python_versions=["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"],
100101
unit_test_external_dependencies=["flask", "webob", "django"],
101102
samples=True,
102103
)

CONTRIBUTING.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ In order to add a feature:
2222
documentation.
2323

2424
- The feature must work fully on the following CPython versions:
25-
3.7, 3.8, 3.9, 3.10, 3.11, 3.12 and 3.13 on both UNIX and Windows.
25+
3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13 and 3.14 on both UNIX and Windows.
2626

2727
- The feature must not add unnecessary dependencies (where
2828
"unnecessary" is of course subjective, but new dependencies should
@@ -72,7 +72,7 @@ We use `nox <https://nox.readthedocs.io/en/latest/>`__ to instrument our tests.
7272

7373
- To run a single unit test::
7474

75-
$ nox -s unit-3.13 -- -k <name of test>
75+
$ nox -s unit-3.14 -- -k <name of test>
7676

7777

7878
.. note::
@@ -143,12 +143,12 @@ Running System Tests
143143
$ nox -s system
144144

145145
# Run a single system test
146-
$ nox -s system-3.12 -- -k <name of test>
146+
$ nox -s system-3.14 -- -k <name of test>
147147

148148

149149
.. note::
150150

151-
System tests are only configured to run under Python 3.12.
151+
System tests are only configured to run under Python 3.14.
152152
For expediency, we do not run them in older versions of Python 3.
153153

154154
This alone will not run the tests. You'll need to change some local
@@ -228,6 +228,7 @@ We support:
228228
- `Python 3.11`_
229229
- `Python 3.12`_
230230
- `Python 3.13`_
231+
- `Python 3.14`_
231232

232233
.. _Python 3.7: https://docs.python.org/3.7/
233234
.. _Python 3.8: https://docs.python.org/3.8/
@@ -236,6 +237,7 @@ We support:
236237
.. _Python 3.11: https://docs.python.org/3.11/
237238
.. _Python 3.12: https://docs.python.org/3.12/
238239
.. _Python 3.13: https://docs.python.org/3.13/
240+
.. _Python 3.14: https://docs.python.org/3.14/
239241

240242

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

noxfile.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,15 @@
3232
ISORT_VERSION = "isort==5.11.0"
3333
LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
3434

35-
DEFAULT_PYTHON_VERSION = "3.10"
35+
DEFAULT_PYTHON_VERSION = "3.14"
3636

3737
UNIT_TEST_PYTHON_VERSIONS: List[str] = [
3838
"3.9",
3939
"3.10",
4040
"3.11",
4141
"3.12",
4242
"3.13",
43+
"3.14",
4344
]
4445
UNIT_TEST_STANDARD_DEPENDENCIES = [
4546
"mock",
@@ -58,7 +59,7 @@
5859
UNIT_TEST_EXTRAS: List[str] = []
5960
UNIT_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {}
6061

61-
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.12"]
62+
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = [DEFAULT_PYTHON_VERSION]
6263
SYSTEM_TEST_STANDARD_DEPENDENCIES: List[str] = [
6364
"mock",
6465
"pytest",
@@ -79,7 +80,12 @@
7980
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
8081

8182
nox.options.sessions = [
82-
"unit",
83+
"unit-3.9",
84+
"unit-3.10",
85+
"unit-3.11",
86+
"unit-3.12",
87+
"unit-3.13",
88+
"unit-3.14",
8389
"system",
8490
"cover",
8591
"lint",
@@ -143,7 +149,7 @@ def format(session):
143149
@nox.session(python=DEFAULT_PYTHON_VERSION)
144150
def lint_setup_py(session):
145151
"""Verify that setup.py is valid (including RST check)."""
146-
session.install("docutils", "pygments")
152+
session.install("setuptools", "docutils", "pygments")
147153
session.run("python", "setup.py", "check", "--restructuredtext", "--strict")
148154

149155

@@ -182,8 +188,8 @@ def install_unittest_dependencies(session, *constraints):
182188
)
183189
def unit(session, protobuf_implementation):
184190
# Install all test dependencies, then install this package in-place.
185-
186-
if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"):
191+
py_version = tuple([int(v) for v in session.python.split(".")])
192+
if protobuf_implementation == "cpp" and py_version >= (3, 11):
187193
session.skip("cpp implementation is not supported in python 3.11+")
188194

189195
constraints_path = str(
@@ -383,15 +389,16 @@ def docfx(session):
383389
)
384390

385391

386-
@nox.session(python="3.13")
392+
@nox.session(python=DEFAULT_PYTHON_VERSION)
387393
@nox.parametrize(
388394
"protobuf_implementation",
389395
["python", "upb", "cpp"],
390396
)
391397
def prerelease_deps(session, protobuf_implementation):
392398
"""Run all tests with prerelease versions of dependencies installed."""
393399

394-
if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"):
400+
py_version = tuple([int(v) for v in session.python.split(".")])
401+
if protobuf_implementation == "cpp" and py_version >= (3, 11):
395402
session.skip("cpp implementation is not supported in python 3.11+")
396403

397404
# Install all dependencies

samples/snippets/export_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ def _create_sink_name():
5050

5151

5252
@backoff.on_exception(backoff.expo, Exception, max_time=60, raise_on_giveup=False)
53-
def _delete_object(obj):
54-
obj.delete()
53+
def _delete_object(obj, **kwargs):
54+
obj.delete(**kwargs)
5555

5656

5757
# Runs once for entire test suite
@@ -79,7 +79,7 @@ def cleanup_old_sinks():
7979
# Bucket timestamp is int(time.time() * 1000)
8080
bucket_timestamp = int(match.group(1))
8181
if TIMESTAMP - bucket_timestamp // 1000 > CLEANUP_THRESHOLD:
82-
_delete_object(bucket)
82+
_delete_object(bucket, force=True)
8383

8484

8585
@pytest.fixture

samples/snippets/noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def get_pytest_env_vars() -> Dict[str, str]:
8989

9090
# DO NOT EDIT - automatically generated.
9191
# All versions used to test samples.
92-
ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
92+
ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
9393

9494
# Any default versions that should be ignored.
9595
IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]

0 commit comments

Comments
 (0)