-
Notifications
You must be signed in to change notification settings - Fork 554
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
feat: Upgrade to protobuf 27.0 and remove py_proto_library #1933
Conversation
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.
Please also add an entry to CHANGELOG.md to note that the rules_python proto rules are deprecated and will be removed in a future release.
CI has a failure when compiling protos. My guess would be the those builds don't have the additional compiler flags that were added. But, this would imply that all users also have to add those flags? That doesn't seem feasible. Can protobuf add those compile flags instead itself?
load("@rules_proto//proto:defs.bzl", "proto_library") | ||
load("@rules_python//python:proto.bzl", "py_proto_library") | ||
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library") | ||
load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library") |
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.
The python rules are in the protobuf repo directly, not in a python-specific repo? I thought I remember seeing a BCR PR where they were adding various proto_{java,python,etc} repos so e.g. java wasn't pulled in when only python was used.
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.
The python rules are in the protobuf repo directly, not in a python-specific repo?
Yes.
BCR PR where they were adding various proto_{java,python,etc} repos
Hm, do you mean rules_proto_grpc_*
? I imagine those support gRPC, but I wasn't part of that effort.
@@ -35,9 +34,6 @@ def rules_python_internal_setup(): | |||
|
|||
bazel_skylib_workspace() | |||
|
|||
rules_proto_dependencies() |
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.
For workspace builds, shouldn't there be some sort of proto-setup call still? Did I miss where it is?
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 a protobuf_deps
call just after. We only need to setup protobuf, now that the rules are moving there.
I've referenced a lot of issues that have to do with proto library rule, feel free to disagree and alter the list if some of them are out of place. |
Done.
I see 3 possible options:
The last option is something that will be done in protobuf. It was done previously in rules_proto, but in an awkward and unmaintained way. |
@comius, when are you going to work on using the precompiled binaries? I wonder if we should merge this PR after that part is fixed. |
I hope we don't have to wait, because this PR also removes dependency on extra old protobuf that uses legacy struct providers. I'd like to disable that support in Bazel and that would then break rules_python. Old py_proto_library is getting precompiled protoc from a really old version of rules_proto, which was never properly maintained. |
Note that due to protocolbuffers/protobuf#17075 this caused a regression - the latest rules_python release has a |
…ild#1933) This reverts commit d0e25cf. We have the following concerns with the associated change: - `sphinxdocs` is excluded entirely. Because protobuf fails to compile? But why? Protos are needed as part of our docgen, but it is unclear how the docgen is still working. Maybe we can get some clarification here? - The `py_proto_library` tests in the `bzlmod` example are excluded from CI. Because protos also fail to compile? But why? It's an example and should Just Work. - Adding the `copts` needs to be done by all downstream users now. But fixing that in protobuf blocks removing legacy struct providers? I don't understand the connection. Also @alexeagle noted extra [regression](bazelbuild#1933 (comment)) being caused by the associated PR. Reverting in order to unblock a new release of `rules_python` and then we can work together with @comius on reverting the revert.
@comius FYI we're going to revert this PR for now. The main reason is what @alexeagle is reporting -- that users will be stuck on a release without a way to upgrade. Breaking changes are OK, but have to allow a graceful upgrade path; see https://rules-python.readthedocs.io/en/latest/contributing.html#breaking-changes From the issue Alex filed, it sounds like part of the problem here is sequencing of releases? That this PR to be released after something else in proto-something is available? That said, there are several other changes in this PR I have questions about:
|
…1948) This reverts commit d0e25cf. We have the following concerns with the associated change: - `sphinxdocs` is excluded entirely. Because protobuf fails to compile? But why? Protos are needed as part of our docgen, but it is unclear how the docgen is still working. Maybe we can get some clarification here? - The `py_proto_library` tests in the `bzlmod` example are excluded from CI. Because protos also fail to compile? But why? It's an example and should Just Work. - Adding the `copts` needs to be done by all downstream users now. But fixing that in protobuf blocks removing legacy struct providers? I don't understand the connection. Also @alexeagle noted extra [regression](#1933 (comment)) being caused by the associated PR. Reverting in order to unblock a new release of `rules_python` and then we can work together with @comius on reverting the revert. Reverts #1933
It was disabled only on some platforms with GCC. Not on all of them.
Same here.
Try running rules_python build with --incompatible_disallow_struct_provider_syntax and the connection will become clear. Struct providers are used in an extra old protoc, that's coming from rules_proto. |
I'll try to clarify: We announced that Python is working, but the fork of With my devrel hat on, I'd like to see that fix released by protobuf before rules_python drops the rule so this feature doesn't temporarily regress - it's hard to explain to users "yeah it was fixed, but then it was unfixed, and you're on this one release of rules_python in that range, sorry footgun..." |
Thanks @alexeagle, @comius So if I understand correctly, we just have to wait for the next protobuf release, and then can re-merge this change? Will the protobuf fix also address having to add the copt flag and the various CI config changes that were necessary? Is that it, or should something also be done in the meantime? (opt-in env var? bump rules_proto or protobuf version past 21 but before 27? idk). |
aspect-build/toolchains_protoc#13 demonstrates the breakage caused by the PR, for users who don't have cc toolchain.
Yes, next protobuf release fixes the
I don't have context on that, and don't care about their compiler options for building |
Created a new PR and added all of you as reviewers: #1951. |
Protobuf team is taking ownership of
py_proto_library
and the implementation was moved to protobuf repository.Remove py_proto_library from rules_python, to prevent divergent implementations.
Make a redirect with a deprecation warning, so that this doesn't break any users.
Expected side effect of this change is also that the protobuf version is sufficiently updated that there is no more use of legacy struct providers.
Closes #1935
Closes #1924
Closes #1925
Closes #1703
Closes #1707
Closes #1597
Closes #1293
Closes #1080
Fixes #1438