google-cloud-pubsub 2.35.0__tar.gz → 2.36.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 (124) hide show
  1. {google_cloud_pubsub-2.35.0/google_cloud_pubsub.egg-info → google_cloud_pubsub-2.36.0}/PKG-INFO +141 -36
  2. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/README.rst +135 -28
  3. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub/__init__.py +6 -5
  4. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/__init__.py +1 -3
  5. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/exceptions.py +0 -1
  6. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/open_telemetry/context_propagation.py +2 -2
  7. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/open_telemetry/subscribe_opentelemetry.py +6 -6
  8. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/__init__.py +0 -1
  9. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/_batch/base.py +0 -1
  10. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/_batch/thread.py +12 -14
  11. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/_sequencer/base.py +2 -0
  12. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/_sequencer/ordered_sequencer.py +12 -13
  13. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/_sequencer/unordered_sequencer.py +3 -5
  14. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/client.py +10 -9
  15. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/exceptions.py +1 -0
  16. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/flow_controller.py +5 -5
  17. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/__init__.py +0 -1
  18. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/_protocol/dispatcher.py +24 -25
  19. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/_protocol/helper_threads.py +1 -2
  20. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/_protocol/histogram.py +0 -1
  21. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/_protocol/messages_on_hold.py +3 -3
  22. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py +24 -23
  23. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/client.py +4 -4
  24. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/exceptions.py +2 -1
  25. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/futures.py +1 -2
  26. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/message.py +7 -6
  27. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/types.py +13 -11
  28. google_cloud_pubsub-2.36.0/google/pubsub/__init__.py +181 -0
  29. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub/gapic_version.py +1 -1
  30. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/__init__.py +82 -79
  31. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/gapic_version.py +1 -1
  32. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/publisher/async_client.py +24 -16
  33. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/publisher/client.py +23 -32
  34. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/publisher/pagers.py +12 -11
  35. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/publisher/transports/__init__.py +1 -3
  36. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/publisher/transports/base.py +15 -11
  37. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/publisher/transports/grpc.py +11 -10
  38. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/publisher/transports/grpc_asyncio.py +12 -11
  39. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/publisher/transports/rest.py +19 -23
  40. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/publisher/transports/rest_base.py +9 -9
  41. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/schema_service/async_client.py +22 -13
  42. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/schema_service/client.py +27 -23
  43. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/schema_service/pagers.py +10 -9
  44. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/schema_service/transports/__init__.py +1 -3
  45. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/schema_service/transports/base.py +15 -11
  46. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/schema_service/transports/grpc.py +11 -10
  47. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/schema_service/transports/grpc_asyncio.py +12 -11
  48. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/schema_service/transports/rest.py +18 -28
  49. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/schema_service/transports/rest_base.py +9 -9
  50. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/subscriber/async_client.py +28 -19
  51. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/subscriber/client.py +27 -33
  52. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/subscriber/pagers.py +10 -9
  53. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/subscriber/transports/__init__.py +1 -3
  54. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/subscriber/transports/base.py +15 -11
  55. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/subscriber/transports/grpc.py +11 -10
  56. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/subscriber/transports/grpc_asyncio.py +12 -11
  57. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/subscriber/transports/rest.py +19 -23
  58. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/subscriber/transports/rest_base.py +9 -9
  59. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/types/__init__.py +4 -2
  60. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/types/pubsub.py +141 -5
  61. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/types/schema.py +4 -3
  62. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0/google_cloud_pubsub.egg-info}/PKG-INFO +141 -36
  63. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google_cloud_pubsub.egg-info/requires.txt +3 -9
  64. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/setup.py +16 -17
  65. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/system.py +7 -12
  66. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/gapic/pubsub_v1/test_publisher.py +59 -56
  67. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/gapic/pubsub_v1/test_schema_service.py +62 -57
  68. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/gapic/pubsub_v1/test_subscriber.py +105 -105
  69. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/publisher/batch/test_base.py +5 -6
  70. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/publisher/batch/test_thread.py +12 -13
  71. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/publisher/sequencer/test_unordered_sequencer.py +6 -6
  72. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/publisher/test_flow_controller.py +1 -3
  73. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/publisher/test_publisher_client.py +12 -18
  74. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_dispatcher.py +10 -10
  75. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_futures_subscriber.py +1 -0
  76. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_heartbeater.py +5 -4
  77. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_helper_threads.py +1 -2
  78. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_leaser.py +10 -9
  79. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_message.py +6 -7
  80. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_scheduler.py +3 -4
  81. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_streaming_pull_manager.py +20 -28
  82. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_subscribe_opentelemetry.py +6 -7
  83. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_subscriber_client.py +6 -9
  84. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/test_futures.py +1 -3
  85. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/test_pubsub.py +1 -2
  86. google_cloud_pubsub-2.35.0/google/pubsub/__init__.py +0 -176
  87. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/LICENSE +0 -0
  88. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/MANIFEST.in +0 -0
  89. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/futures.py +0 -0
  90. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/open_telemetry/__init__.py +0 -0
  91. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/open_telemetry/publish_message_wrapper.py +1 -1
  92. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/proto/pubsub.proto +0 -0
  93. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/proto/schema.proto +0 -0
  94. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/_batch/__init__.py +0 -0
  95. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/_sequencer/__init__.py +0 -0
  96. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/publisher/futures.py +0 -0
  97. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/_protocol/__init__.py +0 -0
  98. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/_protocol/heartbeater.py +0 -0
  99. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/_protocol/leaser.py +1 -1
  100. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/_protocol/requests.py +0 -0
  101. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/cloud/pubsub_v1/subscriber/scheduler.py +1 -1
  102. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub/py.typed +0 -0
  103. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/gapic_metadata.json +0 -0
  104. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/py.typed +0 -0
  105. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/__init__.py +0 -0
  106. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/publisher/__init__.py +1 -1
  107. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/schema_service/__init__.py +1 -1
  108. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google/pubsub_v1/services/subscriber/__init__.py +1 -1
  109. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google_cloud_pubsub.egg-info/SOURCES.txt +0 -0
  110. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google_cloud_pubsub.egg-info/dependency_links.txt +0 -0
  111. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google_cloud_pubsub.egg-info/not-zip-safe +0 -0
  112. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/google_cloud_pubsub.egg-info/top_level.txt +0 -0
  113. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/setup.cfg +0 -0
  114. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/__init__.py +0 -0
  115. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/__init__.py +0 -0
  116. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/gapic/__init__.py +0 -0
  117. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/gapic/pubsub_v1/__init__.py +0 -0
  118. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/conftest.py +4 -4
  119. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/publisher/sequencer/test_ordered_sequencer.py +4 -4
  120. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/publisher/test_futures_publisher.py +0 -0
  121. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/publisher/test_publish_message_wrapper.py +1 -1
  122. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_histogram.py +0 -0
  123. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.0}/tests/unit/pubsub_v1/subscriber/test_messages_on_hold.py +3 -3
  124. {google_cloud_pubsub-2.35.0 → google_cloud_pubsub-2.36.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.36.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: 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
25
  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"
26
+ Requires-Dist: google-auth!=2.24.0,!=2.25.0,<3.0.0,>=2.14.1
27
+ Requires-Dist: grpcio<2.0.0,>=1.51.3; python_version < "3.14"
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
30
  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
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,26 +85,35 @@ 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
@@ -121,16 +128,14 @@ The last version of this library compatible with Python 3.7 and 3.8 is google-cl
121
128
 
122
129
  The last version of this library compatible with Python 2.7 is google-cloud-pubsub==1.7.0.
123
130
 
124
-
125
131
  Mac/Linux
126
132
  ^^^^^^^^^
127
133
 
128
134
  .. code-block:: console
129
135
 
130
- pip install virtualenv
131
- virtualenv <your-env>
136
+ python3 -m venv <your-env>
132
137
  source <your-env>/bin/activate
133
- <your-env>/bin/pip install google-cloud-pubsub
138
+ pip install google-cloud-pubsub
134
139
 
135
140
 
136
141
  Windows
@@ -138,11 +143,9 @@ Windows
138
143
 
139
144
  .. code-block:: console
140
145
 
141
- pip install virtualenv
142
- virtualenv <your-env>
143
- <your-env>\Scripts\activate
144
- <your-env>\Scripts\pip.exe install google-cloud-pubsub
145
-
146
+ py -m venv <your-env>
147
+ .\<your-env>\Scripts\activate
148
+ pip install google-cloud-pubsub
146
149
 
147
150
  Example Usage
148
151
  ~~~~~~~~~~~~~
@@ -281,3 +284,105 @@ License
281
284
  Apache 2.0 - See `the LICENSE`_ for more information.
282
285
 
283
286
  .. _the LICENSE: https://github.com/googleapis/google-cloud-python/blob/main/LICENSE
287
+
288
+ Next Steps
289
+ ~~~~~~~~~~
290
+
291
+ - Read the `Client Library Documentation`_ for Google Cloud Pub/Sub
292
+ to see other available methods on the client.
293
+ - Read the `Google Cloud Pub/Sub Product documentation`_ to learn
294
+ more about the product and see How-to Guides.
295
+ - View this `README`_ to see the full list of Cloud
296
+ APIs that we cover.
297
+
298
+ .. _Google Cloud Pub/Sub Product documentation: https://cloud.google.com/pubsub/docs/
299
+ .. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst
300
+
301
+ Logging
302
+ -------
303
+
304
+ This library uses the standard Python :code:`logging` functionality to log some RPC events that could be of interest for debugging and monitoring purposes.
305
+ Note the following:
306
+
307
+ #. 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.
308
+ #. 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**.
309
+ #. By default, the logging events from this library are not handled. You must **explicitly configure log handling** using one of the mechanisms below.
310
+
311
+ Simple, environment-based configuration
312
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
313
+
314
+ 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
315
+ 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
316
+ messages in a structured format. It does not currently allow customizing the logging levels captured nor the handlers, formatters, etc. used for any logging
317
+ event.
318
+
319
+ A logging scope is a period-separated namespace that begins with :code:`google`, identifying the Python module or package to log.
320
+
321
+ - Valid logging scopes: :code:`google`, :code:`google.cloud.asset.v1`, :code:`google.api`, :code:`google.auth`, etc.
322
+ - Invalid logging scopes: :code:`foo`, :code:`123`, etc.
323
+
324
+ **NOTE**: If the logging scope is invalid, the library does not set up any logging handlers.
325
+
326
+ Environment-Based Examples
327
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^
328
+
329
+ - Enabling the default handler for all Google-based loggers
330
+
331
+ .. code-block:: console
332
+
333
+ export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google
334
+
335
+ - Enabling the default handler for a specific Google module (for a client library called :code:`library_v1`):
336
+
337
+ .. code-block:: console
338
+
339
+ export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google.cloud.library_v1
340
+
341
+
342
+ Advanced, code-based configuration
343
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
344
+
345
+ You can also configure a valid logging scope using Python's standard `logging` mechanism.
346
+
347
+ Code-Based Examples
348
+ ^^^^^^^^^^^^^^^^^^^
349
+
350
+ - Configuring a handler for all Google-based loggers
351
+
352
+ .. code-block:: python
353
+
354
+ import logging
355
+
356
+ from google.cloud import library_v1
357
+
358
+ base_logger = logging.getLogger("google")
359
+ base_logger.addHandler(logging.StreamHandler())
360
+ base_logger.setLevel(logging.DEBUG)
361
+
362
+ - Configuring a handler for a specific Google module (for a client library called :code:`library_v1`):
363
+
364
+ .. code-block:: python
365
+
366
+ import logging
367
+
368
+ from google.cloud import library_v1
369
+
370
+ base_logger = logging.getLogger("google.cloud.library_v1")
371
+ base_logger.addHandler(logging.StreamHandler())
372
+ base_logger.setLevel(logging.DEBUG)
373
+
374
+ Logging details
375
+ ~~~~~~~~~~~~~~~
376
+
377
+ #. 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
378
+ logger from the `google`-level logger. If you need the events to be propagated to the root logger, you must explicitly set
379
+ :code:`logging.getLogger("google").propagate = True` in your code.
380
+ #. You can mix the different logging configurations above for different Google modules. For example, you may want use a code-based logging configuration for
381
+ one library, but decide you need to also set up environment-based logging configuration for another library.
382
+
383
+ #. If you attempt to use both code-based and environment-based configuration for the same module, the environment-based configuration will be ineffectual
384
+ if the code -based configuration gets applied first.
385
+
386
+ #. The Google-specific logging configurations (default handlers for environment-based configuration; not propagating logging events to the root logger) get
387
+ executed the first time *any* client library is instantiated in your application, and only if the affected loggers have not been previously configured.
388
+ (This is the reason for 2.i. above.)
@@ -1,9 +1,9 @@
1
- Python Client for Google Cloud Pub / Sub
2
- ========================================
1
+ Python Client for Google Cloud Pub/Sub
2
+ ======================================
3
3
 
4
- |GA| |pypi| |versions|
4
+ |stable| |pypi| |versions|
5
5
 
6
- `Google Cloud Pub / Sub`_ is a fully-managed real-time messaging service that
6
+ 'Google Cloud Pub/Sub:' is a fully-managed real-time messaging service that
7
7
  allows you to send and receive messages between independent applications. You
8
8
  can leverage Cloud Pub/Sub’s flexibility to decouple systems and components
9
9
  hosted on Google Cloud Platform or elsewhere on the Internet. By building on
@@ -16,18 +16,18 @@ can subscribe to that topic to receive the messages. By decoupling senders and
16
16
  receivers, Google Cloud Pub/Sub allows developers to communicate between
17
17
  independently written applications.
18
18
 
19
- - `Product Documentation`_
20
19
  - `Client Library Documentation`_
20
+ - `Product Documentation`_
21
21
 
22
- .. |GA| image:: https://img.shields.io/badge/support-GA-gold.svg
23
- :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#general-availability
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
24
  .. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-pubsub.svg
25
25
  :target: https://pypi.org/project/google-cloud-pubsub/
26
26
  .. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-pubsub.svg
27
27
  :target: https://pypi.org/project/google-cloud-pubsub/
28
- .. _Google Cloud Pub / Sub: https://cloud.google.com/pubsub/
29
- .. _Product Documentation: https://cloud.google.com/pubsub/docs
30
- .. _Client Library Documentation: https://cloud.google.com/python/docs/reference/pubsub/latest/summary_overview
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
31
 
32
32
  Quick Start
33
33
  -----------
@@ -36,26 +36,35 @@ In order to use this library, you first need to go through the following steps:
36
36
 
37
37
  1. `Select or create a Cloud Platform project.`_
38
38
  2. `Enable billing for your project.`_
39
- 3. `Enable the Google Cloud Pub / Sub API.`_
40
- 4. `Setup Authentication.`_
39
+ 3. `Enable the Google Cloud Pub/Sub.`_
40
+ 4. `Set up Authentication.`_
41
41
 
42
42
  .. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
43
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 API.: https://cloud.google.com/pubsub
45
- .. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
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
46
 
47
47
  Installation
48
48
  ~~~~~~~~~~~~
49
49
 
50
- Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to
51
- create isolated Python environments. The basic problem it addresses is one of
52
- dependencies and versions, and indirectly permissions.
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.
53
54
 
54
- With `virtualenv`_, it's possible to install this library without needing system
55
+ With `venv`_, it's possible to install this library without needing system
55
56
  install permissions, and without clashing with the installed system
56
57
  dependencies.
57
58
 
58
- .. _`virtualenv`: https://virtualenv.pypa.io/en/latest/
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
59
68
 
60
69
 
61
70
  Supported Python Versions
@@ -70,16 +79,14 @@ The last version of this library compatible with Python 3.7 and 3.8 is google-cl
70
79
 
71
80
  The last version of this library compatible with Python 2.7 is google-cloud-pubsub==1.7.0.
72
81
 
73
-
74
82
  Mac/Linux
75
83
  ^^^^^^^^^
76
84
 
77
85
  .. code-block:: console
78
86
 
79
- pip install virtualenv
80
- virtualenv <your-env>
87
+ python3 -m venv <your-env>
81
88
  source <your-env>/bin/activate
82
- <your-env>/bin/pip install google-cloud-pubsub
89
+ pip install google-cloud-pubsub
83
90
 
84
91
 
85
92
  Windows
@@ -87,11 +94,9 @@ Windows
87
94
 
88
95
  .. code-block:: console
89
96
 
90
- pip install virtualenv
91
- virtualenv <your-env>
92
- <your-env>\Scripts\activate
93
- <your-env>\Scripts\pip.exe install google-cloud-pubsub
94
-
97
+ py -m venv <your-env>
98
+ .\<your-env>\Scripts\activate
99
+ pip install google-cloud-pubsub
95
100
 
96
101
  Example Usage
97
102
  ~~~~~~~~~~~~~
@@ -230,3 +235,105 @@ License
230
235
  Apache 2.0 - See `the LICENSE`_ for more information.
231
236
 
232
237
  .. _the LICENSE: https://github.com/googleapis/google-cloud-python/blob/main/LICENSE
238
+
239
+ Next Steps
240
+ ~~~~~~~~~~
241
+
242
+ - Read the `Client Library Documentation`_ for Google Cloud Pub/Sub
243
+ to see other available methods on the client.
244
+ - Read the `Google Cloud Pub/Sub Product documentation`_ to learn
245
+ more about the product and see How-to Guides.
246
+ - View this `README`_ to see the full list of Cloud
247
+ APIs that we cover.
248
+
249
+ .. _Google Cloud Pub/Sub Product documentation: https://cloud.google.com/pubsub/docs/
250
+ .. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst
251
+
252
+ Logging
253
+ -------
254
+
255
+ This library uses the standard Python :code:`logging` functionality to log some RPC events that could be of interest for debugging and monitoring purposes.
256
+ Note the following:
257
+
258
+ #. 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.
259
+ #. 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**.
260
+ #. By default, the logging events from this library are not handled. You must **explicitly configure log handling** using one of the mechanisms below.
261
+
262
+ Simple, environment-based configuration
263
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
264
+
265
+ 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
266
+ 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
267
+ messages in a structured format. It does not currently allow customizing the logging levels captured nor the handlers, formatters, etc. used for any logging
268
+ event.
269
+
270
+ A logging scope is a period-separated namespace that begins with :code:`google`, identifying the Python module or package to log.
271
+
272
+ - Valid logging scopes: :code:`google`, :code:`google.cloud.asset.v1`, :code:`google.api`, :code:`google.auth`, etc.
273
+ - Invalid logging scopes: :code:`foo`, :code:`123`, etc.
274
+
275
+ **NOTE**: If the logging scope is invalid, the library does not set up any logging handlers.
276
+
277
+ Environment-Based Examples
278
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^
279
+
280
+ - Enabling the default handler for all Google-based loggers
281
+
282
+ .. code-block:: console
283
+
284
+ export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google
285
+
286
+ - Enabling the default handler for a specific Google module (for a client library called :code:`library_v1`):
287
+
288
+ .. code-block:: console
289
+
290
+ export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google.cloud.library_v1
291
+
292
+
293
+ Advanced, code-based configuration
294
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
295
+
296
+ You can also configure a valid logging scope using Python's standard `logging` mechanism.
297
+
298
+ Code-Based Examples
299
+ ^^^^^^^^^^^^^^^^^^^
300
+
301
+ - Configuring a handler for all Google-based loggers
302
+
303
+ .. code-block:: python
304
+
305
+ import logging
306
+
307
+ from google.cloud import library_v1
308
+
309
+ base_logger = logging.getLogger("google")
310
+ base_logger.addHandler(logging.StreamHandler())
311
+ base_logger.setLevel(logging.DEBUG)
312
+
313
+ - Configuring a handler for a specific Google module (for a client library called :code:`library_v1`):
314
+
315
+ .. code-block:: python
316
+
317
+ import logging
318
+
319
+ from google.cloud import library_v1
320
+
321
+ base_logger = logging.getLogger("google.cloud.library_v1")
322
+ base_logger.addHandler(logging.StreamHandler())
323
+ base_logger.setLevel(logging.DEBUG)
324
+
325
+ Logging details
326
+ ~~~~~~~~~~~~~~~
327
+
328
+ #. 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
329
+ logger from the `google`-level logger. If you need the events to be propagated to the root logger, you must explicitly set
330
+ :code:`logging.getLogger("google").propagate = True` in your code.
331
+ #. You can mix the different logging configurations above for different Google modules. For example, you may want use a code-based logging configuration for
332
+ one library, but decide you need to also set up environment-based logging configuration for another library.
333
+
334
+ #. If you attempt to use both code-based and environment-based configuration for the same module, the environment-based configuration will be ineffectual
335
+ if the code -based configuration gets applied first.
336
+
337
+ #. The Google-specific logging configurations (default handlers for environment-based configuration; not propagating logging events to the root logger) get
338
+ executed the first time *any* client library is instantiated in your application, and only if the affected loggers have not been previously configured.
339
+ (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
 
@@ -12,12 +12,12 @@
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
16
15
  from datetime import datetime
16
+ from typing import List, Optional
17
17
 
18
- from opentelemetry import trace, context
19
- from opentelemetry.trace.propagation.tracecontext import TraceContextTextMapPropagator
18
+ from opentelemetry import context, trace
20
19
  from opentelemetry.trace.propagation import set_span_in_context
20
+ from opentelemetry.trace.propagation.tracecontext import TraceContextTextMapPropagator
21
21
 
22
22
  from google.cloud.pubsub_v1.open_telemetry.context_propagation import (
23
23
  OpenTelemetryContextGetter,
@@ -168,9 +168,9 @@ class SubscribeOpenTelemetry:
168
168
  publish_create_span: trace.Span = trace.get_current_span(
169
169
  self._publisher_create_span_context
170
170
  )
171
- span_context: Optional[
172
- trace.SpanContext
173
- ] = publish_create_span.get_span_context()
171
+ span_context: Optional[trace.SpanContext] = (
172
+ publish_create_span.get_span_context()
173
+ )
174
174
  publish_create_span_link = (
175
175
  trace.Link(span_context) if span_context else None
176
176
  )
@@ -16,5 +16,4 @@ from __future__ import absolute_import
16
16
 
17
17
  from google.cloud.pubsub_v1.publisher.client import Client
18
18
 
19
-
20
19
  __all__ = ("Client",)
@@ -23,7 +23,6 @@ from google.cloud.pubsub_v1.open_telemetry.publish_message_wrapper import (
23
23
  PublishMessageWrapper,
24
24
  )
25
25
 
26
-
27
26
  if typing.TYPE_CHECKING: # pragma: NO COVER
28
27
  from google.cloud import pubsub_v1
29
28
  from google.cloud.pubsub_v1 import types
@@ -18,21 +18,20 @@ import logging
18
18
  import threading
19
19
  import time
20
20
  import typing
21
- from typing import Any, Callable, List, Optional, Sequence
22
21
  from datetime import datetime
22
+ from typing import Any, Callable, List, Optional, Sequence
23
23
 
24
- from opentelemetry import trace
25
24
  import google.api_core.exceptions
26
25
  from google.api_core import gapic_v1
27
26
  from google.auth import exceptions as auth_exceptions
27
+ from opentelemetry import trace
28
28
 
29
- from google.cloud.pubsub_v1.publisher import exceptions
30
- from google.cloud.pubsub_v1.publisher import futures
31
- from google.cloud.pubsub_v1.publisher._batch import base
32
- from google.pubsub_v1 import types as gapic_types
33
29
  from google.cloud.pubsub_v1.open_telemetry.publish_message_wrapper import (
34
30
  PublishMessageWrapper,
35
31
  )
32
+ from google.cloud.pubsub_v1.publisher import exceptions, futures
33
+ from google.cloud.pubsub_v1.publisher._batch import base
34
+ from google.pubsub_v1 import types as gapic_types
36
35
 
37
36
  if typing.TYPE_CHECKING: # pragma: NO COVER
38
37
  from google.cloud import pubsub_v1
@@ -196,9 +195,9 @@ class Batch(base.Batch):
196
195
  """
197
196
 
198
197
  with self._state_lock:
199
- assert (
200
- self._status == base.BatchStatus.ACCEPTING_MESSAGES
201
- ), "Cancel should not be called after sending has started."
198
+ assert self._status == base.BatchStatus.ACCEPTING_MESSAGES, (
199
+ "Cancel should not be called after sending has started."
200
+ )
202
201
 
203
202
  exc = RuntimeError(cancellation_reason.value)
204
203
  for future in self._futures:
@@ -292,8 +291,7 @@ class Batch(base.Batch):
292
291
  # called and now, the batch started to be committed, or
293
292
  # completed a commit, then no-op at this point.
294
293
  _LOGGER.debug(
295
- "Batch is already in progress or has been cancelled, "
296
- "exiting commit"
294
+ "Batch is already in progress or has been cancelled, exiting commit"
297
295
  )
298
296
  return
299
297
 
@@ -446,9 +444,9 @@ class Batch(base.Batch):
446
444
  future = None
447
445
 
448
446
  with self._state_lock:
449
- assert (
450
- self._status != base.BatchStatus.ERROR
451
- ), "Publish after stop() or publish error."
447
+ assert self._status != base.BatchStatus.ERROR, (
448
+ "Publish after stop() or publish error."
449
+ )
452
450
 
453
451
  if self.status != base.BatchStatus.ACCEPTING_MESSAGES:
454
452
  return None
@@ -18,10 +18,12 @@ import abc
18
18
  import typing
19
19
 
20
20
  from google.api_core import gapic_v1
21
+
21
22
  from google.pubsub_v1 import types as gapic_types
22
23
 
23
24
  if typing.TYPE_CHECKING: # pragma: NO COVER
24
25
  from concurrent import futures
26
+
25
27
  from google.pubsub_v1.services.publisher.client import OptionalRetry
26
28
 
27
29