grpc-requests / grpc_requests

python grpc reflection client
https://pypi.org/project/grpc-requests/
Apache License 2.0
32 stars 5 forks source link

Get dependencies from original symbol or file lookup #67

Closed artificial-aidan closed 7 months ago

artificial-aidan commented 7 months ago

Background here: https://github.com/grpc/grpc/issues/32899

Because most use cases will require also requesting the transitive dependencies of requested files, the queries will also return all transitive dependencies of the returned file.

The logic isn't my best work, so definitely open to input on that. The gist of it is to use the file descriptor protos that are returned in the dependency resolution, but the spec didn't specify an order, so I had to do extra logic around lookup. I may go look at how other languages to it, to see if they unofficially assume the order of dependencies will be correct.

This is just the async side, if the feedback is good I'm happy to port it to the sync side as well.

Another change I made was for the test files. I used an empty descriptor pool for the client creation, I found that the descriptors were already loaded, and the test's weren't actually exercising the lookup functionality. I believe this is because the test process loads the server, which loads the protos into its pool. By using an empty pool for the client, we force the exercising of the lookup mechanisms.

Additionally, an optional skip_check_method_available was added to the clients. This follows the above in trying to optimize the speed at which we can reflect and call a method.

ViridianForge commented 7 months ago

@artificial-aidan - just wanted to let you know that I'll give this a thorough review tomorrow night. Thanks for all this work!

artificial-aidan commented 7 months ago

@ViridianForge Cleaned some stuff up, addressed comments, and added a sync implementation

artificial-aidan commented 7 months ago

That's all for now! Thanks for reviewing it.