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.
Dear maintainers,
this PR fixes a problem which I encountered when using metricq-python not via pip.
Note that as this tests the installation process, for which unit testing is not implemented in metricq-python:
There are no tests included in this PR. I am confident that manual review will be sufficient for this small change.
How well this approach will work in practice is not clear to me, as it requires an exact match of the protobuf version during runtime.
However, it is the best solution I came up with given the circumstances.
Description:
During the build process, protoc is invoked to build protobuf files. These built files are deployed to users, and thus the users require a compatible python-protobuf version at runtime.
For that, the required protobuf version is set during the build process in setup.py. However, this version selection is not up to date with the versioning scheme used by protobuf. protobuf keeps the major version independent between languages, and minor/patch versions in sync. E.g., as of the time of writing, python-protobuf 4.21.12 is compatible with libprotoc 3.21.12.
see: https://protobuf.dev/news/2022-05-06/
However, it is not clear under which circumstances these versions are compatible to each other. (I.e., even if minor/patch version are different, the binary format may still be compatible.) This makes correctly predicting the required (potentially unrealeased) python-protobuf version impossible.
This patch takes a conservative approach: It manually ensures that minor/patch versions align during build, and then requires the exact python-protobuf used during building also during runtime. As a consequence, only readily available python-protobuf versions should be used during building, in order to prevent complications for users.