Skip to content

UserWarnings emitted from all protoc-generated _pb2 packages #37609

@mtnpke

Description

@mtnpke

What version of gRPC and what language are you using?

Python

Package versions:

  • grpcio 1.66.1
  • grpcio-tools 1.66.1

What operating system (Linux, Windows,...) and version?

Windows 11 Version 23H2 (OS Build 22631.4037)

What runtime / compiler are you using (e.g. python version or version of gcc)

Python 3.12.4 (tags/v3.12.4:8e8a4ba, Jun 6 2024, 19:30:16) [MSC v.1940 64 bit (AMD64)] on win32

What did you do?

  • Create clean virtual environment with Python 3.12
  • Run pip install grpcio grpcio-tools (as of today, this will install version 1.66.1)
  • Create file test.proto that only contains syntax = "proto3";
  • Run python -m grpc_tools.protoc --python_out=. --pyi_out=. --grpc_python_out=. -I. test.proto

What did you expect to see?

I can import the generated Python files without issues and warnings.

What did you see instead?

>>> import test_pb2
C:\temp\grpc-test\venv\Lib\site-packages\google\protobuf\runtime_version.py:112: UserWarning: Protobuf gencode version 5.27.2 is older than the runtime version 5.28.0 at test.proto. Please avoid checked-in Protobuf gencode that can be obsolete.
  warnings.warn(
>>>

Anything else we should know about your project / environment?

Caused by this pull request: protocolbuffers/protobuf#17241 that is present since protobuf 5.28.0

gprc protoc uses protobuf 5.27.2 for generation, but pip automatically pulls in the newest version (5.28.0), generating this warning.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions