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

gRPC code isn't (re)generated for protos containing service definitions #12

@boimart1

Description

@boimart1

I found that when trying to implement the LongRunning Operations service, there was no OperationsServicer base class in the generated code, only the OperationsStub class.

I would normally expect this class (and the add_OperationsServicer_to_server() method) to be generated: https://grpc.io/docs/languages/python/generated-code/

What I noticed upon inspection of this repository is that the file google/longrunning/operations_grpc_pb2.py only has the OperationsStub class. Additionally, in noxfile.py, the generate_protos() method never actually regenerates the grpc generated code. A --grpc_python_out argument would be required somewhere in the grpctools.protoc call.

Environment details

  • OS type and version: Windows 10 x64
  • Python version: 3.8.1
  • pip version: 20.0.2
  • googleapis-common-protos version: 1.52.0

Steps to reproduce

Attempt to use the expected OperationsServicer class, as in the following snippet.

Code example

from google.longrunning import operations_pb2
class Servicer(operations_pb2.OperationsServicer):
    pass

Stack trace

(.venv) λ py operation_service.py
Traceback (most recent call last):
  File "operation_service.py", line 3, in <module>
    class Service(operations_pb2.OperationsServicer):
AttributeError: module 'google.longrunning.operations_pb2' has no attribute 'OperationsServicer'

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions