Link in UPB by default for Bazel's python build rules. #19836
+155
−293
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Link in UPB by default for Bazel's python build rules.
In v21.x, we announced our intent to flip the default implementation of
protobuf python from pure python to upb.
We also documented in docs and readme that
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION env var can be set to override the
python implementation used.
In practice, we only use upb if it can successfully be imported:
protobuf/python/google/protobuf/internal/api_implementation.py
Line 54 in 1c29f34
protobuf/python/google/protobuf/internal/api_implementation.py
Line 100 in 1c29f34
Otherwise, we fall back to pure python, even if the env var is set to upb.
Since we don't currently link in upb for Bazel, this means the default is
still pure python in practice and the environment variable is not respected.
This change links in UPB by default and ensures that default python builds and
unit tests using Bazel will enable running with python-UPB.
#test-continuous