我发现使用google的客户端库很容易,很直观,非常适合惯用的python,特别是auth (对于想出oAuth舞蹈的人来说,这里有一个特别的地方)尽管在过去,我的大部分工作都是在Gsuite上,我正在修改google云客户端库,
在寻找一个特定的库时,我意识到它们现在有两种风格: gRPC和GAPIC。虽然两者都有泡菜的一面,但我找不到任何关于哪种味道比另一种味道更好的参考资料(如果有的话)。
味觉香精
(ame) hector@trantor ~/a/envs ❯❯❯ pip search gapic
gapic-google-iam-admin-v1 (0.10.0) - GAPIC library for the Google IAM Admin API
gapic-google-cloud-spanner-admin-instance-v1 (0.15.3) - GAPIC library for the Cloud Spanner Instance Admin API
gapic-google-cloud-spanner-admin-database-v1 (0.15.3) - GAPIC library for the Cloud Spanner Database Admin API
gapic-google-cloud-speech-v1 (0.15.3) - GAPIC library for the Google Cloud Speech API
gapic-google-cloud-language-v1beta2 (0.15.3) - GAPIC library for the Google Cloud Natural Language API
google-cloud-trace (0.15.5) - GAPIC library for the Stackdriver Trace API
gapic-google-cloud-functions-v1beta2 (0.15.3) - GAPIC library for the Google Cloud Functions API
gapic-google-cloud-spanner-v1 (0.15.3) - GAPIC library for the Cloud Spanner API
gapic-google-cloud-language-v1 (0.15.3) - GAPIC library for the Google Cloud Natural Language API
gapic-google-cloud-monitoring-v3 (0.15.3) - GAPIC library for the Stackdriver Monitoring API
gapic-google-cloud-error-reporting-v1beta1 (0.15.3) - GAPIC library for the Stackdriver Error Reporting API
gapic-google-cloud-pubsub-v1 (0.15.4) - GAPIC library for the Google Cloud Pub/Sub API
gapic-google-cloud-language-v1beta1 (0.11.1) - GAPIC library for the Google Language API
gapic-google-cloud-logging-v2 (0.91.3) - GAPIC library for the Stackdriver Logging API
gapic-google-cloud-datastore-v1 (0.90.4) - GAPIC library for the Google Cloud Datastore API
gapic-google-cloud-speech-v1beta1 (0.15.3) - GAPIC library for the Google Cloud Speech API
gapic-google-cloud-vision-v1 (0.90.3) - GAPIC library for the Google Cloud Vision API
gapic-google-monitoring-v3 (0.11.1) - GAPIC library for the Stackdriver Monitoring API
gapic-google-longrunning (0.11.2) - GAPIC library for the Google Google API
gapic-google-maps-streetview_publish-v1 (0.1.4) - GAPIC library for the Street View Publish API
gapic-google-pubsub-v1 (0.11.1) - GAPIC library for the Google Pubsub APIgRPC/协议风味:
(ame) hector@trantor ~/a/envs ❯❯❯ pip search grpc | grep google I
grpc-google-iam-admin-v1 (0.10.0) - GRPC library for the google-iam-admin-v1 service
proto-google-cloud-spanner-admin-database-v1 (0.15.3) - GRPC library for the Cloud Spanner Database Admin API
proto-google-cloud-spanner-admin-instance-v1 (0.15.3) - GRPC library for the Cloud Spanner Instance Admin API
google-assistant-grpc (0.0.2) - Google Assistant API gRPC bindings
proto-google-cloud-language-v1beta2 (0.15.3) - GRPC library for the Google Cloud Natural Language API
grpc-google-cloud-pubsub-v1 (0.14.0) - GRPC library for the Google Pubsub service
grpc-google-cloud-monitoring-v3 (0.14.0) - GRPC library for the Stackdriver Monitoring API service
proto-google-cloud-speech-v1 (0.15.3) - GRPC library for the Google Cloud Speech API
grpc-google-cloud-language-v1 (0.14.0) - GRPC library for the Google Language service
grpc-google-cloud-error-reporting-v1beta1 (0.14.0) - GRPC library for the Stackdriver Error Reporting API
proto-google-cloud-logging-v2 (0.91.3) - GRPC library for the Stackdriver Logging API
grpc-google-cloud-logging-v2 (0.90.0) - GRPC library for the Stackdriver Logging service
proto-google-cloud-functions-v1beta2 (0.15.3) - GRPC library for the Google Cloud Functions API
grpc-google-cloud-datastore-v1 (0.14.0) - GRPC library for the Google Datastore service
grpc-google-cloud-speech-v1beta1 (0.14.0) - GRPC library for the Google Speech service
proto-google-cloud-spanner-v1 (0.15.3) - GRPC library for the Cloud Spanner API
proto-google-cloud-speech-v1beta1 (0.15.3) - GRPC library for the Google Cloud Speech API
proto-google-cloud-monitoring-v3 (0.15.3) - GRPC library for the Stackdriver Monitoring API
proto-google-cloud-language-v1 (0.15.3) - GRPC library for the Google Cloud Natural Language API
proto-google-cloud-error-reporting-v1beta1 (0.15.3) - GRPC library for the Stackdriver Error Reporting API
proto-google-cloud-vision-v1 (0.90.3) - GRPC library for the Google Cloud Vision API
proto-google-cloud-datastore-v1 (0.90.4) - GRPC library for the Google Cloud Datastore API
proto-google-cloud-pubsub-v1 (0.15.4) - GRPC library for the Google Cloud Pub/Sub API
grpc-google-cloud-vision-v1 (0.14.0) - GRPC library for the Google Cloud Vision API service
grpc-google-cloud-language-v1beta1 (0.11.1) - GRPC library for the google-cloud-language-v1beta1 service
grpc-google-monitoring-v3 (0.11.1) - GRPC library for the google-monitoring-v3 service
grpc-google-longrunning-v2 (0.8.1) - GRPC library for the google-longrunning-v2 service
proto-google-maps-streetview_publish-v1 (0.1.4) - GRPC library for the Street View Publish API
grpc-google-iam-v1 (0.11.4) - GRPC library for the google-iam-v1 service
grpc-google-pubsub-v1 (0.11.1) - GRPC library for the google-pubsub-v1 service`为了让maters更令人困惑,大多数库都以相同的修订号存在于两种版本中,其中有一个旧的gRPC版本:
google-cloud-datastore-v1 (0.14.0) - GRPC library for the Google Datastore service
google-cloud-datastore-v1 (0.90.4) - GAPIC library for the Google Cloud Datastore API
google-cloud-datastore-v1 (0.90.4) - GRPC library for the Google Cloud Datastore API和
google-cloud-logging-v2 (0.90.0) - GRPC library for the Stackdriver Logging service
google-cloud-logging-v2 (0.91.3) - GAPIC library for the Stackdriver Logging API
google-cloud-logging-v2 (0.91.3) - GRPC library for the Stackdriver Logging API另外,assistant API客户机只出现在gRPC cloud-trace中,情况正好相反。
我应该选择哪个客户端库来开发我的应用程序?无论是在习语特征上,还是在性能上,都有本质上的区别吗?(我希望gRPC库能够使客户端更具表现力,但这是互联网,我们并不都在可靠的带宽上),因此,假设"YMMV“和”选择将完成工作的工具“这两种琐碎的情况。
文档没有指定选择哪种类型的效果,特别是当两种口味都在同一版本标签上时。
你的洞察力非常感谢。
发布于 2017-10-16 16:00:11
您确实不想或不需要在库的前面安装gapic-、proto-或grpc-。在某种程度上,您真正想要的库将这些库用作依赖项。(我们已经摆脱了这种行为,但出于历史原因,我们很可能永远被那些生活在PyPI上的软件包困住了。)
实际要安装的库是拼写为google-cloud-{api} (例如,google-cloud-speech、google-cloud-pubsub等)。在少数情况下,它们可能会使用您观察到的前缀库,尽管现在几乎所有的(如果不是全部的话)都应该删除这些前缀。
如果您还有其他问题,可以在我们的问题跟踪器上随意提问。
https://stackoverflow.com/questions/46752575
复制相似问题