From 4bb0dab98864cb5a3ca48c53bab212f8fab4239a Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 5 Mar 2025 11:29:22 +0000 Subject: [PATCH 01/26] fix: allow Protobuf 6.x --- setup.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 31c360f40..b18b0f113 100644 --- a/setup.py +++ b/setup.py @@ -28,9 +28,9 @@ # 'Development Status :: 5 - Production/Stable' release_status = "Development Status :: 5 - Production/Stable" dependencies = [ - "google-auth >= 2.26.1, < 3.0dev", - "google-api-core >= 2.15.0, <3.0.0dev", - "google-cloud-core >= 2.4.2, < 3.0dev", + "google-auth >= 2.26.1, < 3.0.0", + "google-api-core >= 2.15.0, <3.0.0", + "google-cloud-core >= 2.4.2, < 3.0.0", # The dependency "google-resumable-media" is no longer used. However, the # dependency is still included here to accommodate users who may be # importing exception classes from the google-resumable-media without @@ -39,11 +39,11 @@ # google-resumable-media classes in their application can safely disregard # this dependency. "google-resumable-media >= 2.7.2", - "requests >= 2.18.0, < 3.0.0dev", - "google-crc32c >= 1.0, < 2.0dev", + "requests >= 2.18.0, < 3.0.0", + "google-crc32c >= 1.0, < 2.0.0", ] extras = { - "protobuf": ["protobuf<6.0.0dev"], + "protobuf": ["protobuf<7.0.0"], "tracing": [ "opentelemetry-api >= 1.1.0", ], From a0a6ce24dd5252d77b667bf053fc5ce340fb45d7 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 12 Mar 2025 21:42:17 +0000 Subject: [PATCH 02/26] add prerelease nox session --- noxfile.py | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 116 insertions(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 384880848..853981ae8 100644 --- a/noxfile.py +++ b/noxfile.py @@ -19,6 +19,7 @@ from __future__ import absolute_import import os import pathlib +import re import shutil import nox @@ -29,7 +30,7 @@ DEFAULT_PYTHON_VERSION = "3.8" SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] -UNIT_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] +UNIT_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] CONFORMANCE_TEST_PYTHON_VERSIONS = ["3.8"] _DEFAULT_STORAGE_HOST = "https://storage.googleapis.com" @@ -300,3 +301,117 @@ def docfx(session): os.path.join("docs", ""), os.path.join("docs", "_build", "html", ""), ) + + + +@nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1]) +@nox.parametrize( + "protobuf_implementation", + [ "python", "upb", "cpp" ], +) +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"): + session.skip("cpp implementation is not supported in python 3.11+") + + # Install all dependencies + session.install("-e", ".[protobuf, tracing]") + # unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES + # session.install(*unit_deps_all) + # system_deps_all = ( + # SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES + # ) + # session.install(*system_deps_all) + + # Because we test minimum dependency versions on the minimum Python + # version, the first version we test with in the unit tests sessions has a + # constraints file containing all dependencies and extras. + with open( + CURRENT_DIRECTORY + / "testing" + / f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt", + encoding="utf-8", + ) as constraints_file: + constraints_text = constraints_file.read() + + # Ignore leading whitespace and comment lines. + constraints_deps = [ + match.group(1) + for match in re.finditer( + r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE + ) + ] + + session.install(*constraints_deps) + + prerel_deps = [ + "google-api-core", + "google-auth", + "google-cloud-core", + "google-crc32c", + "google-resumable-media", + "opentelemetry-api", + "protobuf", + ] + + package_namespaces = { + "google-api-core": "google.api_core", + "google-auth": "google.auth", + "google-cloud-core": "google.cloud.version", + "opentelemetry-api": "opentelemetry.version", + "protobuf": "google.protobuf", + } + + for dep in prerel_deps: + session.install("--pre", "--no-deps", "--upgrade", dep) + print(f"Installed {dep}") + + version_namespace = package_namespaces.get(dep) + + if version_namespace: + session.run( + "python", + "-c", + f"import {version_namespace}; print({version_namespace}.__version__)", + ) + # Remaining dependencies + other_deps = [ + "requests", + ] + session.install(*other_deps) + + session.run( + "py.test", + "tests/unit", + env={ + "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, + }, + ) + + system_test_path = os.path.join("tests", "system.py") + system_test_folder_path = os.path.join("tests", "system") + + # Only run system tests if found. + if os.path.exists(system_test_path): + session.run( + "py.test", + "--verbose", + f"--junitxml=system_{session.python}_sponge_log.xml", + system_test_path, + *session.posargs, + env={ + "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, + }, + ) + if os.path.exists(system_test_folder_path): + session.run( + "py.test", + "--verbose", + f"--junitxml=system_{session.python}_sponge_log.xml", + system_test_folder_path, + *session.posargs, + env={ + "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, + }, + ) \ No newline at end of file From bb9968032a6e7247599ff4bf50e72b54e5183e7c Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 12 Mar 2025 21:42:27 +0000 Subject: [PATCH 03/26] add python 3.13 --- CONTRIBUTING.rst | 2 +- samples/snippets/noxfile_config.py | 3 +++ setup.py | 11 ++++++----- testing/constraints-3.13.txt | 0 testing/constraints-3.7.txt | 15 +++++++++++++++ 5 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 testing/constraints-3.13.txt diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index d53ad8707..316d8b266 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 and 3.12 on both UNIX and Windows. + 3.7, 3.8, 3.9, 3.10, 3.11, 3.12 and 3.13 on both UNIX and Windows. - The feature must not add unnecessary dependencies (where "unnecessary" is of course subjective, but new dependencies should diff --git a/samples/snippets/noxfile_config.py b/samples/snippets/noxfile_config.py index 17a05b9f2..8caa79a6a 100644 --- a/samples/snippets/noxfile_config.py +++ b/samples/snippets/noxfile_config.py @@ -73,6 +73,9 @@ def get_cloud_kms_key(): if session == 'py-3.12': return ('projects/python-docs-samples-tests-312/locations/us/' 'keyRings/gcs-kms-key-ring/cryptoKeys/gcs-kms-key') + if session == 'py-3.13': + return ('projects/python-docs-samples-tests-313/locations/us/' + 'keyRings/gcs-kms-key-ring/cryptoKeys/gcs-kms-key') return os.environ['CLOUD_KMS_KEY'] diff --git a/setup.py b/setup.py index b18b0f113..50b485aac 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ release_status = "Development Status :: 5 - Production/Stable" dependencies = [ "google-auth >= 2.26.1, < 3.0.0", - "google-api-core >= 2.15.0, <3.0.0", + "google-api-core >= 2.15.0, < 3.0.0", "google-cloud-core >= 2.4.2, < 3.0.0", # The dependency "google-resumable-media" is no longer used. However, the # dependency is still included here to accommodate users who may be @@ -38,14 +38,14 @@ # exceptions and importing. Users who are not importing # google-resumable-media classes in their application can safely disregard # this dependency. - "google-resumable-media >= 2.7.2", + "google-resumable-media >= 2.7.2, < 3.0.0", "requests >= 2.18.0, < 3.0.0", - "google-crc32c >= 1.0, < 2.0.0", + "google-crc32c >= 1.0.0, < 2.0.0", ] extras = { - "protobuf": ["protobuf<7.0.0"], + "protobuf": ["protobuf >= 3.20.2, < 7.0.0"], "tracing": [ - "opentelemetry-api >= 1.1.0", + "opentelemetry-api >= 1.1.0, < 2.0.0", ], } @@ -93,6 +93,7 @@ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Operating System :: OS Independent", "Topic :: Internet", ], diff --git a/testing/constraints-3.13.txt b/testing/constraints-3.13.txt new file mode 100644 index 000000000..e69de29bb diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index e69de29bb..089e06aa4 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -0,0 +1,15 @@ +# This constraints file is used to check that lower bounds +# are correct in setup.py +# List all library dependencies and extras in this file. +# Pin the version to the lower bound. +# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0", +# Then this file should have google-cloud-foo==1.14.0 +google-auth==2.26.1 +google-api-core==2.15.0 +google-cloud-core==2.4.2 +google-resumable-media==2.7.2 +requests==2.18.0 +google-crc32c==1.0.0 +protobuf==3.20.2 +opentelemetry-api==1.1.0 + From 152811a4545381c5337101a32ba8a1502babbf4c Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 12 Mar 2025 21:45:32 +0000 Subject: [PATCH 04/26] lint --- noxfile.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/noxfile.py b/noxfile.py index 853981ae8..7fe2a474c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -303,11 +303,10 @@ def docfx(session): ) - @nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1]) @nox.parametrize( "protobuf_implementation", - [ "python", "upb", "cpp" ], + ["python", "upb", "cpp"], ) def prerelease_deps(session, protobuf_implementation): """Run all tests with prerelease versions of dependencies installed.""" @@ -414,4 +413,4 @@ def prerelease_deps(session, protobuf_implementation): env={ "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, }, - ) \ No newline at end of file + ) From 1556b6627a5ed08fabbb3ab75acdda5450882427 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 12 Mar 2025 21:55:06 +0000 Subject: [PATCH 05/26] add test dependencies --- noxfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/noxfile.py b/noxfile.py index 7fe2a474c..7f7463b4c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -314,6 +314,9 @@ def prerelease_deps(session, protobuf_implementation): if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"): session.skip("cpp implementation is not supported in python 3.11+") + # Install all test dependencies + session.install("pytest", "pytest-cov", "brotli") + # Install all dependencies session.install("-e", ".[protobuf, tracing]") # unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES From 39b69abeb9dca3facf1cd30c2f0964842111354b Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Wed, 12 Mar 2025 22:04:02 +0000 Subject: [PATCH 06/26] add test dependencies --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 7f7463b4c..02d99d9d2 100644 --- a/noxfile.py +++ b/noxfile.py @@ -315,7 +315,7 @@ def prerelease_deps(session, protobuf_implementation): session.skip("cpp implementation is not supported in python 3.11+") # Install all test dependencies - session.install("pytest", "pytest-cov", "brotli") + session.install("mock", "pytest", "pytest-cov", "brotli") # Install all dependencies session.install("-e", ".[protobuf, tracing]") From 2a56aef374eeec58bbbeb74da4019606604c7a41 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 13 Mar 2025 00:17:41 +0000 Subject: [PATCH 07/26] fix(deps): require google-crc32c >= 1.1.3 --- setup.py | 2 +- testing/constraints-3.7.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 50b485aac..2b4e62af9 100644 --- a/setup.py +++ b/setup.py @@ -40,7 +40,7 @@ # this dependency. "google-resumable-media >= 2.7.2, < 3.0.0", "requests >= 2.18.0, < 3.0.0", - "google-crc32c >= 1.0.0, < 2.0.0", + "google-crc32c >= 1.1.3, < 2.0.0", ] extras = { "protobuf": ["protobuf >= 3.20.2, < 7.0.0"], diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index 089e06aa4..ca292f7f0 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -9,7 +9,7 @@ google-api-core==2.15.0 google-cloud-core==2.4.2 google-resumable-media==2.7.2 requests==2.18.0 -google-crc32c==1.0.0 +google-crc32c==1.1.3 protobuf==3.20.2 opentelemetry-api==1.1.0 From dbd1ca9de85037a95879a1588a6e6d9654354355 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 13 Mar 2025 00:25:21 +0000 Subject: [PATCH 08/26] fix(deps): require requests >= 2.22.0 --- setup.py | 2 +- testing/constraints-3.7.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 2b4e62af9..43e3404f6 100644 --- a/setup.py +++ b/setup.py @@ -39,7 +39,7 @@ # google-resumable-media classes in their application can safely disregard # this dependency. "google-resumable-media >= 2.7.2, < 3.0.0", - "requests >= 2.18.0, < 3.0.0", + "requests >= 2.22.0, < 3.0.0", "google-crc32c >= 1.1.3, < 2.0.0", ] extras = { diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index ca292f7f0..9c17b387b 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -8,7 +8,7 @@ google-auth==2.26.1 google-api-core==2.15.0 google-cloud-core==2.4.2 google-resumable-media==2.7.2 -requests==2.18.0 +requests==2.22.0 google-crc32c==1.1.3 protobuf==3.20.2 opentelemetry-api==1.1.0 From b9922413fe944fef5d518e004eeb24f1fd965d34 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 13 Mar 2025 00:30:47 +0000 Subject: [PATCH 09/26] add dependencies for system tests --- noxfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/noxfile.py b/noxfile.py index 02d99d9d2..bb0a9ed99 100644 --- a/noxfile.py +++ b/noxfile.py @@ -355,6 +355,9 @@ def prerelease_deps(session, protobuf_implementation): "google-resumable-media", "opentelemetry-api", "protobuf", + # for system tests + "google-cloud-pubsub", + "google-cloud-kms", ] package_namespaces = { From 8bdf699340c36e1ef47d4a149c920976e30281a7 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 13 Mar 2025 00:32:30 +0000 Subject: [PATCH 10/26] clean up --- noxfile.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/noxfile.py b/noxfile.py index bb0a9ed99..b4d99ee56 100644 --- a/noxfile.py +++ b/noxfile.py @@ -306,14 +306,11 @@ def docfx(session): @nox.session(python=UNIT_TEST_PYTHON_VERSIONS[-1]) @nox.parametrize( "protobuf_implementation", - ["python", "upb", "cpp"], + ["python", "upb"], ) 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"): - session.skip("cpp implementation is not supported in python 3.11+") - # Install all test dependencies session.install("mock", "pytest", "pytest-cov", "brotli") From ad59b2e6fc800c696685f904dc5203ffe174cb15 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 13 Mar 2025 00:32:41 +0000 Subject: [PATCH 11/26] clean up --- noxfile.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/noxfile.py b/noxfile.py index b4d99ee56..cfb866320 100644 --- a/noxfile.py +++ b/noxfile.py @@ -316,12 +316,6 @@ def prerelease_deps(session, protobuf_implementation): # Install all dependencies session.install("-e", ".[protobuf, tracing]") - # unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES - # session.install(*unit_deps_all) - # system_deps_all = ( - # SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES - # ) - # session.install(*system_deps_all) # Because we test minimum dependency versions on the minimum Python # version, the first version we test with in the unit tests sessions has a From d93e5bac19aa666b7d4ede535fded8a1ce37a5e9 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 13 Mar 2025 00:33:27 +0000 Subject: [PATCH 12/26] clean up --- noxfile.py | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/noxfile.py b/noxfile.py index cfb866320..12177556b 100644 --- a/noxfile.py +++ b/noxfile.py @@ -317,27 +317,6 @@ def prerelease_deps(session, protobuf_implementation): # Install all dependencies session.install("-e", ".[protobuf, tracing]") - # Because we test minimum dependency versions on the minimum Python - # version, the first version we test with in the unit tests sessions has a - # constraints file containing all dependencies and extras. - with open( - CURRENT_DIRECTORY - / "testing" - / f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt", - encoding="utf-8", - ) as constraints_file: - constraints_text = constraints_file.read() - - # Ignore leading whitespace and comment lines. - constraints_deps = [ - match.group(1) - for match in re.finditer( - r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE - ) - ] - - session.install(*constraints_deps) - prerel_deps = [ "google-api-core", "google-auth", From 12d899cda45a339d368c9b03a5d090d70d32cfed Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 13 Mar 2025 00:34:23 +0000 Subject: [PATCH 13/26] clean up --- noxfile.py | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/noxfile.py b/noxfile.py index 12177556b..d97600982 100644 --- a/noxfile.py +++ b/noxfile.py @@ -364,29 +364,13 @@ def prerelease_deps(session, protobuf_implementation): }, ) - system_test_path = os.path.join("tests", "system.py") - system_test_folder_path = os.path.join("tests", "system") - - # Only run system tests if found. - if os.path.exists(system_test_path): - session.run( - "py.test", - "--verbose", - f"--junitxml=system_{session.python}_sponge_log.xml", - system_test_path, - *session.posargs, - env={ - "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, - }, - ) - if os.path.exists(system_test_folder_path): - session.run( - "py.test", - "--verbose", - f"--junitxml=system_{session.python}_sponge_log.xml", - system_test_folder_path, - *session.posargs, - env={ - "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, - }, - ) + session.run( + "py.test", + "--verbose", + f"--junitxml=system_{session.python}_sponge_log.xml", + os.path.join("tests", "system"), + *session.posargs, + env={ + "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation, + }, + ) From 4be916a589f5c8b16fbe6c4c339347ec30c1d186 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 13 Mar 2025 00:56:45 +0000 Subject: [PATCH 14/26] clean up --- noxfile.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/noxfile.py b/noxfile.py index d97600982..d5a64a2d4 100644 --- a/noxfile.py +++ b/noxfile.py @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Generated by synthtool. DO NOT EDIT! - from __future__ import absolute_import import os import pathlib @@ -33,13 +31,23 @@ UNIT_TEST_PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] CONFORMANCE_TEST_PYTHON_VERSIONS = ["3.8"] -_DEFAULT_STORAGE_HOST = "https://storage.googleapis.com" - CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() # Error if a python version is missing nox.options.error_on_missing_interpreters = True +nox.options.sessions = [ + "blacken", + "conftest_retry", + "cover", + "lint", + "lint_setup_py", + "docfx", + "docs", + "system", + "unit", +] + @nox.session(python=DEFAULT_PYTHON_VERSION) def lint(session): From c7d5000ed5d1c4396ba9143a78b84ec0bd0b0990 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 13 Mar 2025 01:06:24 +0000 Subject: [PATCH 15/26] fix cover --- noxfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index d5a64a2d4..2422956f5 100644 --- a/noxfile.py +++ b/noxfile.py @@ -39,13 +39,14 @@ nox.options.sessions = [ "blacken", "conftest_retry", - "cover", "lint", "lint_setup_py", "docfx", "docs", "system", "unit", + # cover must be last to avoid error `No data to report` + "cover", ] From 0f281137f50e482a418634c146adcd6bccf9533f Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 13 Mar 2025 01:06:53 +0000 Subject: [PATCH 16/26] clean up --- noxfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/noxfile.py b/noxfile.py index 2422956f5..62ff319fe 100644 --- a/noxfile.py +++ b/noxfile.py @@ -39,10 +39,10 @@ nox.options.sessions = [ "blacken", "conftest_retry", - "lint", - "lint_setup_py", "docfx", "docs", + "lint", + "lint_setup_py", "system", "unit", # cover must be last to avoid error `No data to report` From b03754ce0e4505edb7f81677ab4205b94b271121 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 13 Mar 2025 01:12:49 +0000 Subject: [PATCH 17/26] Install dependencies needed for system tests --- noxfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/noxfile.py b/noxfile.py index 62ff319fe..1cff7c34d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -323,6 +323,9 @@ def prerelease_deps(session, protobuf_implementation): # Install all test dependencies session.install("mock", "pytest", "pytest-cov", "brotli") + # Install dependencies needed for system tests + session.install("google-cloud-pubsub", "google-cloud-kms") + # Install all dependencies session.install("-e", ".[protobuf, tracing]") @@ -334,9 +337,6 @@ def prerelease_deps(session, protobuf_implementation): "google-resumable-media", "opentelemetry-api", "protobuf", - # for system tests - "google-cloud-pubsub", - "google-cloud-kms", ] package_namespaces = { From 0942622c89ce1e219efbc67bf37ffa00bd29380e Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 18 Mar 2025 10:46:54 +0000 Subject: [PATCH 18/26] add dependencies for system test --- noxfile.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 1cff7c34d..88bc9f5d0 100644 --- a/noxfile.py +++ b/noxfile.py @@ -324,7 +324,12 @@ def prerelease_deps(session, protobuf_implementation): session.install("mock", "pytest", "pytest-cov", "brotli") # Install dependencies needed for system tests - session.install("google-cloud-pubsub", "google-cloud-kms") + session.install( + "google-cloud-pubsub", + "google-cloud-kms", + "google-cloud-testutils", + "google-cloud-iam", + ) # Install all dependencies session.install("-e", ".[protobuf, tracing]") From e833fd515dba74f5cb085c1f2ddef655d56ccd56 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 18 Mar 2025 10:49:05 +0000 Subject: [PATCH 19/26] update noxfile config --- samples/snippets/noxfile_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/noxfile_config.py b/samples/snippets/noxfile_config.py index 8caa79a6a..7eba203a4 100644 --- a/samples/snippets/noxfile_config.py +++ b/samples/snippets/noxfile_config.py @@ -81,7 +81,7 @@ def get_cloud_kms_key(): TEST_CONFIG_OVERRIDE = { # You can opt out from the test for specific Python versions. - 'ignored_versions': ["2.7", "3.6", "3.7", "3.11", "3.12"], + 'ignored_versions': ["2.7", "3.6", "3.7", "3.11", "3.12", "3.13"], # An envvar key for determining the project id to use. Change it # to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a From 9a490e760f8b5fa163b7eb64b07e5c2736489a58 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 18 Mar 2025 12:10:23 +0000 Subject: [PATCH 20/26] add credentials --- .kokoro/presubmit/prerelease-deps.cfg | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.kokoro/presubmit/prerelease-deps.cfg b/.kokoro/presubmit/prerelease-deps.cfg index 3595fb43f..07db02426 100644 --- a/.kokoro/presubmit/prerelease-deps.cfg +++ b/.kokoro/presubmit/prerelease-deps.cfg @@ -5,3 +5,9 @@ env_vars: { key: "NOX_SESSION" value: "prerelease_deps" } + +# Credentials needed to test universe domain. +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "client-library-test-universe-domain-credential" +} From 457db16ff2cf832a96e130ba54c50c5b1dab27d1 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 18 Mar 2025 12:13:17 +0000 Subject: [PATCH 21/26] exclude .kokoro/presubmit/prerelease-deps.cfg template --- owlbot.py | 1 + 1 file changed, 1 insertion(+) diff --git a/owlbot.py b/owlbot.py index 8bd9de751..145f1a636 100644 --- a/owlbot.py +++ b/owlbot.py @@ -48,6 +48,7 @@ "README.rst", ".kokoro/continuous/continuous.cfg", ".kokoro/presubmit/system-3.8.cfg", + ".kokoro/presubmit/prerelease-deps.cfg", ".kokoro/samples/python3.6", # remove python 3.6 support ".github/blunderbuss.yml", # blunderbuss assignment to python squad ".github/workflows", # exclude gh actions as credentials are needed for tests From ec4a4285bc18dc0ca5947df05efa1c6fd7b3c74c Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 18 Mar 2025 12:13:48 +0000 Subject: [PATCH 22/26] remove obsolete excludes --- owlbot.py | 1 - 1 file changed, 1 deletion(-) diff --git a/owlbot.py b/owlbot.py index 145f1a636..674f145f0 100644 --- a/owlbot.py +++ b/owlbot.py @@ -49,7 +49,6 @@ ".kokoro/continuous/continuous.cfg", ".kokoro/presubmit/system-3.8.cfg", ".kokoro/presubmit/prerelease-deps.cfg", - ".kokoro/samples/python3.6", # remove python 3.6 support ".github/blunderbuss.yml", # blunderbuss assignment to python squad ".github/workflows", # exclude gh actions as credentials are needed for tests ".github/release-please.yml", # special support for a python2 branch in this repo From 600d7bc073ebbbe856a8814692f3cfd839c38c18 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 18 Mar 2025 12:28:13 +0000 Subject: [PATCH 23/26] clean up --- noxfile.py | 2 +- owlbot.py | 6 ------ tests/system/test_notification.py | 6 +++--- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/noxfile.py b/noxfile.py index 88bc9f5d0..51cf2ccc4 100644 --- a/noxfile.py +++ b/noxfile.py @@ -169,7 +169,7 @@ def system(session): session.install( "google-cloud-testutils", "google-cloud-iam", - "google-cloud-pubsub < 2.0.0", + "google-cloud-pubsub", "google-cloud-kms < 2.0dev", "brotli", "-c", diff --git a/owlbot.py b/owlbot.py index 674f145f0..5c5490cc1 100644 --- a/owlbot.py +++ b/owlbot.py @@ -26,12 +26,6 @@ templated_files = common.py_library( cov_level=100, split_system_tests=True, - system_test_external_dependencies=[ - "google-cloud-iam", - "google-cloud-pubsub < 2.0.0", - # See: https://github.com/googleapis/python-storage/issues/226 - "google-cloud-kms < 2.0dev", - ], intersphinx_dependencies={ # python-requests url temporary change related to # https://github.com/psf/requests/issues/6140#issuecomment-1135071992 diff --git a/tests/system/test_notification.py b/tests/system/test_notification.py index f52ae3219..9b631c29b 100644 --- a/tests/system/test_notification.py +++ b/tests/system/test_notification.py @@ -59,14 +59,14 @@ def topic_path(storage_client, topic_name): @pytest.fixture(scope="session") def notification_topic(storage_client, publisher_client, topic_path, no_mtls): - _helpers.retry_429(publisher_client.create_topic)(topic_path) - policy = publisher_client.get_iam_policy(topic_path) + _helpers.retry_429(publisher_client.create_topic)(request={"name": topic_path}) + policy = publisher_client.get_iam_policy(request={"resource": topic_path}) binding = policy.bindings.add() binding.role = "roles/pubsub.publisher" binding.members.append( f"serviceAccount:{storage_client.get_service_account_email()}" ) - publisher_client.set_iam_policy(topic_path, policy) + publisher_client.set_iam_policy(request={"resource": topic_path, "policy": policy}) def test_notification_create_minimal( From c326bf50d70013e27b975d90c41eef765fb68146 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 18 Mar 2025 14:28:14 +0000 Subject: [PATCH 24/26] clean up --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 51cf2ccc4..2a7614331 100644 --- a/noxfile.py +++ b/noxfile.py @@ -170,7 +170,7 @@ def system(session): "google-cloud-testutils", "google-cloud-iam", "google-cloud-pubsub", - "google-cloud-kms < 2.0dev", + "google-cloud-kms", "brotli", "-c", constraints_path, From b6e0d0c45fe10f3a7f67c9eb7a91f714f80803ff Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 18 Mar 2025 22:41:51 +0000 Subject: [PATCH 25/26] exclude .kokoro/continuous/prerelease-deps.cfg from templates; remove obsolete replacement --- owlbot.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/owlbot.py b/owlbot.py index 5c5490cc1..08ddbb8fc 100644 --- a/owlbot.py +++ b/owlbot.py @@ -43,6 +43,7 @@ ".kokoro/continuous/continuous.cfg", ".kokoro/presubmit/system-3.8.cfg", ".kokoro/presubmit/prerelease-deps.cfg", + ".kokoro/continuous/prerelease-deps.cfg", ".github/blunderbuss.yml", # blunderbuss assignment to python squad ".github/workflows", # exclude gh actions as credentials are needed for tests ".github/release-please.yml", # special support for a python2 branch in this repo @@ -78,12 +79,6 @@ """omit = .nox/*""") -s.replace( - ".kokoro/release/common.cfg", - 'value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem"', - 'value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem, client-library-test-universe-domain-credential"' -) - python.py_samples(skip_readmes=True) s.shell.run(["nox", "-s", "blacken"], hide_output=False) From 77a3dc88e8ab2ce58a342321b1b4adc979afb0f7 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 18 Mar 2025 22:42:18 +0000 Subject: [PATCH 26/26] migrate prerelease test from presubmit to continuous build --- .kokoro/continuous/prerelease-deps.cfg | 6 ++++++ .kokoro/presubmit/prerelease-deps.cfg | 13 ------------- 2 files changed, 6 insertions(+), 13 deletions(-) delete mode 100644 .kokoro/presubmit/prerelease-deps.cfg diff --git a/.kokoro/continuous/prerelease-deps.cfg b/.kokoro/continuous/prerelease-deps.cfg index 3595fb43f..07db02426 100644 --- a/.kokoro/continuous/prerelease-deps.cfg +++ b/.kokoro/continuous/prerelease-deps.cfg @@ -5,3 +5,9 @@ env_vars: { key: "NOX_SESSION" value: "prerelease_deps" } + +# Credentials needed to test universe domain. +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "client-library-test-universe-domain-credential" +} diff --git a/.kokoro/presubmit/prerelease-deps.cfg b/.kokoro/presubmit/prerelease-deps.cfg deleted file mode 100644 index 07db02426..000000000 --- a/.kokoro/presubmit/prerelease-deps.cfg +++ /dev/null @@ -1,13 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Only run this nox session. -env_vars: { - key: "NOX_SESSION" - value: "prerelease_deps" -} - -# Credentials needed to test universe domain. -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "client-library-test-universe-domain-credential" -}