Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update auto-generated *_pb2.py files #142

Merged
merged 1 commit into from
Aug 24, 2021
Merged

Conversation

ods
Copy link
Contributor

@ods ods commented Aug 23, 2021

Without this update we get warnings when using reflection or health:

  File "/usr/local/lib/python3.8/site-packages/grpclib/reflection/service.py", line 27, in <module>
    from .v1.reflection_pb2 import ServerReflectionRequest, ServerReflectionResponse
  File "/usr/local/lib/python3.8/site-packages/grpclib/reflection/v1/reflection_pb2.py", line 16, in <module>
    DESCRIPTOR = _descriptor.FileDescriptor(
  File "/usr/local/lib/python3.8/site-packages/google/protobuf/descriptor.py", line 993, in __init__
    _Deprecated('FileDescriptor')
  File "/usr/local/lib/python3.8/site-packages/google/protobuf/descriptor.py", line 98, in _Deprecated
    warnings.warn(
DeprecationWarning: Call to deprecated create function FileDescriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.

@vmagamedov
Copy link
Owner

This deprecation warning is caused by old protobuf package, not by old stub files. I intentionally didn't wanted to regenerate new stub files for backward compatibility. Google broke backward compatibility in their stub files, you can't use new stub files with older protobuf package (before 3.12.0). I also wasn't able to find any improvements in new stub files, but it was a long time ago.

In order to suppress these warnings I propose to upgrade protobuf package in the project requirements files.

@vmagamedov
Copy link
Owner

Hmm, there are warnings in the source code:

https://github.com/protocolbuffers/protobuf/blob/4f49062a95f18a6c7e21ba17715a2b0a4608151a/python/google/protobuf/descriptor.py#L576-L577

But they don't work when you use C implementation of protobuf. Python 3.9 and protobuf==3.17.3:

$ python -W default -c "import grpclib.health.v1.health_pb2"
$ PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python python -W default -c "import grpclib.health.v1.health_pb2"
grpclib/health/v1/health_pb2.py:16: DeprecationWarning: Call to deprecated create function FileDescriptor(). Note: Create unlinked descriptors is going to go away. Please use get/find descriptors from generated code or query the descriptor_pool.
  DESCRIPTOR = _descriptor.FileDescriptor(
...

@vmagamedov vmagamedov merged commit db299aa into vmagamedov:master Aug 24, 2021
@ods ods deleted the update_proto branch August 24, 2021 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants