google-cloud-pubsub 2.35.0__tar.gz → 2.37.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. {google_cloud_pubsub-2.35.0/google_cloud_pubsub.egg-info → google_cloud_pubsub-2.37.0}/PKG-INFO +154 -42
  2. google_cloud_pubsub-2.37.0/README.rst +346 -0
  3. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub/__init__.py +6 -5
  4. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/__init__.py +1 -3
  5. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/exceptions.py +0 -1
  6. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/open_telemetry/context_propagation.py +2 -2
  7. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/open_telemetry/publish_message_wrapper.py +19 -17
  8. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/open_telemetry/subscribe_opentelemetry.py +6 -6
  9. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/publisher/__init__.py +0 -1
  10. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/publisher/_batch/base.py +0 -1
  11. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/publisher/_batch/thread.py +12 -14
  12. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/publisher/_sequencer/base.py +2 -0
  13. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/publisher/_sequencer/ordered_sequencer.py +12 -13
  14. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/publisher/_sequencer/unordered_sequencer.py +3 -5
  15. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/publisher/client.py +10 -9
  16. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/publisher/exceptions.py +1 -0
  17. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/publisher/flow_controller.py +5 -5
  18. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/subscriber/__init__.py +0 -1
  19. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/subscriber/_protocol/dispatcher.py +24 -25
  20. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/subscriber/_protocol/helper_threads.py +1 -2
  21. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/subscriber/_protocol/histogram.py +0 -1
  22. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/subscriber/_protocol/messages_on_hold.py +3 -3
  23. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py +24 -23
  24. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/subscriber/client.py +4 -4
  25. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/subscriber/exceptions.py +2 -1
  26. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/subscriber/futures.py +1 -2
  27. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/subscriber/message.py +7 -6
  28. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/types.py +13 -11
  29. google_cloud_pubsub-2.37.0/google/pubsub/__init__.py +181 -0
  30. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub/gapic_version.py +1 -1
  31. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/__init__.py +82 -79
  32. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/gapic_version.py +1 -1
  33. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/publisher/async_client.py +58 -32
  34. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/publisher/client.py +65 -52
  35. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/publisher/pagers.py +12 -11
  36. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/publisher/transports/__init__.py +1 -3
  37. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/publisher/transports/base.py +21 -11
  38. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/publisher/transports/grpc.py +17 -12
  39. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/publisher/transports/grpc_asyncio.py +18 -13
  40. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/publisher/transports/rest.py +25 -23
  41. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/publisher/transports/rest_base.py +9 -9
  42. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/schema_service/async_client.py +56 -29
  43. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/schema_service/client.py +69 -43
  44. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/schema_service/pagers.py +10 -9
  45. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/schema_service/transports/__init__.py +1 -3
  46. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/schema_service/transports/base.py +21 -11
  47. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/schema_service/transports/grpc.py +17 -12
  48. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/schema_service/transports/grpc_asyncio.py +18 -13
  49. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/schema_service/transports/rest.py +24 -28
  50. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/schema_service/transports/rest_base.py +9 -9
  51. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/subscriber/async_client.py +62 -35
  52. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/subscriber/client.py +69 -53
  53. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/subscriber/pagers.py +10 -9
  54. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/subscriber/transports/__init__.py +1 -3
  55. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/subscriber/transports/base.py +21 -11
  56. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/subscriber/transports/grpc.py +17 -12
  57. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/subscriber/transports/grpc_asyncio.py +18 -13
  58. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/subscriber/transports/rest.py +25 -23
  59. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/subscriber/transports/rest_base.py +9 -9
  60. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/types/__init__.py +4 -2
  61. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/types/pubsub.py +142 -6
  62. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/types/schema.py +4 -3
  63. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0/google_cloud_pubsub.egg-info}/PKG-INFO +154 -42
  64. google_cloud_pubsub-2.37.0/google_cloud_pubsub.egg-info/requires.txt +17 -0
  65. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/setup.py +18 -20
  66. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/system.py +7 -12
  67. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/gapic/pubsub_v1/test_publisher.py +344 -193
  68. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/gapic/pubsub_v1/test_schema_service.py +372 -208
  69. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/gapic/pubsub_v1/test_subscriber.py +460 -303
  70. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/publisher/batch/test_base.py +5 -6
  71. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/publisher/batch/test_thread.py +12 -13
  72. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/publisher/sequencer/test_unordered_sequencer.py +6 -6
  73. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/publisher/test_flow_controller.py +1 -3
  74. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/publisher/test_publisher_client.py +12 -18
  75. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/subscriber/test_dispatcher.py +10 -10
  76. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/subscriber/test_futures_subscriber.py +1 -0
  77. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/subscriber/test_heartbeater.py +5 -4
  78. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/subscriber/test_helper_threads.py +1 -2
  79. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/subscriber/test_leaser.py +10 -9
  80. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/subscriber/test_message.py +6 -7
  81. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/subscriber/test_scheduler.py +3 -4
  82. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/subscriber/test_streaming_pull_manager.py +20 -28
  83. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/subscriber/test_subscribe_opentelemetry.py +6 -7
  84. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/subscriber/test_subscriber_client.py +20 -17
  85. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/test_futures.py +1 -3
  86. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/test_pubsub.py +1 -2
  87. google_cloud_pubsub-2.35.0/README.rst +0 -232
  88. google_cloud_pubsub-2.35.0/google/pubsub/__init__.py +0 -176
  89. google_cloud_pubsub-2.35.0/google_cloud_pubsub.egg-info/requires.txt +0 -23
  90. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/LICENSE +0 -0
  91. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/MANIFEST.in +0 -0
  92. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/futures.py +0 -0
  93. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/open_telemetry/__init__.py +0 -0
  94. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/proto/pubsub.proto +0 -0
  95. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/proto/schema.proto +0 -0
  96. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/publisher/_batch/__init__.py +0 -0
  97. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/publisher/_sequencer/__init__.py +0 -0
  98. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/publisher/futures.py +0 -0
  99. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/subscriber/_protocol/__init__.py +0 -0
  100. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/subscriber/_protocol/heartbeater.py +0 -0
  101. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py +1 -1
  102. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/subscriber/_protocol/requests.py +0 -0
  103. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/cloud/pubsub_v1/subscriber/scheduler.py +1 -1
  104. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub/py.typed +0 -0
  105. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/gapic_metadata.json +0 -0
  106. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/py.typed +0 -0
  107. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/__init__.py +0 -0
  108. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/publisher/__init__.py +1 -1
  109. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/schema_service/__init__.py +1 -1
  110. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google/pubsub_v1/services/subscriber/__init__.py +1 -1
  111. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google_cloud_pubsub.egg-info/SOURCES.txt +0 -0
  112. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google_cloud_pubsub.egg-info/dependency_links.txt +0 -0
  113. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google_cloud_pubsub.egg-info/not-zip-safe +0 -0
  114. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/google_cloud_pubsub.egg-info/top_level.txt +0 -0
  115. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/setup.cfg +0 -0
  116. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/__init__.py +0 -0
  117. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/__init__.py +0 -0
  118. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/gapic/__init__.py +0 -0
  119. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/gapic/pubsub_v1/__init__.py +0 -0
  120. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/conftest.py +4 -4
  121. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/publisher/sequencer/test_ordered_sequencer.py +4 -4
  122. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/publisher/test_futures_publisher.py +0 -0
  123. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/publisher/test_publish_message_wrapper.py +1 -1
  124. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/subscriber/test_histogram.py +0 -0
  125. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/pubsub_v1/subscriber/test_messages_on_hold.py +3 -3
  126. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.37.0}/tests/unit/test_packaging.py +0 -0
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-cloud-pubsub
3
- Version: 2.35.0
3
+ Version: 2.37.0
4
4
  Summary: Google Cloud Pub/Sub API client library
