diaspora-event-sdk 0.0.10__py3-none-any.whl → 0.0.11__py3-none-any.whl

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.
@@ -10,8 +10,7 @@ from diaspora_event_sdk.sdk.client import Client # Globus client
10
10
  from diaspora_event_sdk.sdk.kafka_client import kafka_available
11
11
 
12
12
  if kafka_available:
13
- from diaspora_event_sdk.sdk.kafka_client import KafkaProducer, KafkaConsumer, KafkaAdmin, NewTopic
14
- __all__ = ("Client", "KafkaProducer", "KafkaConsumer",
15
- "KafkaAdmin", "NewTopic")
13
+ from diaspora_event_sdk.sdk.kafka_client import KafkaProducer, KafkaConsumer
14
+ __all__ = ("Client", "KafkaProducer", "KafkaConsumer")
16
15
  else:
17
16
  __all__ = ("Client")
@@ -8,8 +8,7 @@ from .client import Client
8
8
  # If kafka-python is not installed, Kafka functionality is not available through diaspora-event-sdk.
9
9
  kafka_available = True
10
10
  try:
11
- from kafka import KafkaProducer, KafkaConsumer, KafkaAdminClient
12
- from kafka.admin import NewTopic
11
+ from kafka import KafkaProducer, KafkaConsumer
13
12
  except ImportError:
14
13
  kafka_available = False
15
14
 
@@ -25,7 +24,7 @@ def get_diaspora_config(extra_configs: Dict[str, Any] = {}) -> Dict[str, Any]:
25
24
  raise RuntimeError("Failed to retrieve Kafka keys") from e
26
25
 
