Skip to content

Commit a23b2f2

Browse files
committed
ci: remove manual protoc installation, use grpcio-tools instead
The grpcio-tools package bundles a compatible protoc compiler. This ensures the protoc version always matches the protobuf Python package, avoiding version mismatches between generated code and runtime. The Makefile uses 'python -m grpc_tools.protoc' for code generation, which is invoked via 'uv run' to use the virtual environment.
1 parent 528be49 commit a23b2f2

1 file changed

Lines changed: 4 additions & 26 deletions

File tree

.github/scripts/setup.sh

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -71,29 +71,7 @@ uv sync --all-extras --all-groups
7171
# required for reckless till poetry to uv migration
7272
uv tool install poetry
7373

74-
# We also need a relatively recent protobuf-compiler, at least 3.12.0,
75-
# in order to support the experimental `optional` flag.
76-
77-
# BUT WAIT! Gentoo wants this to match the version from the Python protobuf,
78-
# which comes from the same tree. Makes sense!
79-
80-
# And
81-
# grpcio-tools-1.69.0` requires `protobuf = ">=5.26.1,<6.0dev"`
82-
83-
# Now, protoc changed to date-based releases, BUT Python protobuf
84-
# didn't, so Python protobuf 4.21.12 (in Ubuntu 23.04) corresponds to
85-
# protoc 21.12 (which, FYI, is packaged in Ubuntu as version 3.21.12).
86-
87-
# In general protobuf version x.y.z corresponds to protoc version y.z
88-
89-
# Honorable mention go to Matt Whitlock for spelunking this horror with me!
90-
91-
PROTOC_VERSION=29.4
92-
PB_REL="https://github.com/protocolbuffers/protobuf/releases"
93-
curl -LO $PB_REL/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip
94-
sudo unzip protoc-${PROTOC_VERSION}-linux-x86_64.zip -d /usr/local/
95-
sudo chmod a+x /usr/local/bin/protoc
96-
export PROTOC=/usr/local/bin/protoc
97-
export PATH=$PATH:/usr/local/bin
98-
env
99-
ls -lha /usr/local/bin
74+
# We use grpcio-tools which bundles a compatible protoc compiler.
75+
# This ensures the protoc version matches the protobuf Python package,
76+
# avoiding version mismatches between generated code and runtime.
77+
# The Makefile uses `uv run python -m grpc_tools.protoc` for code generation.

0 commit comments

Comments
 (0)