5
- Home-page: https://github.com/googleapis/python-pubsub
5
+ Home-page: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-pubsub
6
6
  Author: Google LLC
7
7
  Author-email: googleapis-packages@google.com
8
8
  License: Apache 2.0
@@ -22,15 +22,13 @@ Classifier: Operating System :: OS Independent
22
22
  Classifier: Topic :: Internet
23
23
  Requires-Python: >=3.9
24
24
  License-File: LICENSE
25
+ Requires-Dist: google-api-core[grpc]<3.0.0,>=2.11.0
26
+ Requires-Dist: google-auth!=2.24.0,!=2.25.0,<3.0.0,>=2.14.1
25
27
  Requires-Dist: grpcio<2.0.0,>=1.51.3; python_version < "3.14"
26
- Requires-Dist: grpcio<2.0.0,>=1.75.1; python_version >= "3.14"
27
- Requires-Dist: google-auth<3.0.0,>=2.14.1
28
- Requires-Dist: google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0,>=1.34.0
29
- Requires-Dist: proto-plus<2.0.0,>=1.22.0
30
- Requires-Dist: proto-plus<2.0.0,>=1.22.2; python_version >= "3.11"
28
+ Requires-Dist: proto-plus<2.0.0,>=1.22.3
31
29
  Requires-Dist: proto-plus<2.0.0,>=1.25.0; python_version >= "3.13"
32
- Requires-Dist: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<7.0.0,>=3.20.2
33
- Requires-Dist: grpc-google-iam-v1<1.0.0,>=0.12.4
30
+ Requires-Dist: protobuf<8.0.0,>=4.25.8
31
+ Requires-Dist: grpc-google-iam-v1<1.0.0,>=0.14.0
34
32
  Requires-Dist: grpcio-status>=1.33.2
35
33
  Requires-Dist: opentelemetry-api>=1.27.0
36
34
  Requires-Dist: opentelemetry-sdk>=1.27.0
@@ -49,12 +47,12 @@ Dynamic: requires-dist
49
47
  Dynamic: requires-python
50
48
  Dynamic: summary
51
49
 
52
- Python Client for Google Cloud Pub / Sub
53
- ========================================
50
+ Python Client for Google Cloud Pub/Sub
51
+ ======================================
54
52
 
55
- |GA| |pypi| |versions|
53
+ |stable| |pypi| |versions|
56
54
 
57
- `Google Cloud Pub / Sub`_ is a fully-managed real-time messaging service that
55
+ 'Google Cloud Pub/Sub:' is a fully-managed real-time messaging service that
58
56
  allows you to send and receive messages between independent applications. You
59
57
  can leverage Cloud Pub/Sub’s flexibility to decouple systems and components
60
58
  hosted on Google Cloud Platform or elsewhere on the Internet. By building on
@@ -67,18 +65,18 @@ can subscribe to that topic to receive the messages. By decoupling senders and
67
65
  receivers, Google Cloud Pub/Sub allows developers to communicate between
68
66
  independently written applications.
69
67
 
70
- - `Product Documentation`_
71
68
  - `Client Library Documentation`_
69
+ - `Product Documentation`_
72
70
 
73
- .. |GA| image:: https://img.shields.io/badge/support-GA-gold.svg
74
- :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#general-availability
71
+ .. |stable| image:: https://img.shields.io/badge/support-stable-gold.svg
72
+ :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels
75
73
  .. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-pubsub.svg
76
74
  :target: https://pypi.org/project/google-cloud-pubsub/
77
75
  .. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-pubsub.svg
78
76
  :target: https://pypi.org/project/google-cloud-pubsub/
79
- .. _Google Cloud Pub / Sub: https://cloud.google.com/pubsub/
80
- .. _Product Documentation: https://cloud.google.com/pubsub/docs
81
- .. _Client Library Documentation: https://cloud.google.com/python/docs/reference/pubsub/latest/summary_overview
77
+ .. _Google Cloud Pub/Sub: https://cloud.google.com/pubsub/docs/
78
+ .. _Client Library Documentation: https://cloud.google.com/python/docs/reference/pubsub/latest
79
+ .. _Product Documentation: https://cloud.google.com/pubsub/docs/
82
80
 
83
81
  Quick Start
84
82
  -----------
@@ -87,50 +85,64 @@ In order to use this library, you first need to go through the following steps:
87
85
 
88
86
  1. `Select or create a Cloud Platform project.`_
89
87
  2. `Enable billing for your project.`_
90
- 3. `Enable the Google Cloud Pub / Sub API.`_
91
- 4. `Setup Authentication.`_
88
+ 3. `Enable the Google Cloud Pub/Sub.`_
89
+ 4. `Set up Authentication.`_
92
90
 
93
91
  .. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
94
92
  .. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
95
- .. _Enable the Google Cloud Pub / Sub API.: https://cloud.google.com/pubsub
96
- .. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
93
+ .. _Enable the Google Cloud Pub/Sub.: https://cloud.google.com/pubsub/docs/
94
+ .. _Set up Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
97
95
 
98
96
  Installation
99
97
  ~~~~~~~~~~~~
100
98
 
101
- Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to
102
- create isolated Python environments. The basic problem it addresses is one of
103
- dependencies and versions, and indirectly permissions.
99
+ Install this library in a virtual environment using `venv`_. `venv`_ is a tool that
100
+ creates isolated Python environments. These isolated environments can have separate
101
+ versions of Python packages, which allows you to isolate one project's dependencies
102
+ from the dependencies of other projects.
104
103
 
105
- With `virtualenv`_, it's possible to install this library without needing system
104
+ With `venv`_, it's possible to install this library without needing system
106
105
  install permissions, and without clashing with the installed system
107
106
  dependencies.
108
107
 
109
- .. _`virtualenv`: https://virtualenv.pypa.io/en/latest/
108
+ .. _`venv`: https://docs.python.org/3/library/venv.html
109
+
110
+
111
+ Code samples and snippets
112
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
113
+
114
+ Code samples and snippets live in the `samples/`_ folder.
115
+
116
+ .. _samples/: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-pubsub/samples
110
117
 
