gRPC/proto Google 云客户端库与 GAPIC Google 云客户端库
gRPC/proto Google cloud client libraries vs GAPIC Google cloud client libraries
我主要发现 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 API
gRPC/protocol风味:
(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`
为了让事情变得更加混乱,大多数库在两种版本中都以相同的修订号存在,并且有一个较旧的 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” 和假设“选择完成任务的工具”。
文档没有指定任何关于选择哪种效果的内容,特别是当两种口味都在同一版本标签上时。
非常感谢您的见解。
您真的不想或不需要安装前面带有 gapic-
、proto-
或 grpc-
的库。有一次,您真正想要的库将它们用作依赖项。 (我们已经摆脱了这种行为,但由于历史原因,我们很可能永远坚持使用 PyPI 上的那些包。)
您实际要安装的库拼写为 google-cloud-{api}
(例如 google-cloud-speech
、google-cloud-pubsub
等)。在少数情况下,这些 可能 引入带有您观察到的前缀的库,尽管现在几乎所有(如果不是全部)都应该摆脱这些前缀。
如果您还有其他问题,请随时在我们的 issue tracker.
上提问
我主要发现 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 API
gRPC/protocol风味:
(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`
为了让事情变得更加混乱,大多数库在两种版本中都以相同的修订号存在,并且有一个较旧的 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” 和假设“选择完成任务的工具”。
文档没有指定任何关于选择哪种效果的内容,特别是当两种口味都在同一版本标签上时。
非常感谢您的见解。
您真的不想或不需要安装前面带有 gapic-
、proto-
或 grpc-
的库。有一次,您真正想要的库将它们用作依赖项。 (我们已经摆脱了这种行为,但由于历史原因,我们很可能永远坚持使用 PyPI 上的那些包。)
您实际要安装的库拼写为 google-cloud-{api}
(例如 google-cloud-speech
、google-cloud-pubsub
等)。在少数情况下,这些 可能 引入带有您观察到的前缀的库,尽管现在几乎所有(如果不是全部)都应该摆脱这些前缀。
如果您还有其他问题,请随时在我们的 issue tracker.
上提问