GeezerVison is showing github.com — chore: Add protobuf 7.x support · hamgor/python-aiplatform@10e76da
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform/_streaming_prediction.py +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -38,12 +38,12 @@ def value_to_tensor(value: Any) -> aiplatform_types.Tensor: | 38 | 38 | """ | 39 | 39 | if value is None: | 40 | 40 | return aiplatform_types.Tensor() | | 41 | + elif isinstance(value, bool): | | 42 | + return aiplatform_types.Tensor(bool_val=[value]) | 41 | 43 | elif isinstance(value, int): | 42 | 44 | return aiplatform_types.Tensor(int_val=[value]) | 43 | 45 | elif isinstance(value, float): | 44 | 46 | return aiplatform_types.Tensor(float_val=[value]) | 45 | | - elif isinstance(value, bool): | 46 | | - return aiplatform_types.Tensor(bool_val=[value]) | 47 | 47 | elif isinstance(value, str): | 48 | 48 | return aiplatform_types.Tensor(string_val=[value]) | 49 | 49 | elif isinstance(value, bytes): | |
Collapse file Copy file name to clipboardExpand all lines: setup.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 322 | 322 | "google-auth >= 2.47.0, <3.0.0", | 323 | 323 | "certifi >= 2023.7.22", | 324 | 324 | "proto-plus >= 1.22.3, <2.0.0", | 325 | | - "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", | | 325 | + "protobuf>=3.20.2,<8.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", | 326 | 326 | "packaging >= 14.3", | 327 | 327 | "google-cloud-storage >= 1.32.0, < 4.0.0; python_version<'3.13'", | 328 | 328 | "google-cloud-storage >= 3.10.0, < 4.0.0; python_version>='3.13'", | |
Collapse file Copy file name to clipboardExpand all lines: testing/constraints-3.14.txt +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | # -*- coding: utf-8 -*- | 2 | 2 | # This constraints file is required for unit tests. | 3 | 3 | # List all library dependencies and extras in this file. | 4 | | -google-api-core==2.27.0 | 5 | 4 | google-auth==2.49.0 | 6 | 5 | proto-plus | 7 | 6 | mock==4.0.2 | @@ -13,4 +12,5 @@ ipython==8.22.2 # Pinned to unbreak TypeAliasType import error | 13 | 12 | google-adk==0.0.2 | 14 | 13 | google-genai>=1.10.0 | 15 | 14 | google-vizier==0.1.21 | 16 | | -pyarrow>=22.0.0 | | 15 | +pyarrow>=22.0.0 | | 16 | +protobuf>=7 |
Collapse file Copy file name to clipboardExpand all lines: testing/constraints-3.8.txt -16Lines changed: 0 additions & 16 deletions Collapse file Copy file name to clipboardExpand all lines: testing/constraints-3.9.txt -15Lines changed: 0 additions & 15 deletions Collapse file Copy file name to clipboard +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +protobuf<5.0.0 |
Collapse file Copy file name to clipboardExpand all lines: tests/unit/aiplatform/test_initializer.py +11-20Lines changed: 11 additions & 20 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -385,12 +385,9 @@ def test_create_client_user_agent(self): | 385 | 385 | client_class=utils.ModelClientWithOverride | 386 | 386 | ) | 387 | 387 |
| 388 | | - for wrapped_method in client._transport._wrapped_methods.values(): | 389 | | - # wrapped_method._metadata looks like: | 390 | | - # [('x-goog-api-client', 'model-builder/0.3.1 gl-python/3.7.6 grpc/1.30.0 gax/1.22.2 gapic/0.3.1')] | 391 | | - user_agent = wrapped_method._metadata[0][1] | 392 | | - assert "model-builder/" in user_agent | 393 | | - assert "google.cloud.aiplatform" in user_agent | | 388 | + user_agent = client._client_info.to_user_agent() | | 389 | + assert "model-builder/" in user_agent | | 390 | + assert "google.cloud.aiplatform" in user_agent | 394 | 391 |
| 395 | 392 | def test_create_client_user_agent_top_level_method(self): | 396 | 393 | initializer.global_config.init(project=_TEST_PROJECT, location=_TEST_LOCATION) | @@ -404,14 +401,11 @@ def __init__(self): | 404 | 401 | client_class=utils.ModelClientWithOverride | 405 | 402 | ) | 406 | 403 |
| 407 | | - for wrapped_method in SomeClass()._client._transport._wrapped_methods.values(): | 408 | | - # wrapped_method._metadata looks like: | 409 | | - # [('x-goog-api-client', 'model-builder/0.3.1 gl-python/3.7.6 grpc/1.30.0 gax/1.22.2 gapic/0.3.1')] | 410 | | - user_agent = wrapped_method._metadata[0][1] | 411 | | - assert ( | 412 | | - f"+{initializer._TOP_GOOGLE_CONSTRUCTOR_METHOD_TAG}+vertexai.SomeClass.__init__" | 413 | | - in user_agent | 414 | | - ) | | 404 | + user_agent = SomeClass()._client._client_info.to_user_agent() | | 405 | + assert ( | | 406 | + f"+{initializer._TOP_GOOGLE_CONSTRUCTOR_METHOD_TAG}+vertexai.SomeClass.__init__" | | 407 | + in user_agent | | 408 | + ) | 415 | 409 |
| 416 | 410 | def test_create_client_appended_user_agent(self): | 417 | 411 | appended_user_agent = ["fake_user_agent", "another_fake_user_agent"] | @@ -421,12 +415,9 @@ def test_create_client_appended_user_agent(self): | 421 | 415 | appended_user_agent=appended_user_agent, | 422 | 416 | ) | 423 | 417 |
| 424 | | - for wrapped_method in client._transport._wrapped_methods.values(): | 425 | | - # wrapped_method._metadata looks like: | 426 | | - # [('x-goog-api-client', 'model-builder/0.3.1 gl-python/3.7.6 grpc/1.30.0 gax/1.22.2 gapic/0.3.1')] | 427 | | - user_agent = wrapped_method._metadata[0][1] | 428 | | - assert " " + appended_user_agent[0] in user_agent | 429 | | - assert " " + appended_user_agent[1] in user_agent | | 418 | + user_agent = client._client_info.to_user_agent() | | 419 | + assert " " + appended_user_agent[0] in user_agent | | 420 | + assert " " + appended_user_agent[1] in user_agent | 430 | 421 |
| 431 | 422 | def test_set_api_endpoint(self): | 432 | 423 | initializer.global_config.init( | |
|