27
26
  conf = {
28
- "bootstrap_servers": MSK_SCRAM_ENDPOINT,
27
+ "bootstrap_servers": MSK_SCRAM_ENDPOINT,
29
28
  "security_protocol": "SASL_SSL",
30
29
  "sasl_mechanism": "SCRAM-SHA-512",
31
30
  "api_version": (3, 5, 1),
@@ -37,14 +36,12 @@ def get_diaspora_config(extra_configs: Dict[str, Any] = {}) -> Dict[str, Any]:
37
36
 
38
37
 
39
38
  if kafka_available:
40
- class KafkaAdmin(KafkaAdminClient):
41
- def __init__(self, **configs):
42
- super().__init__(**get_diaspora_config(configs))
43
39
 
44
40
  class KafkaProducer(KafkaProducer):
45
41
  def __init__(self, **configs):
46
- configs.setdefault("value_serializer",
47
- lambda v: json.dumps(v).encode('utf-8'))
42
+ configs.setdefault(
43
+ "value_serializer", lambda v: json.dumps(v).encode("utf-8")
44
+ )
48
45
  super().__init__(**get_diaspora_config(configs))
49
46
 
50
47
  class KafkaConsumer(KafkaConsumer):
@@ -1 +1 @@
1
- __version__ = "0.0.10"
1
+ __version__ = "0.0.11"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: diaspora-event-sdk
3
- Version: 0.0.10
3
+ Version: 0.0.11
4
4
  Summary: SDK of Diaspora Event Fabric: Resilience-enabling services for science from HPC to edge
5
5
  Home-page: https://github.com/globus-labs/diaspora-event-sdk
6
6
  License: LICENSE
@@ -12,29 +12,28 @@ Requires-Dist: kafka-python ; extra == 'kafka-python'
12
12
 
13
13
  <h1>Diaspora Event Fabric: Resilience-enabling services for science from HPC to edge</h1>
14
14
 
15
- - [Installation Instructions](#installation-instructions)
16
- - [Recommended Installation with Kafka Client Library: kafka-python](#recommended-installation-with-kafka-client-library-kafka-python)
17
- - [Installation Without Kafka Client Library](#installation-without-kafka-client-library)
15
+ - [Installation](#installation)
16
+ * [Recommended Installation with Kafka Client Library](#recommended-installation-with-kafka-client-library)
17
+ * [Installation Without Kafka Client Library](#installation-without-kafka-client-library)
18
18
  - [Use Diaspora Event SDK](#use-diaspora-event-sdk)
19
- - [Use SDK to communicate with Kafka (kafka-python Required)](#use-sdk-to-communicate-with-kafka-kafka-python-required)
20
- - [Register Topic (create topic ACLs)](#register-topic-create-topic-acls)
21
- - [Create Topic](#create-topic)
22
- - [Start Producer](#start-producer)
23
- - [Start Consumer](#start-consumer)
24
- - [Delete Topic](#delete-topic)
25
- - [Unregister Topic (remove topic ACLs)](#unregister-topic-remove-topic-acls)
26
- - [Communicating with Kafka Using Your Preferred Client Library](#communicating-with-kafka-using-your-preferred-client-library)
27
- - [Register and Unregister Topic](#register-and-unregister-topic)
28
- - [Cluster Connection Details](#cluster-connection-details)
29
- - [Advanced Usage](#advanced-usage)
30
- - [Password Refresh](#password-refresh)
31
- - [Common Issues](#common-issues)
32
- - [ImportError: cannot import name 'KafkaAdmin' from 'diaspora\_event\_sdk'](#importerror-cannot-import-name-kafkaadmin-from-diaspora_event_sdk)
33
- - [kafka.errors.NoBrokersAvailable: NoBrokersAvailable](#kafkaerrorsnobrokersavailable-nobrokersavailable)
34
-
35
- ## Installation Instructions
36
- ### Recommended Installation with Kafka Client Library: kafka-python
37
- If you plan to utilize the `KafkaAdmin`, `KafkaProducer`, and `KafkaConsumer` classes in the SDK, which are extensions of the respective classes from the `kafka-python` library, we recommend installing the SDK with `kafka-python` support. This is especially convenient for tutorial purposes and integrating Kafka functionalities in your projects with out-of-box configurations.
19
+ * [Use the SDK to communicate with Kafka (kafka-python Required)](#use-the-sdk-to-communicate-with-kafka-kafka-python-required)
20
+ + [Register Topic (create topic ACLs)](#register-topic-create-topic-acls)
21
+ + [Start Producer](#start-producer)
22
+ + [Start Consumer](#start-consumer)
23
+ + [Unregister Topic (remove topic ACLs)](#unregister-topic-remove-topic-acls)
24
+ * [Use Your Preferred Kafka Client Library](#use-your-preferred-kafka-client-library)
25
+ + [Register and Unregister Topic](#register-and-unregister-topic)
26
+ + [Cluster Connection Details](#cluster-connection-details)
27
+ * [Advanced Usage](#advanced-usage)
28
+ + [Password Refresh](#password-refresh)
29
+ - [Common Issues](#common-issues)
30
+ * [ImportError: cannot import name 'KafkaProducer' from 'diaspora_event_sdk'](#importerror-cannot-import-name-kafkaproducer-from-diaspora_event_sdk)
31
+ * [kafka.errors.NoBrokersAvailable and kafka.errors.NodeNotReadyError](#kafkaerrorsnobrokersavailable-and-kafkaerrorsnodenotreadyerror)
32
+
33
+
34
+ ## Installation
35
+ ### Recommended Installation with Kafka Client Library
36
+ If you plan to utilize the `KafkaProducer` and `KafkaConsumer` classes in the SDK, which are extensions of the respective classes from the `kafka-python` library, we recommend installing the SDK with `kafka-python` support. This is especially convenient for tutorial purposes and integrating Kafka functionalities in your projects with out-of-box configurations.
38
37
 
39
38
  To install Diaspora Event SDK with `kafka-python`, run:
40
39
  ```bash
@@ -48,10 +47,10 @@ To install the SDK without Kafka support, simply run:
48
47
  ```bash
49
48
  pip install diaspora-event-sdk
50
49
  ```
51
- Note that this option does not install the necessary dependency for `KafkaAdmin`, `KafkaProducer`, and `KafkaConsumer` below to work.
50
+ Note that this option does not install the necessary dependency for `KafkaProducer` and `KafkaConsumer` below to work.
52
51
 
53
52
  ## Use Diaspora Event SDK
54
- ### Use SDK to communicate with Kafka (kafka-python Required)
53
+ ### Use the SDK to communicate with Kafka (kafka-python Required)
55
54
 
56
55
  #### Register Topic (create topic ACLs)
57
56
 
@@ -64,17 +63,7 @@ topic = "topic-" + c.subject_openid[-12:]
64
63
  print(c.register_topic(topic))
65
64
  print(c.list_topics())
66
65
  ```
67
-
68
- #### Create Topic
69
-
70
- Now use the KafkaAdmin to create the topic.
71
-
72
- ```python
73
- from diaspora_event_sdk import KafkaAdmin, NewTopic
74
- admin = KafkaAdmin()
75
- print(admin.create_topics(new_topics=[
76
- NewTopic(name=topic, num_partitions=1, replication_factor=1)]))
77
- ```
66
+ Register a topic also creates it, if the topic previously does not exist.
78
67
 
79
68
  #### Start Producer
80
69
 
@@ -99,13 +88,6 @@ for msg in consumer:
99
88
  print(msg)
100
89
  ```
101
90
 
102
- #### Delete Topic
103
- ```python
104
- from diaspora_event_sdk import KafkaAdmin
105
- admin = KafkaAdmin()
106
- print(admin.delete_topics(topics=[topic]))
107
- ```
108
-
109
91
  #### Unregister Topic (remove topic ACLs)
110
92
  ```python
111
93
  from diaspora_event_sdk import Client as GlobusClient
@@ -115,7 +97,7 @@ print(c.unregister_topic(topic))
115
97
  print(c.list_topics())
116
98
  ```
117
99
 
118
- ### Communicating with Kafka Using Your Preferred Client Library
100
+ ### Use Your Preferred Kafka Client Library
119
101
 
120
102
  #### Register and Unregister Topic
121
103
  The steps are the same as above by using the `register_topic`, `unregister_topic`, and `list_topics` methods from the `Client` class.
@@ -148,11 +130,11 @@ print(c.create_key())
148
130
  ```
149
131
  Subsequent calls to `retrieve_key` will return the new password from the cache. This cache is reset with a logout or a new `create_key` call.
150
132
 
151
- ### Common Issues
133
+ ## Common Issues
152
134
 
153
- #### ImportError: cannot import name 'KafkaAdmin' from 'diaspora_event_sdk'
135
+ ### ImportError: cannot import name 'KafkaProducer' from 'diaspora_event_sdk'
154
136
 
155
- It seems that you ran `pip install diaspora-event-sdk` to install the Diaspora Event SDK without `kafka-python`. Run `pip install kafka-python` to install the necessary dependency for our `KafkaAdmin`, `KafkaProducer`, and `KafkaConsumer` classes.
137
+ It seems that you ran `pip install diaspora-event-sdk` to install the Diaspora Event SDK without `kafka-python`. Run `pip install kafka-python` to install the necessary dependency for our `KafkaProducer` and `KafkaConsumer` classes.
156
138
 
157
- #### kafka.errors.NoBrokersAvailable and kafka.errors.NodeNotReadyError
158
- These messages might pop up if `create_key` is called shortly before instanciating a Kafka client. This is because there's a delay for AWS Secret Manager to associate the newly generated credential with MSK. Note that `create_key` is called the first time you create one of these clients. Please wait a while (around 1 minute) and retry.
139
+ ### kafka.errors.NoBrokersAvailable and kafka.errors.NodeNotReadyError
140
+ These messages might pop up if `create_key` is called shortly before instanciating a Kafka client. This is because there's a delay for AWS Secret Manager to associate the newly generated credential with MSK. Note that `create_key` is called internally by `kafka_client.py` the first time you create one of these clients. Please wait a while (around 1 minute) and retry.
@@ -1,10 +1,10 @@
1
- diaspora_event_sdk/__init__.py,sha256=aog9b4ljY5AAdH5z7qEsjceBn5y--ENk8GIYULRpSeo,603
2
- diaspora_event_sdk/version.py,sha256=-nNlMKS9nph3FR78_ZG9RGKrbxseeNp2K6nMr0pVGaU,23
1
+ diaspora_event_sdk/__init__.py,sha256=HecfCu-giI3bBGXcysQHmzkrX9wbwcXoU4k_uHeJWh0,540
2
+ diaspora_event_sdk/version.py,sha256=OaIl7v-6zEWEY90Jlh6yoBjO3zWX1oX7RsvqrK3o1TU,23
3
3
  diaspora_event_sdk/sdk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  diaspora_event_sdk/sdk/_environments.py,sha256=UwzEeBVRuP7ZyqTJagNVA24EiCLuOYiy395q608AwQ0,358
5
5
  diaspora_event_sdk/sdk/client.py,sha256=DhUDtdkPRmn8P0fTXWg3x-Gn3p2J3ir0Ki7qeOFyp9I,3396
6
6
  diaspora_event_sdk/sdk/decorators.py,sha256=Gel8AyhIjbf4-FNintTNcOqvC9hHH_YwbOH257Nfmf0,884
7
- diaspora_event_sdk/sdk/kafka_client.py,sha256=BM_mIM3UxA8xhOhygCX02IruOdbW7kUd0iaqxOZCfd4,1721
7
+ diaspora_event_sdk/sdk/kafka_client.py,sha256=bfYKAAbgzRdeMK_gmr84n5653KYboWjO6F4BjgmWExs,1524
8
8
  diaspora_event_sdk/sdk/web_client.py,sha256=BgRza0fJudvgRCZ_P9BugFp57oYRWekpBf2KlZYFqUY,1305
9
9
  diaspora_event_sdk/sdk/login_manager/__init__.py,sha256=yeqVgjeHLMX0WZJu2feJmq-fbeXvSxWghVV81ygfY-w,239
10
10
  diaspora_event_sdk/sdk/login_manager/client_login.py,sha256=gvR4PkIqQpIywNieJQ_u11PHUmdLxQ0Ho-QgPSfu8bw,1798
@@ -16,9 +16,8 @@ diaspora_event_sdk/sdk/login_manager/protocol.py,sha256=RCuo2jy_XkpZvbxnKlDfTKs-
16
16
  diaspora_event_sdk/sdk/login_manager/tokenstore.py,sha256=7jRm01rzsbvniaCfYtDDWE3det_1_b6oQkS-YQ2Qjg4,3037
17
17
  diaspora_event_sdk/sdk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  diaspora_event_sdk/sdk/utils/uuid_like.py,sha256=xbxf0YXpDhdii16lwPLWRN21qFekHrNrqODSToMPtCg,470
19
- tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
- diaspora_event_sdk-0.0.10.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
21
- diaspora_event_sdk-0.0.10.dist-info/METADATA,sha256=iNlzJxmvB23yVbIEiRS_O9TpaOXSqP0SvCnRrJTpAxI,7543
22
- diaspora_event_sdk-0.0.10.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
23
- diaspora_event_sdk-0.0.10.dist-info/top_level.txt,sha256=OVun-67t3fkLFEIwvJuNINgFFvAc--bClYhXjLhMmvs,25
24
- diaspora_event_sdk-0.0.10.dist-info/RECORD,,
19
+ diaspora_event_sdk-0.0.11.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
20
+ diaspora_event_sdk-0.0.11.dist-info/METADATA,sha256=jPFx9QiJ0uYkRqzWYIxeAiHa_sSRWmAguT-ANlJIp4Y,7049
21
+ diaspora_event_sdk-0.0.11.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
22
+ diaspora_event_sdk-0.0.11.dist-info/top_level.txt,sha256=_5Wx8F5rc9mpB093wvCXa6CArtWNXwek2T1LnmkS2vE,19
23
+ diaspora_event_sdk-0.0.11.dist-info/RECORD,,
tests/__init__.py DELETED
File without changes