GeezerVison is showing github.com — feat: Add support for python 3.14 (#1065) · googleapis/python-logging@6be3df6
This repository was archived by the owner on Aug 13, 2026. It is now read-only.
File treeExpand file treeCollapse file tree Open diff view settings .kokoro/samples/python3.14 .librarian/generator-input
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboard +60Lines changed: 60 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 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 | + |
Collapse file Copy file name to clipboard +6Lines changed: 6 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +# Format: //devtools/kokoro/config/proto/build.proto | | 2 | + | | 3 | +env_vars: { | | 4 | + key: "INSTALL_LIBRARY_FROM_SOURCE" | | 5 | + value: "True" | | 6 | +} |
Collapse file Copy file name to clipboard +11Lines changed: 11 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 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 | +} |
Collapse file Copy file name to clipboard +6Lines changed: 6 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +# Format: //devtools/kokoro/config/proto/build.proto | | 2 | + | | 3 | +env_vars: { | | 4 | + key: "INSTALL_LIBRARY_FROM_SOURCE" | | 5 | + value: "False" | | 6 | +} |
Collapse file Copy file name to clipboard +6Lines changed: 6 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +# Format: //devtools/kokoro/config/proto/build.proto | | 2 | + | | 3 | +env_vars: { | | 4 | + key: "INSTALL_LIBRARY_FROM_SOURCE" | | 5 | + value: "True" | | 6 | +} |
Collapse file Copy file name to clipboardExpand all lines: .librarian/generator-input/librarian.py +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -96,7 +96,8 @@ def place_before(path, text, *before_text, escape=None): | 96 | 96 | "google-cloud-testutils", | 97 | 97 | "opentelemetry-sdk" | 98 | 98 | ], | 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"], | 100 | 101 | unit_test_external_dependencies=["flask", "webob", "django"], | 101 | 102 | samples=True, | 102 | 103 | ) | |
Collapse file Copy file name to clipboardExpand all lines: CONTRIBUTING.rst +6-4Lines changed: 6 additions & 4 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -22,7 +22,7 @@ In order to add a feature: | 22 | 22 | documentation. | 23 | 23 |
| 24 | 24 | - 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. | 26 | 26 |
| 27 | 27 | - The feature must not add unnecessary dependencies (where | 28 | 28 | "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. | 72 | 72 |
| 73 | 73 | - To run a single unit test:: | 74 | 74 |
| 75 | | - $ nox -s unit-3.13 -- -k <name of test> | | 75 | + $ nox -s unit-3.14 -- -k <name of test> | 76 | 76 |
| 77 | 77 |
| 78 | 78 | .. note:: | @@ -143,12 +143,12 @@ Running System Tests | 143 | 143 | $ nox -s system | 144 | 144 |
| 145 | 145 | # 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> | 147 | 147 |
| 148 | 148 |
| 149 | 149 | .. note:: | 150 | 150 |
| 151 | | - System tests are only configured to run under Python 3.12. | | 151 | + System tests are only configured to run under Python 3.14. | 152 | 152 | For expediency, we do not run them in older versions of Python 3. | 153 | 153 |
| 154 | 154 | This alone will not run the tests. You'll need to change some local | @@ -228,6 +228,7 @@ We support: | 228 | 228 | - `Python 3.11`_ | 229 | 229 | - `Python 3.12`_ | 230 | 230 | - `Python 3.13`_ | | 231 | +- `Python 3.14`_ | 231 | 232 |
| 232 | 233 | .. _Python 3.7: https://docs.python.org/3.7/ | 233 | 234 | .. _Python 3.8: https://docs.python.org/3.8/ | @@ -236,6 +237,7 @@ We support: | 236 | 237 | .. _Python 3.11: https://docs.python.org/3.11/ | 237 | 238 | .. _Python 3.12: https://docs.python.org/3.12/ | 238 | 239 | .. _Python 3.13: https://docs.python.org/3.13/ | | 240 | +.. _Python 3.14: https://docs.python.org/3.14/ | 239 | 241 |
| 240 | 242 |
| 241 | 243 | Supported versions can be found in our ``noxfile.py`` `config`_. | |
Collapse file Copy file name to clipboardExpand all lines: noxfile.py +15-8Lines changed: 15 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 32 | 32 | ISORT_VERSION = "isort==5.11.0" | 33 | 33 | LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] | 34 | 34 |
| 35 | | -DEFAULT_PYTHON_VERSION = "3.10" | | 35 | +DEFAULT_PYTHON_VERSION = "3.14" | 36 | 36 |
| 37 | 37 | UNIT_TEST_PYTHON_VERSIONS: List[str] = [ | 38 | 38 | "3.9", | 39 | 39 | "3.10", | 40 | 40 | "3.11", | 41 | 41 | "3.12", | 42 | 42 | "3.13", | | 43 | + "3.14", | 43 | 44 | ] | 44 | 45 | UNIT_TEST_STANDARD_DEPENDENCIES = [ | 45 | 46 | "mock", | | 58 | 59 | UNIT_TEST_EXTRAS: List[str] = [] | 59 | 60 | UNIT_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {} | 60 | 61 |
| 61 | | -SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.12"] | | 62 | +SYSTEM_TEST_PYTHON_VERSIONS: List[str] = [DEFAULT_PYTHON_VERSION] | 62 | 63 | SYSTEM_TEST_STANDARD_DEPENDENCIES: List[str] = [ | 63 | 64 | "mock", | 64 | 65 | "pytest", | | 79 | 80 | CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() | 80 | 81 |
| 81 | 82 | 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", | 83 | 89 | "system", | 84 | 90 | "cover", | 85 | 91 | "lint", | @@ -143,7 +149,7 @@ def format(session): | 143 | 149 | @nox.session(python=DEFAULT_PYTHON_VERSION) | 144 | 150 | def lint_setup_py(session): | 145 | 151 | """Verify that setup.py is valid (including RST check).""" | 146 | | - session.install("docutils", "pygments") | | 152 | + session.install("setuptools", "docutils", "pygments") | 147 | 153 | session.run("python", "setup.py", "check", "--restructuredtext", "--strict") | 148 | 154 |
| 149 | 155 |
| @@ -182,8 +188,8 @@ def install_unittest_dependencies(session, *constraints): | 182 | 188 | ) | 183 | 189 | def unit(session, protobuf_implementation): | 184 | 190 | # 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): | 187 | 193 | session.skip("cpp implementation is not supported in python 3.11+") | 188 | 194 |
| 189 | 195 | constraints_path = str( | @@ -383,15 +389,16 @@ def docfx(session): | 383 | 389 | ) | 384 | 390 |
| 385 | 391 |
| 386 | | -@nox.session(python="3.13") | | 392 | +@nox.session(python=DEFAULT_PYTHON_VERSION) | 387 | 393 | @nox.parametrize( | 388 | 394 | "protobuf_implementation", | 389 | 395 | ["python", "upb", "cpp"], | 390 | 396 | ) | 391 | 397 | def prerelease_deps(session, protobuf_implementation): | 392 | 398 | """Run all tests with prerelease versions of dependencies installed.""" | 393 | 399 |
| 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): | 395 | 402 | session.skip("cpp implementation is not supported in python 3.11+") | 396 | 403 |
| 397 | 404 | # Install all dependencies | |
Collapse file Copy file name to clipboardExpand all lines: samples/snippets/export_test.py +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -50,8 +50,8 @@ def _create_sink_name(): | 50 | 50 |
| 51 | 51 |
| 52 | 52 | @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) | 55 | 55 |
| 56 | 56 |
| 57 | 57 | # Runs once for entire test suite | @@ -79,7 +79,7 @@ def cleanup_old_sinks(): | 79 | 79 | # Bucket timestamp is int(time.time() * 1000) | 80 | 80 | bucket_timestamp = int(match.group(1)) | 81 | 81 | if TIMESTAMP - bucket_timestamp // 1000 > CLEANUP_THRESHOLD: | 82 | | - _delete_object(bucket) | | 82 | + _delete_object(bucket, force=True) | 83 | 83 |
| 84 | 84 |
| 85 | 85 | @pytest.fixture | |
Collapse file Copy file name to clipboardExpand all lines: samples/snippets/noxfile.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -89,7 +89,7 @@ def get_pytest_env_vars() -> Dict[str, str]: | 89 | 89 |
| 90 | 90 | # DO NOT EDIT - automatically generated. | 91 | 91 | # 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"] | 93 | 93 |
| 94 | 94 | # Any default versions that should be ignored. | 95 | 95 | IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"] | |
|