111
118
 
112
119
  Supported Python Versions
113
120
  ^^^^^^^^^^^^^^^^^^^^^^^^^
114
- Python >= 3.9
121
+ Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
122
+ Python.
115
123
 
116
- Deprecated Python Versions
117
- ^^^^^^^^^^^^^^^^^^^^^^^^^^
118
- Python < 3.9
124
+ Python >= 3.9, including 3.14
125
+
126
+ .. _active: https://devguide.python.org/devcycle/#in-development-main-branch
127
+ .. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
119
128
 
120
- The last version of this library compatible with Python 3.7 and 3.8 is google-cloud-pubsub==2.34.0.
129
+ Unsupported Python Versions
130
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
131
+ Python <= 3.8
121
132
 
122
- The last version of this library compatible with Python 2.7 is google-cloud-pubsub==1.7.0.
133
+ If you are using an `end-of-life`_
134
+ version of Python, we recommend that you update as soon as possible to an actively supported version.
123
135
 
136
+ .. _end-of-life: https://devguide.python.org/devcycle/#end-of-life-branches
124
137
 
125
138
  Mac/Linux
126
139
  ^^^^^^^^^
127
140
 
128
141
  .. code-block:: console
129
142
 
130
- pip install virtualenv
131
- virtualenv <your-env>
143
+ python3 -m venv <your-env>
132
144
  source <your-env>/bin/activate
133
- <your-env>/bin/pip install google-cloud-pubsub
145
+ pip install google-cloud-pubsub
134
146
 
135
147
 
136
148
  Windows
@@ -138,11 +150,9 @@ Windows
138
150
 
139
151
  .. code-block:: console
140
152
 
141
- pip install virtualenv
142
- virtualenv <your-env>
143
- <your-env>\Scripts\activate
144
- <your-env>\Scripts\pip.exe install google-cloud-pubsub
145
-
153
+ py -m venv <your-env>
154
+ .\<your-env>\Scripts\activate
155
+ pip install google-cloud-pubsub
146
156
 
147
157
  Example Usage
148
158
  ~~~~~~~~~~~~~
@@ -281,3 +291,105 @@ License
281
291
  Apache 2.0 - See `the LICENSE`_ for more information.
282
292
 
283
293
  .. _the LICENSE: https://github.com/googleapis/google-cloud-python/blob/main/LICENSE
