You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @Srivathsan-V, So recently protobuf>4 is a major release, which breaks all of the generated code for cases where library uses protobuf<4 (protobuf>=3.19).
Currently, BentoML generates proto stubs for our gRPC components using protobuf==3.19.6. This is fine since the majority of the library out there that uses protobuf will still be on protobuf 3 for the time being.
With that being said, if users are using protobuf >4, they wouldn't able to use gRPC features from BentoML.
So the idea here is to generate two sets of protofiles, one using protobuf==3.19.4, and the other using protobuf>4.
BentoML can provide a compact layer that check for current protobuf version
frombentoml._internal.utils.pkgimportget_pkg_versionifget_pkg_version("protobuf")[0] <4:
# import generated stubs for protobuf==3.19.6 hereelse:
# import generated stubs from protobuf>4 here
This is where we are currently handle the generated stubs. So the check would be from here.
Another good thing to note is that the generated stubs are currently under bentoml/grpc/v1alpha1/service_pb2.py
If we introduce this compact layer, we might have to change our folder structure. But I'm open for suggestion on this as well.
Feature request
protobuf > 4 introduces a lot of breaking changes, therefore to ease the transition, I propose to have two sets of generated service stubs.
We lazy load all of our stubs imports via
import_generated_stubs
. I believe we can do one more step here:If protobuf >4, it should be able to use the newly generated stubs structure. Otherwise, it will, by default, use the stubs generated with protobuf<4
One drawback is that users will still run into issues with protobuf error if some of the library other than bentoml still uses older generated stubs.
Motivation
No response
Other
No response
The text was updated successfully, but these errors were encountered: