Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit cf509fb

Browse files
authored
Merge branch 'main' into fix-pager-listvalue-test-9413892356993396464
2 parents 118321f + 3728024 commit cf509fb

92 files changed

Lines changed: 352 additions & 309 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.librarian/state.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:68c7c79adf43af1be4c0527673342dd180aebebf652ea623614eaebff924ca27
22
libraries:
33
- id: gapic-generator
4-
version: 1.30.5
4+
version: 1.30.6
55
last_generated_commit: ""
66
apis: []
77
source_roots:

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
[1]: https://pypi.org/project/gapic-generator/#history
66

7+
## [1.30.6](https://github.com/googleapis/gapic-generator-python/compare/v1.30.5...v1.30.6) (2026-01-30)
8+
9+
10+
### Bug Fixes
11+
12+
* fix incorrect REST request serialization (#2549) ([46e765e5fa2677b5b0d5c85ae5bdad495f9f7e60](https://github.com/googleapis/gapic-generator-python/commit/46e765e5fa2677b5b0d5c85ae5bdad495f9f7e60))
13+
* filter sphinx warnings related to adding a new line after lists (#2533) ([ae0a9e817513c6d4d03fc86685f66be8d9699862](https://github.com/googleapis/gapic-generator-python/commit/ae0a9e817513c6d4d03fc86685f66be8d9699862))
14+
715
## [1.30.5](https://github.com/googleapis/gapic-generator-python/compare/v1.30.4...v1.30.5) (2026-01-26)
816

917

gapic/schema/imp.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,21 @@ def __eq__(self, other) -> bool:
2626
return self.package == other.package and self.module == other.module
2727

2828
def __str__(self) -> str:
29+
# Determine if we need to suppress type checking for this import.
30+
# We do this for protobuf generated files (_pb2) and api_core
31+
# internals where type information might be missing or incomplete.
32+
needs_type_ignore = self.module.endswith("_pb2") or "api_core" in self.package
33+
if needs_type_ignore:
34+
# Use 'import absolute.path as module' syntax to prevent Ruff/isort
35+
# from combining this with other imports. This ensures the
36+
# '# type: ignore' comment remains effective for this specific import.
37+
full_module = ".".join(self.package + (self.module,))
38+
alias = self.alias or self.module
39+
return f"import {full_module} as {alias} # type: ignore"
40+
2941
answer = f"import {self.module}"
3042
if self.package:
3143
answer = f"from {'.'.join(self.package)} {answer}"
3244
if self.alias:
3345
answer += f" as {self.alias}"
34-
if self.module.endswith("_pb2") or "api_core" in self.package:
35-
answer += " # type: ignore"
3646
return answer

gapic/templates/%namespace/%name_%version/%sub/services/%service/_shared_macros.j2

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,9 @@ def _get_http_options():
196196
body_spec (str): The http options body i.e. method.http_options[0].body
197197
method_name (str): The method name.
198198
service: The service.
199-
is_async (bool): Used to determine the code path i.e. whether for sync or async call. #}
200-
{% macro rest_call_method_common(body_spec, method_name, service, is_async=False, is_proto_plus_type=False) %}
199+
is_async (bool): Used to determine the code path i.e. whether for sync or async call.
200+
is_request_message_proto_plus_type (bool): Used to determine whether the request message is a proto-plus type. #}
201+
{% macro rest_call_method_common(body_spec, method_name, service, is_async=False, is_request_message_proto_plus_type=False) %}
201202
{% set service_name = service.name %}
202203
{% set await_prefix = "await " if is_async else "" %}
203204
{% set async_class_prefix = "Async" if is_async else "" %}
@@ -218,7 +219,7 @@ def _get_http_options():
218219
request_url = "{host}{uri}".format(host=self._host, uri=transcoded_request['uri'])
219220
method = transcoded_request['method']
220221
try:
221-
request_payload = {% if is_proto_plus_type %}type(request).to_json(request){% else %}json_format.MessageToJson(request){% endif %}
222+
request_payload = {% if is_request_message_proto_plus_type %}type(request).to_json(request){% else %}json_format.MessageToJson(request){% endif %}
222223

223224
except:
224225
{# TODO(https://github.com/googleapis/gapic-generator-python/issues/2282): Remove try/except and correctly parse request payload. #}

gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ class {{ service.async_client_name }}:
9898
Returns:
9999
{{ service.async_client_name }}: The constructed client.
100100
"""
101-
return {{ service.client_name }}.from_service_account_info.__func__({{ service.async_client_name }}, info, *args, **kwargs) # type: ignore
101+
sa_info_func = {{ service.client_name }}.from_service_account_info.__func__ # type: ignore
102+
return sa_info_func({{ service.async_client_name }}, info, *args, **kwargs)
102103

103104
@classmethod
104105
def from_service_account_file(cls, filename: str, *args, **kwargs):
@@ -114,7 +115,8 @@ class {{ service.async_client_name }}:
114115
Returns:
115116
{{ service.async_client_name }}: The constructed client.
116117
"""
117-
return {{ service.client_name }}.from_service_account_file.__func__({{ service.async_client_name }}, filename, *args, **kwargs) # type: ignore
118+
sa_file_func = {{ service.client_name }}.from_service_account_file.__func__ # type: ignore
119+
return sa_file_func({{ service.async_client_name }}, filename, *args, **kwargs)
118120

119121
from_service_account_json = from_service_account_file
120122

gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ class {{service.name}}RestTransport(_Base{{ service.name }}RestTransport):
240240
{% endif %}
241241
"""
242242

243-
{{ shared_macros.rest_call_method_common(body_spec, method.name, service, False, method.output.ident.is_proto_plus_type)|indent(8) }}
243+
{{ shared_macros.rest_call_method_common(body_spec, method.name, service, False, method.input.ident.is_proto_plus_type)|indent(8) }}
244244

245245
{% if not method.void %}
246246
# Return the response

gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest_asyncio.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class Async{{service.name}}RestTransport(_Base{{ service.name }}RestTransport):
202202
{% endif %}
203203
"""
204204

205-
{{ shared_macros.rest_call_method_common(body_spec, method.name, service, True, method.output.ident.is_proto_plus_type)|indent(8) }}
205+
{{ shared_macros.rest_call_method_common(body_spec, method.name, service, True, method.input.ident.is_proto_plus_type)|indent(8) }}
206206

207207
{% if not method.void %}
208208
# Return the response

requirements.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -963,17 +963,17 @@ proto-plus==1.26.1 \
963963
# via
964964
# -r requirements.in
965965
# google-api-core
966-
protobuf==6.33.0 \
967-
--hash=sha256:140303d5c8d2037730c548f8c7b93b20bb1dc301be280c378b82b8894589c954 \
968-
--hash=sha256:25c9e1963c6734448ea2d308cfa610e692b801304ba0908d7bfa564ac5132995 \
969-
--hash=sha256:35be49fd3f4fefa4e6e2aacc35e8b837d6703c37a2168a55ac21e9b1bc7559ef \
970-
--hash=sha256:905b07a65f1a4b72412314082c7dbfae91a9e8b68a0cc1577515f8df58ecf455 \
971-
--hash=sha256:9a031d10f703f03768f2743a1c403af050b6ae1f3480e9c140f39c45f81b13ee \
972-
--hash=sha256:c963e86c3655af3a917962c9619e1a6b9670540351d7af9439d06064e3317cc9 \
973-
--hash=sha256:cd33a8e38ea3e39df66e1bbc462b076d6e5ba3a4ebbde58219d777223a7873d3 \
974-
--hash=sha256:d6101ded078042a8f17959eccd9236fb7a9ca20d3b0098bbcb91533a5680d035 \
975-
--hash=sha256:e0697ece353e6239b90ee43a9231318302ad8353c70e6e45499fa52396debf90 \
976-
--hash=sha256:e0a1715e4f27355afd9570f3ea369735afc853a6c3951a6afe1f80d8569ad298
966+
protobuf==6.33.5 \
967+
--hash=sha256:3093804752167bcab3998bec9f1048baae6e29505adaf1afd14a37bddede533c \
968+
--hash=sha256:69915a973dd0f60f31a08b8318b73eab2bd6a392c79184b3612226b0a3f8ec02 \
969+
--hash=sha256:6ddcac2a081f8b7b9642c09406bc6a4290128fce5f471cddd165960bb9119e5c \
970+
--hash=sha256:8afa18e1d6d20af15b417e728e9f60f3aa108ee76f23c3b2c07a2c3b546d3afd \
971+
--hash=sha256:8f04fa32763dcdb4973d537d6b54e615cc61108c7cb38fe59310c3192d29510a \
972+
--hash=sha256:9b71e0281f36f179d00cbcb119cb19dec4d14a81393e5ea220f64b286173e190 \
973+
--hash=sha256:a3157e62729aafb8df6da2c03aa5c0937c7266c626ce11a278b6eb7963c4e37c \
974+
--hash=sha256:a5cb85982d95d906df1e2210e58f8e4f1e3cdc088e52c921a041f9c9a0386de5 \
975+
--hash=sha256:cbf16ba3350fb7b889fca858fb215967792dc125b35c7976ca4818bee3521cf0 \
976+
--hash=sha256:d71b040839446bac0f4d162e758bea99c8251161dae9d0983a3b88dee345153b
977977
# via
978978
# -r requirements.in
979979
# google-api-core

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
name = "gapic-generator"
2323
description = "Google API Client Generator for Python"
2424
url = "https://github.com/googleapis/gapic-generator-python"
25-
version = "1.30.5"
25+
version = "1.30.6"
2626
release_status = "Development Status :: 5 - Production/Stable"
2727
dependencies = [
2828
# Ensure that the lower bounds of these dependencies match what we have in the

tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/async_client.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@
3434
except AttributeError: # pragma: NO COVER
3535
OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
3636

37-
from google.api_core import operation # type: ignore
38-
from google.api_core import operation_async # type: ignore
3937
from google.cloud.asset_v1.services.asset_service import pagers
4038
from google.cloud.asset_v1.types import asset_service
4139
from google.cloud.asset_v1.types import assets
4240
from google.longrunning import operations_pb2 # type: ignore
43-
from google.protobuf import field_mask_pb2 # type: ignore
44-
from google.protobuf import timestamp_pb2 # type: ignore
45-
from google.rpc import status_pb2 # type: ignore
46-
from google.type import expr_pb2 # type: ignore
41+
import google.api_core.operation as operation # type: ignore
42+
import google.api_core.operation_async as operation_async # type: ignore
43+
import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
44+
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
45+
import google.rpc.status_pb2 as status_pb2 # type: ignore
46+
import google.type.expr_pb2 as expr_pb2 # type: ignore
4747
from .transports.base import AssetServiceTransport, DEFAULT_CLIENT_INFO
4848
from .transports.grpc_asyncio import AssetServiceGrpcAsyncIOTransport
4949
from .client import AssetServiceClient
@@ -106,7 +106,8 @@ def from_service_account_info(cls, info: dict, *args, **kwargs):
106106
Returns:
107107
AssetServiceAsyncClient: The constructed client.
108108
"""
109-
return AssetServiceClient.from_service_account_info.__func__(AssetServiceAsyncClient, info, *args, **kwargs) # type: ignore
109+
sa_info_func = AssetServiceClient.from_service_account_info.__func__ # type: ignore
110+
return sa_info_func(AssetServiceAsyncClient, info, *args, **kwargs)
110111

111112
@classmethod
112113
def from_service_account_file(cls, filename: str, *args, **kwargs):
@@ -122,7 +123,8 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):
122123
Returns:
123124
AssetServiceAsyncClient: The constructed client.
124125
"""
125-
return AssetServiceClient.from_service_account_file.__func__(AssetServiceAsyncClient, filename, *args, **kwargs) # type: ignore
126+
sa_file_func = AssetServiceClient.from_service_account_file.__func__ # type: ignore
127+
return sa_file_func(AssetServiceAsyncClient, filename, *args, **kwargs)
126128

127129
from_service_account_json = from_service_account_file
128130

0 commit comments

Comments
 (0)