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

2024-05-28 20:07:42 发布

您现在位置:Python中文网/ 问答频道 /正文

我发现使用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/协议风格:

^{pr2}$

为了使材料更容易混淆,大多数库在两种版本中都有相同的修订号,其中有一个更旧的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

而且,assistantAPI客户机只在gRPC中出现cloud-trace则相反。在

我应该选择哪个客户端库来开发我的应用程序?无论是惯用的特性还是性能方面,有没有实质性的区别?(我希望gRPC LIB能使客户机更具性能,但这是互联网,我们并非都在可靠的带宽上)因此,我们假设了“YMMV”和“选择能完成任务的工具”这一微不足道的例子。在

文档并没有指定选择哪种类型的效果,特别是当两种风格在同一个版本标签上时。在

非常感谢你的洞察力。在


Tags: theapicloudforgrpclogginggooglelibrary
1条回答
网友
1楼 · 发布于 2024-05-28 20:07:42

您确实不希望也不需要安装前面带有gapic-proto-、或{}的库。在某一点上,您真正想要的库使用这些作为依赖项。(我们已经摆脱了这种行为,但由于历史原因,我们很可能永远都只能使用PyPI上的那些包。)

您实际想要安装的库拼写为google-cloud-{api}(例如google-cloud-speechgoogle-cloud-pubsub,等等)。在少数情况下,这些可能会使用您观察到的前缀吸纳库,尽管现在几乎所有的库都应该被删除。在

如果您还有任何问题,请随时询问我们的issue tracker。在

相关问题 更多 >

    热门问题