294
+
295
+ Next Steps
296
+ ~~~~~~~~~~
297
+
298
+ - Read the `Client Library Documentation`_ for Google Cloud Pub/Sub
299
+ to see other available methods on the client.
300
+ - Read the `Google Cloud Pub/Sub Product documentation`_ to learn
301
+ more about the product and see How-to Guides.
302
+ - View this `README`_ to see the full list of Cloud
303
+ APIs that we cover.
304
+
305
+ .. _Google Cloud Pub/Sub Product documentation: https://cloud.google.com/pubsub/docs/
306
+ .. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst
307
+
308
+ Logging
309
+ -------
310
+
311
+ This library uses the standard Python :code:`logging` functionality to log some RPC events that could be of interest for debugging and monitoring purposes.
312
+ Note the following:
313
+
314
+ #. Logs may contain sensitive information. Take care to **restrict access to the logs** if they are saved, whether it be on local storage or on Google Cloud Logging.
315
+ #. Google may refine the occurrence, level, and content of various log messages in this library without flagging such changes as breaking. **Do not depend on immutability of the logging events**.
316
+ #. By default, the logging events from this library are not handled. You must **explicitly configure log handling** using one of the mechanisms below.
317
+
318
+ Simple, environment-based configuration
319
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
320
+
321
+ To enable logging for this library without any changes in your code, set the :code:`GOOGLE_SDK_PYTHON_LOGGING_SCOPE` environment variable to a valid Google
322
+ logging scope. This configures handling of logging events (at level :code:`logging.DEBUG` or higher) from this library in a default manner, emitting the logged
323
+ messages in a structured format. It does not currently allow customizing the logging levels captured nor the handlers, formatters, etc. used for any logging
324
+ event.
325
+
326
+ A logging scope is a period-separated namespace that begins with :code:`google`, identifying the Python module or package to log.
327
+
328
+ - Valid logging scopes: :code:`google`, :code:`google.cloud.asset.v1`, :code:`google.api`, :code:`google.auth`, etc.
329
+ - Invalid logging scopes: :code:`foo`, :code:`123`, etc.
330
+
331
+ **NOTE**: If the logging scope is invalid, the library does not set up any logging handlers.
332
+
333
+ Environment-Based Examples
334
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^
335
+
336
+ - Enabling the default handler for all Google-based loggers
337
+
338
+ .. code-block:: console
339
+
340
+ export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google
341
+
342
+ - Enabling the default handler for a specific Google module (for a client library called :code:`library_v1`):
343
+
344
+ .. code-block:: console
345
+
346
+ export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google.cloud.library_v1
347
+
348
+
349
+ Advanced, code-based configuration
350
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
351
+
352
+ You can also configure a valid logging scope using Python's standard `logging` mechanism.
353
+
354
+ Code-Based Examples
355
+ ^^^^^^^^^^^^^^^^^^^
356
+
357
+ - Configuring a handler for all Google-based loggers
358
+
359
+ .. code-block:: python
360
+
361
+ import logging
362
+
363
+ from google.cloud import library_v1
364
+
365
+ base_logger = logging.getLogger("google")
366
+ base_logger.addHandler(logging.StreamHandler())
367
+ base_logger.setLevel(logging.DEBUG)
368
+
369
+ - Configuring a handler for a specific Google module (for a client library called :code:`library_v1`):
370
+
371
+ .. code-block:: python
372
+
373
+ import logging
374
+
375
+ from google.cloud import library_v1
376
+
377
+ base_logger = logging.getLogger("google.cloud.library_v1")
378
+ base_logger.addHandler(logging.StreamHandler())
379
+ base_logger.setLevel(logging.DEBUG)
380
+
381
+ Logging details
382
+ ~~~~~~~~~~~~~~~
383
+
384
+ #. Regardless of which of the mechanisms above you use to configure logging for this library, by default logging events are not propagated up to the root
385
+ logger from the `google`-level logger. If you need the events to be propagated to the root logger, you must explicitly set
386
+ :code:`logging.getLogger("google").propagate = True` in your code.
387
+ #. You can mix the different logging configurations above for different Google modules. For example, you may want use a code-based logging configuration for
388
+ one library, but decide you need to also set up environment-based logging configuration for another library.
389
+
390
+ #. If you attempt to use both code-based and environment-based configuration for the same module, the environment-based configuration will be ineffectual
391
+ if the code -based configuration gets applied first.
392
+
393
+ #. The Google-specific logging configurations (default handlers for environment-based configuration; not propagating logging events to the root logger) get
394
+ executed the first time *any* client library is instantiated in your application, and only if the affected loggers have not been previously configured.
395
+ (This is the reason for 2.i. above.)
@@ -0,0 +1,346 @@
1
+ Python Client for Google Cloud Pub/Sub
2
+ ======================================
3
+
4
+ |stable| |pypi| |versions|
5
+
6
+ 'Google Cloud Pub/Sub:' is a fully-managed real-time messaging service that
7
+ allows you to send and receive messages between independent applications. You
8
+ can leverage Cloud Pub/Sub’s flexibility to decouple systems and components
9
+ hosted on Google Cloud Platform or elsewhere on the Internet. By building on
10
+ the same technology Google uses, Cloud Pub / Sub is designed to provide “at
11
+ least once” delivery at low latency with on-demand scalability to 1 million
12
+ messages per second (and beyond).
13
+
14
+ Publisher applications can send messages to a ``topic`` and other applications
15
+ can subscribe to that topic to receive the messages. By decoupling senders and
16
+ receivers, Google Cloud Pub/Sub allows developers to communicate between
17
+ independently written applications.
18
+
19
+ - `Client Library Documentation`_
20
+ - `Product Documentation`_
21
+
22
+ .. |stable| image:: https://img.shields.io/badge/support-stable-gold.svg
23
+ :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels
24
+ .. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-pubsub.svg
25
+ :target: https://pypi.org/project/google-cloud-pubsub/
26
+ .. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-pubsub.svg
27
+ :target: https://pypi.org/project/google-cloud-pubsub/
28
+ .. _Google Cloud Pub/Sub: https://cloud.google.com/pubsub/docs/
29
+ .. _Client Library Documentation: https://cloud.google.com/python/docs/reference/pubsub/latest
30
+ .. _Product Documentation: https://cloud.google.com/pubsub/docs/
31
+
32
+ Quick Start
33
+ -----------
34
+
35
+ In order to use this library, you first need to go through the following steps:
36
+
37
+ 1. `Select or create a Cloud Platform project.`_
38
+ 2. `Enable billing for your project.`_
39
+ 3. `Enable the Google Cloud Pub/Sub.`_
40
+ 4. `Set up Authentication.`_
41
+
42
+ .. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
43
+ .. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
44
+ .. _Enable the Google Cloud Pub/Sub.: https://cloud.google.com/pubsub/docs/
45
+ .. _Set up Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
46
+
47
+ Installation
48
+ ~~~~~~~~~~~~
49
+
50
+ Install this library in a virtual environment using `venv`_. `venv`_ is a tool that
51
+ creates isolated Python environments. These isolated environments can have separate
52
+ versions of Python packages, which allows you to isolate one project's dependencies
53
+ from the dependencies of other projects.
54
+
55
+ With `venv`_, it's possible to install this library without needing system
56
+ install permissions, and without clashing with the installed system
57
+ dependencies.
58
+
59
+ .. _`venv`: https://docs.python.org/3/library/venv.html
60
+
61
+
62
+ Code samples and snippets
63
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
64
+
65
+ Code samples and snippets live in the `samples/`_ folder.
66
+
67
+ .. _samples/: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-pubsub/samples
68
+
69
+
70
+ Supported Python Versions
71
+ ^^^^^^^^^^^^^^^^^^^^^^^^^
72
+ Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of
73
+ Python.
74
+
75
+ Python >= 3.9, including 3.14
76
+
77
+ .. _active: https://devguide.python.org/devcycle/#in-development-main-branch
78
+ .. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches
79
+
80
+ Unsupported Python Versions
81
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
82
+ Python <= 3.8
83
+
84
+ If you are using an `end-of-life`_
85
+ version of Python, we recommend that you update as soon as possible to an actively supported version.
86
+
87
+ .. _end-of-life: https://devguide.python.org/devcycle/#end-of-life-branches
88
+
89
+ Mac/Linux
90
+ ^^^^^^^^^
91
+
92
+ .. code-block:: console
93
+
94
+ python3 -m venv <your-env>
95
+ source <your-env>/bin/activate
96
+ pip install google-cloud-pubsub
97
+
98
+
99
+ Windows
100
+ ^^^^^^^
101
+
102
+ .. code-block:: console
103
+
104
+ py -m venv <your-env>
105
+ .\<your-env>\Scripts\activate
106
+ pip install google-cloud-pubsub
107
+
108
+ Example Usage
109
+ ~~~~~~~~~~~~~
110
+
111
+ Publishing
112
+ ^^^^^^^^^^
113
+
114
+ To publish data to Cloud Pub/Sub you must create a topic, and then publish
115
+ messages to it
116
+
117
+ .. code-block:: python
118
+
119
+ import os
120
+ from google.cloud import pubsub_v1
121
+
122
+ publisher = pubsub_v1.PublisherClient()
123
+ topic_name = 'projects/{project_id}/topics/{topic}'.format(
124
+ project_id=os.getenv('GOOGLE_CLOUD_PROJECT'),
125
+ topic='MY_TOPIC_NAME', # Set this to something appropriate.
126
+ )
127
+ publisher.create_topic(name=topic_name)
128
+ future = publisher.publish(topic_name, b'My first message!', spam='eggs')
129
+ future.result()
130
+
131
+ To learn more, consult the `publishing documentation`_.
132
+
133
+ .. _publishing documentation: https://cloud.google.com/python/docs/reference/pubsub/latest/google.cloud.pubsub_v1.publisher.client.Client
134
+
135
+
136
+ Subscribing
137
+ ^^^^^^^^^^^
138
+
139
+ To subscribe to data in Cloud Pub/Sub, you create a subscription based on
140
+ the topic, and subscribe to that, passing a callback function.
141
+
142
+ .. code-block:: python
143
+
144
+ import os
145
+ from google.cloud import pubsub_v1
146
+
147
+ topic_name = 'projects/{project_id}/topics/{topic}'.format(
148
+ project_id=os.getenv('GOOGLE_CLOUD_PROJECT'),
149
+ topic='MY_TOPIC_NAME', # Set this to something appropriate.
150
+ )
151
+
152
+ subscription_name = 'projects/{project_id}/subscriptions/{sub}'.format(
153
+ project_id=os.getenv('GOOGLE_CLOUD_PROJECT'),
154
+ sub='MY_SUBSCRIPTION_NAME', # Set this to something appropriate.
155
+ )
156
+
157
+ def callback(message):
158
+ print(message.data)
159
+ message.ack()
160
+
161
+ with pubsub_v1.SubscriberClient() as subscriber:
162
+ subscriber.create_subscription(
163
+ name=subscription_name, topic=topic_name)
164
+ future = subscriber.subscribe(subscription_name, callback)
165
+
166
+ The future returned by the call to ``subscriber.subscribe`` can be used to
167
+ block the current thread until a given condition obtains:
168
+
169
+ .. code-block:: python
170
+
171
+ try:
172
+ future.result()
173
+ except KeyboardInterrupt:
174
+ future.cancel()
175
+
176
+ It is also possible to pull messages in a synchronous (blocking) fashion. To
177
+ learn more about subscribing, consult the `subscriber documentation`_.
178
+
179
+ .. _subscriber documentation: https://cloud.google.com/python/docs/reference/pubsub/latest/google.cloud.pubsub_v1.subscriber.client.Client
180
+
181
+
182
+ Authentication
183
+ ^^^^^^^^^^^^^^
184
+
185
+ It is possible to specify the authentication method to use with the Pub/Sub
186
+ clients. This can be done by providing an explicit `Credentials`_ instance. Support
187
+ for various authentication methods is available from the `google-auth`_ library.
188
+
189
+ For example, to use JSON Web Tokens, provide a `google.auth.jwt.Credentials`_ instance:
190
+
191
+ .. code-block:: python
192
+
193
+ import json
194
+ from google.auth import jwt
195
+
196
+ service_account_info = json.load(open("service-account-info.json"))
197
+ audience = "https://pubsub.googleapis.com/google.pubsub.v1.Subscriber"
198
+
199
+ credentials = jwt.Credentials.from_service_account_info(
200
+ service_account_info, audience=audience
201
+ )
202
+
203
+ subscriber = pubsub_v1.SubscriberClient(credentials=credentials)
204
+
205
+ # The same for the publisher, except that the "audience" claim needs to be adjusted
206
+ publisher_audience = "https://pubsub.googleapis.com/google.pubsub.v1.Publisher"
207
+ credentials_pub = credentials.with_claims(audience=publisher_audience)
208
+ publisher = pubsub_v1.PublisherClient(credentials=credentials_pub)
209
+
210
+ .. _Credentials: https://google-auth.readthedocs.io/en/latest/reference/google.auth.credentials.html#google.auth.credentials.Credentials
211
+ .. _google-auth: https://google-auth.readthedocs.io/en/latest/index.html
212
+ .. _google.auth.jwt.Credentials: https://google-auth.readthedocs.io/en/latest/reference/google.auth.jwt.html#google.auth.jwt.Credentials
213
+
214
+
215
+ Versioning
216
+ ----------
217
+
218
+ This library follows `Semantic Versioning`_.
219
+
220
+ It is currently in major version one (1.y.z), which means that the public API should be considered stable.
221
+
222
+ .. _Semantic Versioning: http://semver.org/
223
+
224
+ Contributing
225
+ ------------
226
+
227
+ Contributions to this library are always welcome and highly encouraged.
228
+
229
+ See the `CONTRIBUTING doc`_ for more information on how to get started.
230
+
231
+ .. _CONTRIBUTING doc: https://github.com/googleapis/google-cloud-python/blob/main/CONTRIBUTING.rst
232
+
233
+ Community
234
+ ---------
235
+
236
+ The best place to ask questions is via Stackoverflow: https://stackoverflow.com/questions/tagged/google-cloud-pubsub
237
+
238
+
239
+ License
240
+ -------
241
+
242
+ Apache 2.0 - See `the LICENSE`_ for more information.
243
+
244
+ .. _the LICENSE: https://github.com/googleapis/google-cloud-python/blob/main/LICENSE
245
+
246
+ Next Steps
247
+ ~~~~~~~~~~
248
+
249
+ - Read the `Client Library Documentation`_ for Google Cloud Pub/Sub
250
+ to see other available methods on the client.
251
+ - Read the `Google Cloud Pub/Sub Product documentation`_ to learn
252
+ more about the product and see How-to Guides.
253
+ - View this `README`_ to see the full list of Cloud
254
+ APIs that we cover.
255
+
256
+ .. _Google Cloud Pub/Sub Product documentation: https://cloud.google.com/pubsub/docs/
257
+ .. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst
258
+
259
+ Logging
260
+ -------
261
+
262
+ This library uses the standard Python :code:`logging` functionality to log some RPC events that could be of interest for debugging and monitoring purposes.
263
+ Note the following:
264
+
265
+ #. Logs may contain sensitive information. Take care to **restrict access to the logs** if they are saved, whether it be on local storage or on Google Cloud Logging.
266
+ #. Google may refine the occurrence, level, and content of various log messages in this library without flagging such changes as breaking. **Do not depend on immutability of the logging events**.
267
+ #. By default, the logging events from this library are not handled. You must **explicitly configure log handling** using one of the mechanisms below.
268
+
269
+ Simple, environment-based configuration
270
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
271
+
272
+ To enable logging for this library without any changes in your code, set the :code:`GOOGLE_SDK_PYTHON_LOGGING_SCOPE` environment variable to a valid Google
273
+ logging scope. This configures handling of logging events (at level :code:`logging.DEBUG` or higher) from this library in a default manner, emitting the logged
274
+ messages in a structured format. It does not currently allow customizing the logging levels captured nor the handlers, formatters, etc. used for any logging
275
+ event.
276
+
277
+ A logging scope is a period-separated namespace that begins with :code:`google`, identifying the Python module or package to log.
278
+
279
+ - Valid logging scopes: :code:`google`, :code:`google.cloud.asset.v1`, :code:`google.api`, :code:`google.auth`, etc.
280
+ - Invalid logging scopes: :code:`foo`, :code:`123`, etc.
281
+
282
+ **NOTE**: If the logging scope is invalid, the library does not set up any logging handlers.
283
+
284
+ Environment-Based Examples
285
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^
286
+
287
+ - Enabling the default handler for all Google-based loggers
288
+
289
+ .. code-block:: console
290
+
291
+ export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google
292
+
293
+ - Enabling the default handler for a specific Google module (for a client library called :code:`library_v1`):
294
+
295
+ .. code-block:: console
296
+
297
+ export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google.cloud.library_v1
298
+
299
+
300
+ Advanced, code-based configuration
301
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
302
+
303
+ You can also configure a valid logging scope using Python's standard `logging` mechanism.
304
+
305
+ Code-Based Examples
306
+ ^^^^^^^^^^^^^^^^^^^
307
+
308
+ - Configuring a handler for all Google-based loggers
309
+
310
+ .. code-block:: python
311
+
312
+ import logging
313
+
314
+ from google.cloud import library_v1
315
+
316
+ base_logger = logging.getLogger("google")
317
+ base_logger.addHandler(logging.StreamHandler())
318
+ base_logger.setLevel(logging.DEBUG)
319
+
320
+ - Configuring a handler for a specific Google module (for a client library called :code:`library_v1`):
321
+
322
+ .. code-block:: python
323
+
324
+ import logging
325
+
326
+ from google.cloud import library_v1
327
+
328
+ base_logger = logging.getLogger("google.cloud.library_v1")
329
+ base_logger.addHandler(logging.StreamHandler())
330
+ base_logger.setLevel(logging.DEBUG)
331
+
332
+ Logging details
333
+ ~~~~~~~~~~~~~~~
334
+
335
+ #. Regardless of which of the mechanisms above you use to configure logging for this library, by default logging events are not propagated up to the root
336
+ logger from the `google`-level logger. If you need the events to be propagated to the root logger, you must explicitly set
337
+ :code:`logging.getLogger("google").propagate = True` in your code.
338
+ #. You can mix the different logging configurations above for different Google modules. For example, you may want use a code-based logging configuration for
339
+ one library, but decide you need to also set up environment-based logging configuration for another library.
340
+
341
+ #. If you attempt to use both code-based and environment-based configuration for the same module, the environment-based configuration will be ineffectual
342
+ if the code -based configuration gets applied first.
343
+
344
+ #. The Google-specific logging configurations (default handlers for environment-based configuration; not propagating logging events to the root logger) get
345
+ executed the first time *any* client library is instantiated in your application, and only if the affected loggers have not been previously configured.
346
+ (This is the reason for 2.i. above.)
@@ -17,11 +17,12 @@
17
17
 
