Missing instructions for building Python wheel with upb
What version of protobuf and what language are you using? Version: 21.7 Language: Python OS: Linux
What did you do? I'm trying to build a wheel of protobuf 21.7 with support for PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=upb This is the same as the pre-compiled wheels available on PyPI.
The existing documentation only shows how to build with the legacy c++ implementation: https://github.com/protocolbuffers/protobuf/blob/main/python/README.md
I can produce the upb module with bazel build @upb//python:_message but python/setup.py doesn't seem to have a way to install or package it with the Python code.
I think you want:
$ bazel build -c opt @upb//python/dist:binary_wheel
That will build a wheel for whatever Python you have installed on your system.
For release we cross-compile this for all the different verisons/OS's using bazel build --crosstool_top=//toolchain:clang_suite --host_crosstool_top=@bazel_tools//tools/cpp:toolchain -c opt @upb//python/dist, but that requires our Docker image that has all the cross-compilers installed.
$ bazel build -c opt @upb//python/dist:binary_wheel
That works, Thank You! I must confess I have minimal knowledge of bazel.
It may be instructive to have the deployment scripts on github (Docker and all) if they're not already there.
Would that be somewhere under kokoro?
Our docker files are not currently open sourceable in their current form, sadly. They contain some proprietary libraries we cannot release, yet.
python/README still doesn't cover building a wheel that bundles the upb extension.
The bazel command above can be documented without having to share any proprietary code.