-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relax protobuf<5.0.0
restriction
#6888
Conversation
de0d9c9
to
39460eb
Compare
experiment_id, | ||
request_proto, | ||
).run() | ||
current_protobuf_version = importlib_version("protobuf") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a util that we can use as a one-line call in all of these places, and abstract this detail away.
It's annoying that we'd need a separate file and all the overhead of the build file and all, but I think it's a more maintainable solution and results in cleaner code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's already a plugin_util
module, so I added it there (and added some tests).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for not being clear. I was thinking more like a "proto_to_json" method, so the package checking is abstracted away from the code that just needs to convert the proto to a string, and the code elsewhere can be just a one-line method call. Sorry for the churn.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated to just have a proto_to_json
method, but I've only used it for these two specific instances that use a deprecated field conditionally. There are probably other calls to MessageToJson
throughout the codebase that don't need the conditional handling, but avoiding touching those as part of this PR.
# NOTE: this version must be >= the protoc version in our WORKSPACE file. | ||
# At the same time, any constraints we specify here must allow at least some | ||
# version to be installed that is also compatible with TensorFlow's constraints: | ||
# https://github.com/tensorflow/tensorflow/blob/25adc4fccb4b0bb5a933eba1d246380e7b87d7f7/tensorflow/tools/pip_package/setup.py#L101 | ||
# 4.24.0 had an issue that broke our tests, so we should avoid that release: | ||
# https://github.com/protocolbuffers/protobuf/issues/13485 | ||
# 5.26.0 introduced a breaking change, so we restricted it for now. See issue #6808 for details. | ||
protobuf >= 3.19.6, != 4.24.0, < 5.0.0 | ||
protobuf >= 3.19.6, != 4.24.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we should add a TODO or a comment somewhere, to remove the packaging
dependency and restrict this to >= 5.0.0 after it's been available for a while or something?
I worry that if at some point we remove this logic to check for protobuf version, we won't realize that we also could remove the packaging dependency, as it was only used there. Maybe there is some tooling that would let us know this... maybe we can add a small comment right next to that package. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, added a comment specifying that if we bump protobuf >= 5.0.0, we can also remove the packaging dependency.
de4c2b1
to
5245f9b
Compare
Instead of restricting `protobuf<5.0.0` due to the removal to `including_default_value_fields` kwarg in `json_format.MessageToJson` (replaced by `always_print_fields_with_nopresence`), we can instead detect the currently installed protobuf version and use the appropriate kwarg. Contributes to tensorflow#6808 and should resolve tensorflow#6887.
Instead of restricting `protobuf<5.0.0` due to the removal to `including_default_value_fields` kwarg in `json_format.MessageToJson` (replaced by `always_print_fields_with_nopresence`), we can instead detect the currently installed protobuf version and use the appropriate kwarg. Contributes to tensorflow#6808 and should resolve tensorflow#6887.
Instead of restricting `protobuf<5.0.0` due to the removal to `including_default_value_fields` kwarg in `json_format.MessageToJson` (replaced by `always_print_fields_with_nopresence`), we can instead detect the currently installed protobuf version and use the appropriate kwarg. Contributes to #6808 and should resolve #6887.
Instead of restricting
protobuf<5.0.0
due to the removal toincluding_default_value_fields
kwarg injson_format.MessageToJson
(replaced byalways_print_fields_with_nopresence
), we can instead detect the currently installed protobuf version and use the appropriate kwarg.Contributes to #6808 and should resolve #6887.