profile
viewpoint

googleapis/gapic-generator-python 71

Generate Python API client libraries from Protocol Buffers.

kbandes/app-engine-chat-room 0

A simple chat room designed to be a starter point for students learning App Engine.

kbandes/gapic-generator-python 0

Generate Python API client libraries from Protocol Buffers.

kbandes/gapic-showcase 0

An API that demonstrates Generated API Client (GAPIC) features and common API patterns used by Google.

push eventgoogleapis/gapic-generator-python

Ken Bandes

commit sha 0705d9c5dbbea793867551e64991be37d8339c6b

fix: ensure rest unit tests have complete coverage (#1098) * fix: rest paging and lro client tests weren't working. * fix: fix coverage gaps in rest unit tests. * fix: refactor required fields code to move update out of static method. * fix: test that api method with required fields handles them correctly. * fix: removed extra parens from an expression in a test. Co-authored-by: Kenneth Bandes <kbandes@google.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>

view details

push time in 4 days

PR merged googleapis/gapic-generator-python

fix: ensure rest unit tests have complete coverage cla: yes

This PR fixes gaps in the coverage of the generated unit tests, specifically when the rest transport is included.

This required refactoring the logic for required field handling into a separate static method corresponding to each API method with required fields in its request message. This allows that method to tested thoroughly without elaborate and repetitive mocking.

The intention for these changes is that the nox showcase_unit session should include both grpc and rest transports. However, there are several requirements before the noxfile should be changed:

  1. The version of api_core with the rest operations client should be released (added in https://github.com/googleapis/python-api-core/pull/311, not yet released).
  2. The missing signature field fix in showcase should be released (fixed in https://github.com/googleapis/gapic-showcase/pull/930, not yet released).
  3. The extended operations module should be moved to api_core and released (no PR yet that I know of).

Once these changes are release, the noxfile for the present repo should be updated to reference those releases. At that point, a full unit test of showcase with transport=grpc+rest should succeed and provide 100% coverage.

+174 -39

0 comment

8 changed files

kbandes

pr closed time in 4 days

push eventkbandes/gapic-generator-python

Kenneth Bandes

commit sha 7cd6d7bd53a340315f9e5fcfec502cb7672d029c

fix: removed extra parens from an expression in a test.

view details

push time in 4 days

Pull request review commentgoogleapis/gapic-generator-python

fix: ensure rest unit tests have complete coverage

 def test_{{ method_name }}_rest(transport: str = 'rest', request_type={{ method.     {% endif %}  +    {% if method.input.required_fields %}

Okay, I've added logic to test the actual api method with default-valued required fields.

kbandes

comment created time in 4 days

PullRequestReviewEvent

push eventkbandes/gapic-generator-python

Kenneth Bandes

commit sha 563de4f88a5a9f5916be07d1789c0f9bb1d085be

fix: test that api method with required fields handles them correctly.

view details

push time in 4 days

Pull request review commentgoogleapis/gapic-generator-python

fix: ensure rest unit tests have complete coverage

 def test_{{ service.name|snake_case }}_rest_lro_client():     # Ensure that we have a api-core operations client.     assert isinstance(         transport.operations_client,-        operations_v1.OperationsClient,+        operations_v1.AbstractOperationsClient,

Regarding related PRs: I'm not sure. I believe other people are making these changes and releasing them, I'm not sure of the timeline or PR numbers. The change to noxfile.py is small, but I won't know exactly how to do it until I know what the actual release numbers for showcase and api-core are.

kbandes

comment created time in 4 days

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentgoogleapis/gapic-generator-python

fix: ensure rest unit tests have complete coverage

 def test_{{ method_name }}_rest(transport: str = 'rest', request_type={{ method.     {% endif %}  +    {% if method.input.required_fields %}

I'm not sure what to do here. No code is un-covered. I would argue that testing this logic in the context of the api method itself doesn't necessarily add anything.

kbandes

comment created time in 4 days

Pull request review commentgoogleapis/gapic-generator-python

fix: ensure rest unit tests have complete coverage

 class {{service.name}}RestTransport({{service.name}}Transport):     {% endif %}{# service.has_lro #}     {% for method in service.methods.values() %}     {%- if method.http_options and not (method.server_streaming or method.client_streaming) %}++    {% if method.input.required_fields %}+    @staticmethod+    def _{{ method.name | snake_case }}_populate_required_fields(message_dict):

Done.

kbandes

comment created time in 4 days

PullRequestReviewEvent

Pull request review commentgoogleapis/gapic-generator-python

fix: ensure rest unit tests have complete coverage

 def test_{{ service.name|snake_case }}_rest_lro_client():     # Ensure that we have a api-core operations client.     assert isinstance(         transport.operations_client,-        operations_v1.OperationsClient,+        operations_v1.AbstractOperationsClient,

This was at the request of software-dov.

kbandes

comment created time in 4 days

PullRequestReviewEvent

push eventkbandes/gapic-generator-python

Kenneth Bandes

commit sha 0325e3b7bf27ede4c8a93860efe13b24ac354ff5

fix: refactor required fields code to move update out of static method.

view details

push time in 4 days

Pull request review commentgoogleapis/gapic-generator-python

fix: ensure rest unit tests have complete coverage

 def test_{{ method_name }}_rest(transport: str = 'rest', request_type={{ method.     {% endif %}  +    {% if method.input.required_fields %}

Oh, I see, once we refactor as you describe above. This is quite tricky to test, which is a lot of motivation for these changes. The problem is that typically, though not always, a required field is going to have an expected template in the http rule, so the default value will cause the transcoding to fail. This can be worked around by mocking the transcoding function, but it gets convoluted and ugly.

kbandes

comment created time in 5 days

PullRequestReviewEvent

Pull request review commentgoogleapis/gapic-generator-python

fix: ensure rest unit tests have complete coverage

 class {{service.name}}RestTransport({{service.name}}Transport):     {% endif %}{# service.has_lro #}     {% for method in service.methods.values() %}     {%- if method.http_options and not (method.server_streaming or method.client_streaming) %}++    {% if method.input.required_fields %}+    @staticmethod+    def _{{ method.name | snake_case }}_populate_required_fields(message_dict):

I can make this change.

kbandes

comment created time in 5 days

PullRequestReviewEvent

Pull request review commentgoogleapis/gapic-generator-python

fix: ensure rest unit tests have complete coverage

 def test_{{ method_name }}_rest(transport: str = 'rest', request_type={{ method.     {% endif %}  +    {% if method.input.required_fields %}

I'm not sure what you mean. Which method is hidden?

kbandes

comment created time in 5 days

PullRequestReviewEvent

PR opened googleapis/gapic-generator-python

fix: ensure rest unit tests have complete coverage

This PR fixes gaps in the coverage of the generated unit tests, specifically when the rest transport is included.

This required refactoring the logic for required field handling into a separate static method corresponding to each API method with required fields in its request message. This allows that method to tested thoroughly without elaborate and repetitive mocking.

The intention for these changes is that the nox showcase_unit session should include both grpc and rest transports. However, there are several requirements before the noxfile should be changed:

  1. The version of api_core with the rest operations client should be released.
  2. The missing signature field fix in showcase should be released.
  3. The extended operations module should be moved to api_core and released.

Once these changes are release, the noxfile for the present repo should be updated to reference those releases. At that point, a full unit test of showcase with transport=grpc+rest should succeed and provide 100% coverage.

+108 -24

0 comment

2 changed files

pr created time in 5 days

push eventkbandes/gapic-generator-python

Kenneth Bandes

commit sha a68869377c3ca03a60dc7b68bd73643d8fd1da5f

fix: rest paging and lro client tests weren't working.

view details

Kenneth Bandes

commit sha 4819de697451a3204e03e75dab14a824f5e0f053

fix: fix coverage gaps in rest unit tests.

view details

push time in 5 days

push eventkbandes/gapic-generator-python

Ken Bandes

commit sha e89fd23609625c5aa49acd6c6ee67f87fce324fd

feat: add support for long-running operations with rest transport. (#1094) * feat: add support for long-running operations with rest transport. * Update gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 Co-authored-by: Anthonios Partheniou <partheniou@google.com> * Update gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 Co-authored-by: Anthonios Partheniou <partheniou@google.com> * fix: address review comments * fix: rename rest operations client, fix rest lro unit tests * fix: removed extra space in assignment * fix: update goldens for integration tests due to template changes. Co-authored-by: Kenneth Bandes <kbandes@google.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>

view details

push time in 7 days

delete branch kbandes/gapic-generator-python

delete branch : kbandes-lro

delete time in 11 days

push eventgoogleapis/gapic-generator-python

Ken Bandes

commit sha e89fd23609625c5aa49acd6c6ee67f87fce324fd

feat: add support for long-running operations with rest transport. (#1094) * feat: add support for long-running operations with rest transport. * Update gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 Co-authored-by: Anthonios Partheniou <partheniou@google.com> * Update gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 Co-authored-by: Anthonios Partheniou <partheniou@google.com> * fix: address review comments * fix: rename rest operations client, fix rest lro unit tests * fix: removed extra space in assignment * fix: update goldens for integration tests due to template changes. Co-authored-by: Kenneth Bandes <kbandes@google.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>

view details

push time in 11 days

PR merged googleapis/gapic-generator-python

feat: add support for long-running operations with rest transport. cla: yes

This PR adds support for long-running operations in the rest transport. Some noteworthy points:

  • the python gapic generator now reads the service yaml file for an api, using a new service_yaml parameter in py_gapic_library targets. The content of this file is loaded into a google.api.Service proto and is available in the schema as the API.service_yaml_config property. This can, in the future, support other features that rely on information in this file. Note that the java, golang, php, and nodejs targets already have this parameter.

  • In addition to unit tests, this change has been tested against a live server using the cloud translate api. Note that this change is dependent upon https://github.com/googleapis/python-api-core/pull/311.

+178 -36

3 comments

10 changed files

kbandes

pr closed time in 11 days

PR merged googleapis/python-api-core

Reviewers
feat: add operations rest client to support long-running operations. cla: yes

This PR adds a rest client for the Operations service under each API.

This client is a modified version of the auto-generated gapic client for google.longrunning.Operation. The modifications make the operations rest client method signatures compatible with the grpc client.

+2319 -1

4 comments

7 changed files

kbandes

pr closed time in 11 days

push eventgoogleapis/python-api-core

Ken Bandes

commit sha ce1adf395982ede157c0f25a920946bb52789873

feat: add operations rest client to support long-running operations. (#311) * feat: add operations rest client to support long-running operations. * fix: address test coverage gaps in operations rest client. * fix: removed stray print statement. * fix: address lint, blacken, and mypy issues. * fix: address pytype, more coverage issues * fix: addressed additional pytype issues and one coverage line. * fix: renamed OperationsRestClient to AbstractOperationsClient. Co-authored-by: Kenneth Bandes <kbandes@google.com>

view details

push time in 11 days

push eventkbandes/gapic-generator-python

Kenneth Bandes

commit sha 79a6667fc7c4c1cabea173cc8a528141f842fe17

fix: update goldens for integration tests due to template changes.

view details

push time in 12 days

more