8000 fix: Allow Protobuf 5.x (#12871) · googleapis/google-cloud-python@73b35d5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 73b35d5

Browse files
gcf-owl-bot[bot]ohmayrparthea
authored
fix: Allow Protobuf 5.x (#12871)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 649277844 Source-Link: googleapis/googleapis@fd7efa2 Source-Link: googleapis/googleapis-gen@50be251 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXZwYy1hY2Nlc3MvLk93bEJvdC55YW1sIiwiaCI6IjUwYmUyNTEzMjlkOGRiNWI1NTU2MjZlYmQ0ODg2NzIxZjU0N2QzY2MifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXdlYnJpc2svLk93bEJvdC55YW1sIiwiaCI6IjUwYmUyNTEzMjlkOGRiNWI1NTU2MjZlYmQ0ODg2NzIxZjU0N2QzY2MifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXdlYnNlY3VyaXR5c2Nhbm5lci8uT3dsQm90LnlhbWwiLCJoIjoiNTBiZTI1MTMyOWQ4ZGI1YjU1NTYyNmViZDQ4ODY3MjFmNTQ3ZDNjYyJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXdvcmtmbG93cy8uT3dsQm90LnlhbWwiLCJoIjoiNTBiZTI1MTMyOWQ4ZGI1YjU1NTYyNmViZDQ4ODY3MjFmNTQ3ZDNjYyJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXdvcmtzdGF0aW9ucy8uT3dsQm90LnlhbWwiLCJoIjoiNTBiZTI1MTMyOWQ4ZGI1YjU1NTYyNmViZDQ4ODY3MjFmNTQ3ZDNjYyJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWdlby10eXBlLy5Pd2xCb3QueWFtbCIsImgiOiI1MGJlMjUxMzI5ZDhkYjVi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GI1YjU1NTYyNmViZDQ4ODY3MjFmNTQ3ZDNjYyJ9 --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: ohmayr <omairnaveed@ymail.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent 8cf8498 commit 73b35d5

File tree

269 files changed

+1399
-1776
lines changed
  • testing
  • google-maps-addressvalidation
  • google-maps-fleetengine-delivery
  • google-maps-fleetengine
  • google-maps-mapsplatformdatasets
  • google-maps-places
  • google-maps-routeoptimization
  • google-maps-routing
  • google-maps-solar
  • google-shopping-css
  • google-shopping-merchant-accounts
  • google-shopping-merchant-conversions
  • google-shopping-merchant-datasources
  • google-shopping-merchant-inventories
  • google-shopping-merchant-lfp
  • Some content is hidden

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

    269 files changed

    +1399
    -1776
    lines changed

    packages/google-cloud-vpc-access/README.rst

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -15,7 +15,7 @@ Python Client for Virtual Private Cloud
    1515
    .. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-vpc-access.svg
    1616
    :target: https://pypi.org/project/google-cloud-vpc-access/
    1717
    .. _Virtual Private Cloud: https://cloud.google.com/vpc/
    18-
    .. _Client Library Documentation: https://cloud.google.com/python/docs/reference/vpcaccess/latest
    18+
    .. _Client Library Documentation: https://cloud.google.com/python/docs/reference/vpcaccess/latest/summary_overview
    1919
    .. _Product Documentation: https://cloud.google.com/vpc/
    2020

    2121
    Quick Start

    packages/google-cloud-vpc-access/docs/index.rst

    Lines changed: 5 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -21,3 +21,8 @@ For a list of all ``google-cloud-vpc-access`` releases:
    2121
    :maxdepth: 2
    2222

    2323
    CHANGELOG
    24+
    25+
    .. toctree::
    26+
    :hidden:
    27+
    28+
    summary_overview.md
    Lines changed: 22 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -0,0 +1,22 @@
    1+
    [
    2+
    This is a templated file. Adding content to this file may result in it being
    3+
    reverted. Instead, if you want to place additional content, create an
    4+
    "overview_content.md" file in `docs/` directory. The Sphinx tool will
    5+
    pick up on the content and merge the content.
    6+
    ]: #
    7+
    8+
    # Virtual Private Cloud API
    9+
    10+
    Overview of the APIs available for Virtual Private Cloud API.
    11+
    12+
    ## All entries
    13+
    14+
    Classes, methods and properties & attributes for
    15+
    Virtual Private Cloud API.
    16+
    17+
    [classes](https://cloud.google.com/python/docs/reference/vpcaccess/latest/summary_class.html)
    18+
    19+
    [methods](https://cloud.google.com/python/docs/reference/vpcaccess/latest/summary_method.html)
    20+
    21+
    [properties and
    22+
    attributes](https://cloud.google.com/python/docs/reference/vpcaccess/latest/summary_property.html)

    packages/google-cloud-vpc-access/google/cloud/vpcaccess_v1/services/vpc_access_service/transports/base.py

    Lines changed: 3 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -83,6 +83,8 @@ def __init__(
    8383

    8484
    # Save the scopes.
    8585
    self._scopes = scopes
    86+
    if not hasattr(self, "_ignore_credentials"):
    87+
    self._ignore_credentials: bool = False
    8688

    8789
    # If no credentials are provided, then determine the appropriate
    8890
    # defaults.
    @@ -95,7 +97,7 @@ def __init__(
    9597
    credentials, _ = google.auth.load_credentials_from_file(
    9698
    credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
    9799
    )
    98-
    elif credentials is None:
    100+
    elif credentials is None and not self._ignore_credentials:
    99101
    credentials, _ = google.auth.default(
    100102
    **scopes_kwargs, quota_project_id=quota_project_id
    101103
    )

    packages/google-cloud-vpc-access/google/cloud/vpcaccess_v1/services/vpc_access_service/transports/grpc.py

    Lines changed: 2 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -126,7 +126,8 @@ def __init__(
    126126

    127127
    if isinstance(channel, grpc.Channel):
    128128
    # Ignore credentials if a channel was passed.
    129-
    credentials = False
    129+
    credentials = None
    130+
    self._ignore_credentials = True
    130131
    # If a channel was explicitly provided, set it.
    131132
    self._grpc_channel = channel
    132133
    self._ssl_channel_credentials = None

    packages/google-cloud-vpc-access/google/cloud/vpcaccess_v1/services/vpc_access_service/transports/grpc_asyncio.py

    Lines changed: 2 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -173,7 +173,8 @@ def __init__(
    173173

    174174
    if isinstance(channel, aio.Channel):
    175175
    # Ignore credentials if a channel was passed.
    176-
    credentials = False
    176+
    credentials = None
    177+
    self._ignore_credentials = True
    177178
    # If a channel was explicitly provided, set it.
    178179
    self._grpc_channel = channel
    179180
    self._ssl_channel_credentials = None

    packages/google-cloud-vpc-access/noxfile.py

    Lines changed: 35 additions & 11 deletions
    Original file line numberDiff line numberDiff line change
    @@ -160,14 +160,28 @@ def install_unittest_dependencies(session, *constraints):
    160160
    session.install("-e", ".", *constraints)
    161161

    162162

    163-
    def default(session):
    163+
    @nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
    164+
    @nox.parametrize(
    165+
    "protobuf_implementation",
    166+
    ["python", "upb", "cpp"],
    167+
    )
    168+
    def unit(session, protobuf_implementation):
    164169
    # Install all test dependencies, then install this package in-place.
    165170

    171+
    if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12"):
    172+
    session.skip("cpp implementation is not supported in python 3.11+")
    173+
    166174
    constraints_path = str(
    167175
    CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
    168176
    )
    169177
    install_unittest_dependencies(session, "-c", constraints_path)
    170178

    179+
    # TODO(https://github.com/googleapis/synthtool/issues/1976):
    180+
    # Remove the 'cpp' implementation once support for Protobuf 3.x is dropped.
    181+
    # The 'cpp' implementation requires Protobuf<4.
    182+
    if protobuf_implementation == "cpp":
    183+
    session.install("protobuf<4")
    184+
    171185
    # Run py.test against the unit tests.
    172186
    session.run(
    173187
    "py.test",
    @@ -181,15 +195,12 @@ def default(session):
    181195
    "--cov-fail-under=0",
    182196
    os.path.join("tests", "unit"),
    183197
    *session.posargs,
    198+
    env={
    199+
    "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
    200+
    },
    184201
    )
    185202

    186203

    187-
    @nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
    188-
    def unit(session):
    189-
    """Run the unit test suite."""
    190-
    default(session)
    191-
    192-
    193204
    def install_systemtest_dependencies(session, *constraints):
    194205
    # Use pre-release gRPC for system tests.
    195206
    # Exclude version 1.52.0rc1 which has a known issue.
    @@ -358,9 +369,16 @@ def docfx(session):
    358369

    359370

    360371
    @nox.session(python="3.12")
    361-
    def prerelease_deps(session):
    372+
    @nox.parametrize(
    373+
    "protobuf_implementation",
    374+
    ["python", "upb", "cpp"],
    375+
    )
    376+
    def prerelease_deps(session, protobuf_implementation):
    362377
    """Run all tests with prerelease versions of dependencies installed."""
    363378

    379+
    if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12"):
    380+
    session.skip("cpp implementation is not supported in python 3.11+")
    381+
    364382
    # Install all dependencies
    365383
    session.install("-e", ".[all, tests, tracing]")
    366384
    unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
    @@ -397,9 +415,9 @@ def prerelease_deps(session):
    397415
    "protobuf",
    398416
    # dependency of grpc
    399417
    "six",
    418+
    "grpc-google-iam-v1",
    400419
    "googleapis-common-protos",
    401-
    # Exclude version 1.52.0rc1 which has a known issue. See https://github.com/grpc/grpc/issues/32163
    402-
    "grpcio!=1.52.0rc1",
    420+
    "grpcio",
    403421
    "grpcio-status",
    404422
    "google-api-core",
    405423
    "google-auth",
    @@ -425,4 +443,10 @@ def prerelease_deps(session):
    425443
    session.run("python", "-c", "import grpc; print(grpc.__version__)")
    426444
    session.run("python", "-c", "import google.auth; print(google.auth.__version__)")
    427445

    428-
    session.run("py.test", "tests/unit")
    446+
    session.run(
    447+
    "py.test",
    448+
    "tests/unit",
    449+
    env={
    450+
    "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
    451+
    },
    452+
    )

    packages/google-cloud-vpc-access/setup.py

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -44,7 +44,7 @@
    4444
    # See https://github.com/googleapis/google-cloud-python/issues/12364
    4545
    "google-auth >= 2.14.1, <3.0.0dev,!=2.24.0,!=2.25.0",
    4646
    "proto-plus >= 1.22.3, <2.0.0dev",
    47-
    "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",
    47+
    "protobuf>=3.20.2,<6.0.0dev,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",
    4848
    ]
    4949
    url = "https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-vpc-access"
    5050

    packages/google-cloud-vpc-access/testing/constraints-3.7.txt

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -7,4 +7,4 @@
    77
    google-api-core==1.34.1
    88
    google-auth==2.14.1
    99
    proto-plus==1.22.3
    10-
    protobuf==3.19.5
    10+
    protobuf==3.20.2

    packages/google-cloud-vpc-access/tests/unit/gapic/vpcaccess_v1/test_vpc_access_service.py

    Lines changed: 4 additions & 24 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1325,12 +1325,7 @@ async def test_create_connector_async_use_cached_wrapped_rpc(
    13251325
    )
    13261326

    13271327
    # Replace cached wrapped function with mock
    1328-
    class AwaitableMock(mock.AsyncMock):
    1329-
    def __await__(self):
    1330-
    self.await_count += 1
    1331-
    return iter([])
    1332-
    1333-
    mock_object = AwaitableMock()
    1328+
    mock_object = mock.AsyncMock()
    13341329
    client._client._transport._wrapped_methods[
    13351330
    client._client._transport.create_connector
    13361331
    ] = mock_object
    @@ -1742,12 +1737,7 @@ async def test_get_connector_async_use_cached_wrapped_rpc(
    17421737
    )
    17431738

    17441739
    # Replace cached wrapped function with mock
    1745-
    class AwaitableMock(mock.AsyncMock):
    1746-
    def __await__(self):
    1747-
    self.await_count += 1
    1748-
    return iter([])
    1749-
    1750-
    mock_object = AwaitableMock()
    1740+
    mock_object = mock.AsyncMock()
    17511741
    client._client._transport._wrapped_methods[
    17521742
    client._client._transport.get_connector
    17531743
    ] = mock_object
    @@ -2131,12 +2121,7 @@ async def test_list_connectors_async_use_cached_wrapped_rpc(
    21312121
    )
    21322122

    21332123
    # Replace cached wrapped function with mock
    2134-
    class AwaitableMock(mock.AsyncMock):
    2135-
    def __await__(self):
    2136-
    self.await_count += 1
    2137-
    return iter([])
    2138-
    2139-
    mock_object = AwaitableMock()
    2124+
    mock_object = mock.AsyncMock()
    21402125
    client._client._transport._wrapped_methods[
    21412126
    client._client._transport.list_connectors
    21422127
    ] = mock_object
    @@ -2691,12 +2676,7 @@ async def test_delete_conn 8146 ector_async_use_cached_wrapped_rpc(
    26912676
    )
    26922677

    26932678
    # Replace cached wrapped function with mock
    2694-
    class AwaitableMock(mock.AsyncMock):
    2695-
    def __await__(self):
    2696-
    self.await_count += 1
    2697-
    return iter([])
    2698-
    2699-
    mock_object = AwaitableMock()
    2679+
    mock_object = mock.AsyncMock()
    27002680
    client._client._transport._wrapped_methods[
    27012681
    client._client._transport.delete_connector
    27022682
    ] = mock_object

    0 commit comments

    Comments
     (0)
    0