d5h-foss / grpc-interceptor

Simplified Python gRPC interceptors
MIT License
136 stars 21 forks source link

Update to latest and breaking protobuf? #23

Closed jenstroeger closed 1 year ago

jenstroeger commented 1 year ago

Hello, I think this issue may be a bit tricky. According to this change a few things have changed with the latest protobuf package. Issue https://github.com/grpc/grpc/issues/31064 is an illustration of that, and I see something similar with the grpc-interceptor package:

tests/test_interceptors.py:12: in <module>
    from grpc_interceptor.testing import DummyRequest, dummy_client, raises
.venv/lib/python3.10/site-packages/grpc_interceptor/testing/__init__.py:5: in <module>
    from grpc_interceptor.testing.dummy_client import (
.venv/lib/python3.10/site-packages/grpc_interceptor/testing/dummy_client.py:14: in <module>
    from grpc_interceptor.testing.protos import dummy_pb2_grpc
.venv/lib/python3.10/site-packages/grpc_interceptor/testing/protos/dummy_pb2_grpc.py:4: in <module>
    from grpc_interceptor.testing.protos import (
.venv/lib/python3.10/site-packages/grpc_interceptor/testing/protos/dummy_pb2.py:35: in <module>
    _descriptor.FieldDescriptor(
.venv/lib/python3.10/site-packages/google/protobuf/descriptor.py:560: in __new__
    _message.Message._CheckCalledFromGeneratedFile()
E   TypeError: Descriptors cannot not be created directly.
E   If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
E   If you cannot immediately regenerate your protos, some other possible workarounds are:
E    1. Downgrade the protobuf package to 3.20.x or lower.
E    2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
E   
E   More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

It looks to me that integrating that change will be a breaking change for this package as well 🤔

d5h commented 1 year ago

Hi @jenstroeger

This was fixed by https://github.com/d5h-foss/grpc-interceptor/pull/18, so I think all you need to do is update to 0.14.2 or higher. 🙂

I'll close this for now, but if you have issues with a later version feel free to reopen.

jenstroeger commented 1 year ago

Well I be damned 👍🏼 Thanks!