18
18
  from __future__ import absolute_import
19
19
 
20
- from google.cloud.pubsub_v1 import PublisherClient
21
- from google.cloud.pubsub_v1 import SubscriberClient
22
- from google.cloud.pubsub_v1 import SchemaServiceClient
23
- from google.cloud.pubsub_v1 import types
24
-
20
+ from google.cloud.pubsub_v1 import (
21
+ PublisherClient,
22
+ SchemaServiceClient,
23
+ SubscriberClient,
24
+ types,
25
+ )
25
26
 
26
27
  __all__ = (
27
28
  "types",
@@ -14,9 +14,7 @@
14
14
 
15
15
  from __future__ import absolute_import
16
16
 
17
- from google.cloud.pubsub_v1 import types
18
- from google.cloud.pubsub_v1 import publisher
19
- from google.cloud.pubsub_v1 import subscriber
17
+ from google.cloud.pubsub_v1 import publisher, subscriber, types
20
18
  from google.pubsub_v1.services import schema_service
21
19
 
22
20
 
@@ -16,5 +16,4 @@ from __future__ import absolute_import
16
16
 
17
17
  from concurrent.futures import TimeoutError
18
18
 
19
-
20
19
  __all__ = ("TimeoutError",)
@@ -12,9 +12,9 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- from typing import Optional, List
15
+ from typing import List, Optional
16
16
 
17
- from opentelemetry.propagators.textmap import Setter, Getter
17
+ from opentelemetry.propagators.textmap import Getter, Setter
18
18
 
19
19
  from google.pubsub_v1 import PubsubMessage
20
20