-
- As of January 1, 2020 this library no longer supports Python 2 on the latest released version. +
+ As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.
diff --git a/google/cloud/logging/gapic_version.py b/google/cloud/logging/gapic_version.py index 14833215..bca86d63 100644 --- a/google/cloud/logging/gapic_version.py +++ b/google/cloud/logging/gapic_version.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/logging_v2/gapic_version.py b/google/cloud/logging_v2/gapic_version.py index 14833215..bca86d63 100644 --- a/google/cloud/logging_v2/gapic_version.py +++ b/google/cloud/logging_v2/gapic_version.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2022 Google LLC +# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/noxfile.py b/noxfile.py index e7150475..5c352793 100644 --- a/noxfile.py +++ b/noxfile.py @@ -110,7 +110,7 @@ def lint(session): session.run("flake8", "google", "tests") -@nox.session(python=DEFAULT_PYTHON_VERSION) +@nox.session(python="3.13") def blacken(session): """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) diff --git a/release-please-config.json b/release-please-config.json deleted file mode 100644 index 264e357f..00000000 --- a/release-please-config.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", - "packages": { - ".": { - "release-type": "python", - "extra-files": [ - "google/cloud/logging_v2/gapic_version.py", - "google/cloud/logging/gapic_version.py", - { - "type": "json", - "path": "samples/generated_samples/snippet_metadata_google.logging.v2.json", - "jsonpath": "$.clientLibrary.version" - } - ] - } - }, - "release-type": "python", - "plugins": [ - { - "type": "sentence-case" - } - ], - "initial-version": "0.1.0" -} - \ No newline at end of file diff --git a/samples/generated_samples/snippet_metadata_google.logging.v2.json b/samples/generated_samples/snippet_metadata_google.logging.v2.json index 10c88271..7d77545a 100644 --- a/samples/generated_samples/snippet_metadata_google.logging.v2.json +++ b/samples/generated_samples/snippet_metadata_google.logging.v2.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-logging", - "version": "0.0.0" + "version": "3.12.1" }, "snippets": [ { From 6be3df6aa94539cd2ab22a4fac55b343862228b2 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Mon, 15 Dec 2025 12:37:52 -0800 Subject: [PATCH 7/8] 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: https://github.com/googleapis/python-logging/pull/1055 --------- Co-authored-by: ohmayr Co-authored-by: Owl Bot Co-authored-by: Kevin Zheng Co-authored-by: Anthonios Partheniou Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- .kokoro/samples/python3.14/common.cfg | 60 ++++++++++++++++++++ .kokoro/samples/python3.14/continuous.cfg | 6 ++ .kokoro/samples/python3.14/periodic-head.cfg | 11 ++++ .kokoro/samples/python3.14/periodic.cfg | 6 ++ .kokoro/samples/python3.14/presubmit.cfg | 6 ++ .librarian/generator-input/librarian.py | 3 +- CONTRIBUTING.rst | 10 ++-- noxfile.py | 23 +++++--- samples/snippets/export_test.py | 6 +- samples/snippets/noxfile.py | 2 +- setup.py | 2 + testing/constraints-3.14.txt | 16 ++++++ tests/system/test_system.py | 12 ++-- 13 files changed, 141 insertions(+), 22 deletions(-) create mode 100644 .kokoro/samples/python3.14/common.cfg create mode 100644 .kokoro/samples/python3.14/continuous.cfg create mode 100644 .kokoro/samples/python3.14/periodic-head.cfg create mode 100644 .kokoro/samples/python3.14/periodic.cfg create mode 100644 .kokoro/samples/python3.14/presubmit.cfg create mode 100644 testing/constraints-3.14.txt diff --git a/.kokoro/samples/python3.14/common.cfg b/.kokoro/samples/python3.14/common.cfg new file mode 100644 index 00000000..0fa3f1ba --- /dev/null +++ b/.kokoro/samples/python3.14/common.cfg @@ -0,0 +1,60 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Specify which tests to run +env_vars: { + key: "RUN_TESTS_SESSION" + value: "py-3.14" +} + +# Declare build specific Cloud project. +env_vars: { + key: "BUILD_SPECIFIC_GCLOUD_PROJECT" + value: "python-docs-samples-tests-314" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-logging/.kokoro/test-samples.sh" +} + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" +} + +# Download secrets for samples +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "python-logging/.kokoro/trampoline_v2.sh" + + +############################################# +# this section merged from .kokoro/common_env_vars.cfg using owlbot.py + +env_vars: { + key: "PRODUCT_AREA_LABEL" + value: "observability" +} +env_vars: { + key: "PRODUCT_LABEL" + value: "logging" +} +env_vars: { + key: "LANGUAGE_LABEL" + value: "python" +} + +################################################### + diff --git a/.kokoro/samples/python3.14/continuous.cfg b/.kokoro/samples/python3.14/continuous.cfg new file mode 100644 index 00000000..a1c8d975 --- /dev/null +++ b/.kokoro/samples/python3.14/continuous.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/.kokoro/samples/python3.14/periodic-head.cfg b/.kokoro/samples/python3.14/periodic-head.cfg new file mode 100644 index 00000000..7e2973e3 --- /dev/null +++ b/.kokoro/samples/python3.14/periodic-head.cfg @@ -0,0 +1,11 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-logging/.kokoro/test-samples-against-head.sh" +} diff --git a/.kokoro/samples/python3.14/periodic.cfg b/.kokoro/samples/python3.14/periodic.cfg new file mode 100644 index 00000000..71cd1e59 --- /dev/null +++ b/.kokoro/samples/python3.14/periodic.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "False" +} diff --git a/.kokoro/samples/python3.14/presubmit.cfg b/.kokoro/samples/python3.14/presubmit.cfg new file mode 100644 index 00000000..a1c8d975 --- /dev/null +++ b/.kokoro/samples/python3.14/presubmit.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/.librarian/generator-input/librarian.py b/.librarian/generator-input/librarian.py index bf358a4b..e43640da 100644 --- a/.librarian/generator-input/librarian.py +++ b/.librarian/generator-input/librarian.py @@ -96,7 +96,8 @@ def place_before(path, text, *before_text, escape=None): "google-cloud-testutils", "opentelemetry-sdk" ], - system_test_python_versions=["3.12"], + system_test_python_versions=["3.14"], + unit_test_python_versions=["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"], unit_test_external_dependencies=["flask", "webob", "django"], samples=True, ) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 7bbacd5c..9b6c26a1 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -22,7 +22,7 @@ In order to add a feature: documentation. - The feature must work fully on the following CPython versions: - 3.7, 3.8, 3.9, 3.10, 3.11, 3.12 and 3.13 on both UNIX and Windows. + 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13 and 3.14 on both UNIX and Windows. - The feature must not add unnecessary dependencies (where "unnecessary" is of course subjective, but new dependencies should @@ -72,7 +72,7 @@ We use `nox `__ to instrument our tests. - To run a single unit test:: - $ nox -s unit-3.13 -- -k + $ nox -s unit-3.14 -- -k .. note:: @@ -143,12 +143,12 @@ Running System Tests $ nox -s system # Run a single system test - $ nox -s system-3.12 -- -k + $ nox -s system-3.14 -- -k .. note:: - System tests are only configured to run under Python 3.12. + System tests are only configured to run under Python 3.14. For expediency, we do not run them in older versions of Python 3. This alone will not run the tests. You'll need to change some local @@ -228,6 +228,7 @@ We support: - `Python 3.11`_ - `Python 3.12`_ - `Python 3.13`_ +- `Python 3.14`_ .. _Python 3.7: https://docs.python.org/3.7/ .. _Python 3.8: https://docs.python.org/3.8/ @@ -236,6 +237,7 @@ We support: .. _Python 3.11: https://docs.python.org/3.11/ .. _Python 3.12: https://docs.python.org/3.12/ .. _Python 3.13: https://docs.python.org/3.13/ +.. _Python 3.14: https://docs.python.org/3.14/ Supported versions can be found in our ``noxfile.py`` `config`_. diff --git a/noxfile.py b/noxfile.py index 5c352793..16dca84d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -32,7 +32,7 @@ ISORT_VERSION = "isort==5.11.0" LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] -DEFAULT_PYTHON_VERSION = "3.10" +DEFAULT_PYTHON_VERSION = "3.14" UNIT_TEST_PYTHON_VERSIONS: List[str] = [ "3.9", @@ -40,6 +40,7 @@ "3.11", "3.12", "3.13", + "3.14", ] UNIT_TEST_STANDARD_DEPENDENCIES = [ "mock", @@ -58,7 +59,7 @@ UNIT_TEST_EXTRAS: List[str] = [] UNIT_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {} -SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.12"] +SYSTEM_TEST_PYTHON_VERSIONS: List[str] = [DEFAULT_PYTHON_VERSION] SYSTEM_TEST_STANDARD_DEPENDENCIES: List[str] = [ "mock", "pytest", @@ -79,7 +80,12 @@ CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() nox.options.sessions = [ - "unit", + "unit-3.9", + "unit-3.10", + "unit-3.11", + "unit-3.12", + "unit-3.13", + "unit-3.14", "system", "cover", "lint", @@ -143,7 +149,7 @@ def format(session): @nox.session(python=DEFAULT_PYTHON_VERSION) def lint_setup_py(session): """Verify that setup.py is valid (including RST check).""" - session.install("docutils", "pygments") + session.install("setuptools", "docutils", "pygments") session.run("python", "setup.py", "check", "--restructuredtext", "--strict") @@ -182,8 +188,8 @@ 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"): + py_version = tuple([int(v) for v in session.python.split(".")]) + if protobuf_implementation == "cpp" and py_version >= (3, 11): session.skip("cpp implementation is not supported in python 3.11+") constraints_path = str( @@ -383,7 +389,7 @@ def docfx(session): ) -@nox.session(python="3.13") +@nox.session(python=DEFAULT_PYTHON_VERSION) @nox.parametrize( "protobuf_implementation", ["python", "upb", "cpp"], @@ -391,7 +397,8 @@ def docfx(session): def prerelease_deps(session, protobuf_implementation): """Run all tests with prerelease versions of dependencies installed.""" - if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"): + py_version = tuple([int(v) for v in session.python.split(".")]) + if protobuf_implementation == "cpp" and py_version >= (3, 11): session.skip("cpp implementation is not supported in python 3.11+") # Install all dependencies diff --git a/samples/snippets/export_test.py b/samples/snippets/export_test.py index 845359e0..c9eb18ef 100644 --- a/samples/snippets/export_test.py +++ b/samples/snippets/export_test.py @@ -50,8 +50,8 @@ def _create_sink_name(): @backoff.on_exception(backoff.expo, Exception, max_time=60, raise_on_giveup=False) -def _delete_object(obj): - obj.delete() +def _delete_object(obj, **kwargs): + obj.delete(**kwargs) # Runs once for entire test suite @@ -79,7 +79,7 @@ def cleanup_old_sinks(): # Bucket timestamp is int(time.time() * 1000) bucket_timestamp = int(match.group(1)) if TIMESTAMP - bucket_timestamp // 1000 > CLEANUP_THRESHOLD: - _delete_object(bucket) + _delete_object(bucket, force=True) @pytest.fixture diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py index c9a3d1ec..c326375b 100644 --- a/samples/snippets/noxfile.py +++ b/samples/snippets/noxfile.py @@ -89,7 +89,7 @@ def get_pytest_env_vars() -> Dict[str, str]: # DO NOT EDIT - automatically generated. # All versions used to test samples. -ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] +ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] # Any default versions that should be ignored. IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"] diff --git a/setup.py b/setup.py index c80db046..0bd8d6a8 100644 --- a/setup.py +++ b/setup.py @@ -85,6 +85,8 @@ "Programming Language :: Python :: 3.10", "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/testing/constraints-3.14.txt b/testing/constraints-3.14.txt new file mode 100644 index 00000000..981d37ac --- /dev/null +++ b/testing/constraints-3.14.txt @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +google-auth +proto-plus +protobuf +google-cloud-core +google-cloud-appengine-logging +google-cloud-audit-log +grpc-google-iam-v1 +opentelemetry-api + +# optional dependencies +django +flask diff --git a/tests/system/test_system.py b/tests/system/test_system.py index 487ecde6..366ed343 100644 --- a/tests/system/test_system.py +++ b/tests/system/test_system.py @@ -721,8 +721,9 @@ def test_log_handler_otel_integration(self): self.assertTrue(entries[0].trace_sampled, expected_tracesampled) def test_log_handler_close(self): - from multiprocessing import Process + import multiprocessing + ctx = multiprocessing.get_context("fork") LOG_MESSAGE = "This is a test of handler.close before exiting." LOGGER_NAME = "close-test" handler_name = self._logger_name(LOGGER_NAME) @@ -746,7 +747,7 @@ def subprocess_main(): cloud_logger.warning(LOG_MESSAGE) handler.close() - proc = Process(target=subprocess_main) + proc = ctx.Process(target=subprocess_main) proc.start() proc.join() entries = _list_entries(logger) @@ -754,8 +755,9 @@ def subprocess_main(): self.assertEqual(entries[0].payload, LOG_MESSAGE) def test_log_client_flush_handlers(self): - from multiprocessing import Process + import multiprocessing + ctx = multiprocessing.get_context("fork") LOG_MESSAGE = "This is a test of client.flush_handlers before exiting." LOGGER_NAME = "close-test" handler_name = self._logger_name(LOGGER_NAME) @@ -779,7 +781,7 @@ def subprocess_main(): cloud_logger.warning(LOG_MESSAGE) Config.CLIENT.flush_handlers() - proc = Process(target=subprocess_main) + proc = ctx.Process(target=subprocess_main) proc.start() proc.join() entries = _list_entries(logger) @@ -1058,7 +1060,7 @@ def retryable(): # http and gapic results should be consistent self.assertEqual(gapic_list[0].insert_id, http_list[0].insert_id) # returned logs should be in descending order - self.assertEqual(gapic_list[0].payload, f"test {log_count-1}") + self.assertEqual(gapic_list[0].payload, f"test {log_count - 1}") RetryErrors( (ServiceUnavailable, InternalServerError, AssertionError), From 1415883be0937810608b8cadd3530bd0c39b4dab Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Mon, 15 Dec 2025 15:05:37 -0800 Subject: [PATCH 8/8] chore: librarian release pull request: 20251215T134006Z (#1066) PR created by the Librarian CLI to initialize a release. Merging this PR will auto trigger a release. Librarian Version: v0.7.0 Language Image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:8e2c32496077054105bd06c54a59d6a6694287bc053588e24debe6da6920ad91
google-cloud-logging: 3.13.0 ## [3.13.0](https://github.com/googleapis/python-logging/compare/v3.12.1...v3.13.0) (2025-12-15) ### Features * Add support for python 3.14 (#1065) ([6be3df6a](https://github.com/googleapis/python-logging/commit/6be3df6a)) ### Bug Fixes * remove setup.cfg configuration for creating universal wheels (#981) ([70f612c3](https://github.com/googleapis/python-logging/commit/70f612c3))
--- .librarian/state.yaml | 2 +- CHANGELOG.md | 12 ++++++++++++ google/cloud/logging/gapic_version.py | 2 +- google/cloud/logging_v2/gapic_version.py | 2 +- .../snippet_metadata_google.logging.v2.json | 2 +- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.librarian/state.yaml b/.librarian/state.yaml index 2edc4725..8971f2c8 100644 --- a/.librarian/state.yaml +++ b/.librarian/state.yaml @@ -1,7 +1,7 @@ image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:8e2c32496077054105bd06c54a59d6a6694287bc053588e24debe6da6920ad91 libraries: - id: google-cloud-logging - version: 3.12.1 + version: 3.13.0 last_generated_commit: 5400ccce473c439885bd6bf2924fd242271bfcab apis: - path: google/logging/v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f98b01a..735ceaf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,18 @@ [1]: https://pypi.org/project/google-cloud-logging/#history +## [3.13.0](https://github.com/googleapis/python-logging/compare/v3.12.1...v3.13.0) (2025-12-15) + + +### Features + +* Add support for python 3.14 (#1065) ([6be3df6aa94539cd2ab22a4fac55b343862228b2](https://github.com/googleapis/python-logging/commit/6be3df6aa94539cd2ab22a4fac55b343862228b2)) + + +### Bug Fixes + +* remove setup.cfg configuration for creating universal wheels (#981) ([70f612c3281f1df13f3aba6b19bc4e9397297f3d](https://github.com/googleapis/python-logging/commit/70f612c3281f1df13f3aba6b19bc4e9397297f3d)) + ## [3.12.1](https://github.com/googleapis/python-logging/compare/v3.12.0...v3.12.1) (2025-04-21) diff --git a/google/cloud/logging/gapic_version.py b/google/cloud/logging/gapic_version.py index bca86d63..0677053c 100644 --- a/google/cloud/logging/gapic_version.py +++ b/google/cloud/logging/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "3.12.1" # {x-release-please-version} +__version__ = "3.13.0" # {x-release-please-version} diff --git a/google/cloud/logging_v2/gapic_version.py b/google/cloud/logging_v2/gapic_version.py index bca86d63..0677053c 100644 --- a/google/cloud/logging_v2/gapic_version.py +++ b/google/cloud/logging_v2/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "3.12.1" # {x-release-please-version} +__version__ = "3.13.0" # {x-release-please-version} diff --git a/samples/generated_samples/snippet_metadata_google.logging.v2.json b/samples/generated_samples/snippet_metadata_google.logging.v2.json index 7d77545a..6914e27b 100644 --- a/samples/generated_samples/snippet_metadata_google.logging.v2.json +++ b/samples/generated_samples/snippet_metadata_google.logging.v2.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-logging", - "version": "3.12.1" + "version": "3.13.0" }, "snippets": [ {