gRPC / proto Google云客户端库与GAPIC Google云客户端库

时间:2017-10-15 07:07:29

标签: python google-api google-cloud-platform grpc

我主要发现使用谷歌的客户端库易于使用,直观,非常适合惯用的python,除了auth之外(对于想出oAuth舞蹈的人来说,地狱中有一个特殊的地方)虽然在过去,我的大部分工作都是在Gsuite上,但我正在修改谷歌云客户端库,

寻找一个特定的图书馆我意识到他们现在有两种口味:gRPC和GAPIC。虽然两者都带有咸菜的一面,但我找不到任何关于哪种口味比另一种更好的参考,(如果有的话)。

Gapic Flavor

(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 /协议风味:

(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 ”和“选择将完成工作的工具“假设。

文档没有指定选择哪种类型的效果,特别是当两种口味都在同一版本标签时。

非常感谢您的见解。

1 个答案:

答案 0 :(得分:1)

您真的不希望或者需要在其前面安装gapic-proto-grpc-的库。有一次,您真正想要的库将这些库用作依赖项。 (我们已经摆脱了这种行为,但由于历史原因,我们很可能会永久地停留在生活​​在PyPI上的那些包。)

您实际要安装的库拼写为google-cloud-{api}(例如google-cloud-speechgoogle-cloud-pubsub等。在少数情况下,这些可能使用您观察到的前缀来提取库,尽管现在几乎全部(如果不是全部)都应该删除它们。

如果您还有其他问题,请随时向我们issue tracker询问。