warpzone-sdk 14.0.0__py3-none-any.whl → 14.2.0__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.
@@ -0,0 +1,230 @@
1
+ Metadata-Version: 2.4
2
+ Name: warpzone-sdk
3
+ Version: 14.2.0
4
+ Summary: The main objective of this package is to centralize logic used to interact with Azure Functions, Azure Service Bus and Azure Table Storage
5
+ Author: Team Enigma
6
+ Author-email: enigma@energinet.dk
7
+ Requires-Python: >=3.10
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Requires-Dist: aiohttp (>=3.8.3)
15
+ Requires-Dist: azure-core (>=1.26.3)
16
+ Requires-Dist: azure-core-tracing-opentelemetry (>=1.0.0b12)
17
+ Requires-Dist: azure-data-tables (>=12.4.0)
18
+ Requires-Dist: azure-functions (>=1.12.0)
19
+ Requires-Dist: azure-identity (>=1.15.0)
20
+ Requires-Dist: azure-monitor-opentelemetry-exporter (>=1.0.0b36)
21
+ Requires-Dist: azure-servicebus (>=7.8.0,<7.9.0)
22
+ Requires-Dist: azure-storage-blob (>=12.14.1)
23
+ Requires-Dist: cryptography (==43.0.3)
24
+ Requires-Dist: datamazing (>=5.1.6)
25
+ Requires-Dist: deltalake (==1.2.1)
26
+ Requires-Dist: numpy (>=1.26.4)
27
+ Requires-Dist: obstore (>=0.8.2)
28
+ Requires-Dist: opentelemetry-sdk (>=1.32.0)
29
+ Requires-Dist: pandas (>=2.0.3)
30
+ Requires-Dist: polars (>=1.33.1)
31
+ Requires-Dist: pyarrow (>=19.0.0)
32
+ Requires-Dist: typeguard (>=4.0.1)
33
+ Description-Content-Type: text/markdown
34
+
35
+ # WarpZone SDK
36
+
37
+ This package contains tools used in the WarpZone project.
38
+ These tool include:
39
+
40
+ - [Client for Storage](#client-for-storage)
41
+ - [Client for Servicebus](#client-for-servicebus)
42
+ - [Function wrapper](#function-wrapper)
43
+
44
+ ---
45
+
46
+ ## Client for Storage
47
+
48
+ ### Table storage
49
+ `WarpzoneTableClient` (sync) and `WarpzoneTableClientAsync` (async) clients are used for reading from and writing to Azure Storage Table Service.
50
+
51
+ ![tableclient](docs/tableclient.png)
52
+
53
+ --
54
+
55
+ ### Blob storage
56
+ `WarpzoneBlobClient` client is used for uploading to and downloading from Azure Storage Blob Service.
57
+
58
+ ![storage](docs/storageclient.png)
59
+
60
+ --
61
+
62
+ ### Database
63
+
64
+ `WarpzoneDatabaseClient` (sync) is an umbrella client used in warpZone, which consists of both `WarpzoneTableClient` and `WarpzoneBlobClient`
65
+
66
+
67
+ ---
68
+
69
+ ## Client for Servicebus
70
+ Due to limitations on message sizes, we use different methods for sending *events* and *data* using Azure Service Bus.
71
+
72
+ ### Events
73
+
74
+ We use the Service Bus for transmitting event messages. By an *event*, we mean a JSON formatted message, containing information about an event occuring in one part of the system, which needs to trigger another part of the system (such as an Azure Function trigger).
75
+
76
+
77
+ `WarpzoneEventClient` client is used for sending and receiving events.
78
+
79
+ ![eventclient](docs/eventclient.png)
80
+
81
+ --
82
+
83
+ ### Data
84
+
85
+ We **do not** use the Service Bus for transmitting data directly. Instead, we use a claim-check pattern, were we store the data using Storage Blob, and transmit an event about the details of this stored data.
86
+
87
+ `WarpzoneDataClient` client is used for sending and receiving data in this way. The following diagram shows how the process works:
88
+
89
+ 1. Data is uploaded
90
+ 2. Event containing the blob location is send
91
+ 3. Event is received
92
+ 4. Data is downloaded using the blob location contained in the event
93
+
94
+ ![dataclient](docs/dataclient.png)
95
+
96
+ The transmitted event has the following format:
97
+ ```json
98
+ {
99
+ "container_name": "<container-name>",
100
+ "blob_name": "<blob-name>",
101
+ "timestamp": "<%Y-%m-%dT%H:%M:%S%z>"
102
+ }
103
+ ```
104
+ The data will be stored with
105
+ - `<container-name>` = `<topic-name>`
106
+ - `<blob-name>` = `<subject>/year=<%Y>/month=<%m>/day=<%d>/hour=<%H>/<message-id>.<extension>`
107
+
108
+
109
+ ---
110
+
111
+ ## Function Wrapper
112
+
113
+ For executing logic, we use a framework built on top of Azure Functions. The following diagram shows how the framework works:
114
+
115
+ 1. The function is triggered by a **trigger** object (e.g. a timer or a message being received)
116
+ 2. Possible **dependency** objects are initialized (potentially using information from the trigger). These are used to integrate with external systems (e.g. a database client).
117
+ 3. Using the trigger and dependencies as inputs, the function outputs and an **output** object (e.g. a message being sent).
118
+
119
+ ![function](./docs/function.png)
120
+
121
+
122
+ The reason we have used our own framework instead of Azure Functions directly, is that we want to use our own objects as triggers, dependencies and outputs, instead of the built-in bindings. For example, as explained [above](#data), we have created our own abstraction of a message for transmitting data (`warpzone.DataMessage`); so we would like to use this, instead of the built-in binding `azure.function.ServiceBusMessage`.
123
+
124
+ Since it is not yet possible to define [custom bindings](https://github.com/Azure/azure-webjobs-sdk/wiki/Creating-custom-input-and-output-bindings) in Python, we have defined our own wrapping logic, to handle the conversion between our own objects and the built-in bindings. The following diagram shows how the wrapping logic works:
125
+
126
+
127
+ 1. Azure trigger binding is converted to trigger object
128
+ 2. Either
129
+ - (a) Output object is converted to Azure output binding.
130
+ - (b) Use custom output logic, when no suitable output binding exists (e.g. we use the Azure Service Bus SDK instead of the Service Bus output binding, since this is [recommended](https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus-output?tabs=python-v1%2Cin-process%2Cextensionv5&pivots=programming-language-python#usage))
131
+ 3. All logs and traces are sent to App Insights automatically.
132
+
133
+
134
+ ![function-wrap](./docs/wrapping-logic.png)
135
+
136
+ --
137
+
138
+ ### Examples
139
+
140
+ Azure Function with data messages as trigger and output:
141
+
142
+ ```json
143
+ # function.json
144
+ {
145
+ "scriptFile": "__init__.py",
146
+ "entryPoint": "main",
147
+ "bindings": [
148
+ {
149
+ "name": "msg",
150
+ "type": "serviceBusTrigger",
151
+ "direction": "in",
152
+ "connection": "...",
153
+ "topicName": "...",
154
+ "subscriptionName": "..."
155
+ }
156
+ ]
157
+ }
158
+
159
+ ```
160
+
161
+ ```python
162
+ import warpzone as wz
163
+
164
+ def do_nothing(data_msg: wz.DataMessage) -> wz.DataMessage:
165
+ return data_msg
166
+
167
+ main = wz.functionize(
168
+ f=do_nothing,
169
+ trigger=wz.triggers.DataMessageTrigger(binding_name="msg"),
170
+ output=wz.outputs.DataMessageOutput(wz.Topic.UNIFORM)
171
+ )
172
+ ```
173
+
174
+ Azure Function with HTTP messages as trigger and output:
175
+
176
+ ```json
177
+ # function.json
178
+ {
179
+ "scriptFile": "__init__.py",
180
+ "entryPoint": "main",
181
+ "bindings": [
182
+ {
183
+ "authLevel": "anonymous",
184
+ "name": "req",
185
+ "type": "httpTrigger",
186
+ "direction": "in"
187
+ },
188
+ {
189
+ "type": "http",
190
+ "direction": "out",
191
+ "name": "$return"
192
+ }
193
+ ]
194
+ }
195
+ ```
196
+
197
+ ```python
198
+ # __init__.py
199
+ import warpzone as wz
200
+ import azure.functions as func
201
+
202
+ def return_ok(req: func.HttpRequest) -> func.HttpResponse:
203
+ return func.HttpResponse("OK")
204
+
205
+ main = wz.functionize(
206
+ f=return_ok,
207
+ trigger=wz.triggers.HttpTrigger(binding_name="req"),
208
+ output=wz.outputs.HttpOutput()
209
+ )
210
+ ```
211
+
212
+ Azure Function using dependencies:
213
+
214
+ ```python
215
+ import warpzone as wz
216
+
217
+ def do_nothing(
218
+ data_msg: wz.DataMessage,
219
+ db: wz.WarpzoneDatabaseClient,
220
+ ) -> wz.DataMessage:
221
+ return data_msg
222
+
223
+ main = wz.functionize(
224
+ f=do_nothing,
225
+ trigger=wz.triggers.DataMessageTrigger(binding_name="msg"),
226
+ output=wz.outputs.DataMessageOutput(wz.Topic.UNIFORM),
227
+ dependencies=[wz.dependencies.TableDatabaseDependency()],
228
+ )
229
+ ```
230
+
@@ -52,6 +52,6 @@ warpzone/tools/copy.py,sha256=5fddotMZkXZO8avzUbGOhvs0cp8mce95pNpy0oPVjnQ,2596
52
52
  warpzone/transform/__init__.py,sha256=ruGa7tl-v4ndlWpULE1jSGU_a4_iRc3V6eyNr5xKP9E,27
53
53
  warpzone/transform/data.py,sha256=Abb8PcrgMbbNCJkkIUdtrTHdlY0OfXid387qw1nDpFY,2362
54
54
  warpzone/transform/schema.py,sha256=nbSQtDMvXkyqGKuwhuFCF0WsEDsaNyoPYpMKvbsKlv8,2423
55
- warpzone_sdk-14.0.0.dist-info/METADATA,sha256=-4z25MWWZodkMbYvRQbYoplmyULDwsdl1_9HTIgU3D0,1482
56
- warpzone_sdk-14.0.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
57
- warpzone_sdk-14.0.0.dist-info/RECORD,,
55
+ warpzone_sdk-14.2.0.dist-info/METADATA,sha256=f6IbtlDmP71GxyO3TbN7xMaa8z6cRpCl6IrWHhq5BGs,7347
56
+ warpzone_sdk-14.2.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
57
+ warpzone_sdk-14.2.0.dist-info/RECORD,,
@@ -1,32 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: warpzone-sdk
3
- Version: 14.0.0
4
- Summary: The main objective of this package is to centralize logic used to interact with Azure Functions, Azure Service Bus and Azure Table Storage
5
- Author: Mikkel Ladekarl Folmersen Nygaard
6
- Author-email: mny@energinet.dk
7
- Requires-Python: >=3.10,<4.0
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.10
10
- Classifier: Programming Language :: Python :: 3.11
11
- Classifier: Programming Language :: Python :: 3.12
12
- Classifier: Programming Language :: Python :: 3.13
13
- Classifier: Programming Language :: Python :: 3.14
14
- Requires-Dist: aiohttp (>=3.8.3,<4.0.0)
15
- Requires-Dist: azure-core (>=1.26.3,<2.0.0)
16
- Requires-Dist: azure-core-tracing-opentelemetry (==1.0.0b12)
17
- Requires-Dist: azure-data-tables (>=12.4.0,<13.0.0)
18
- Requires-Dist: azure-functions (>=1.12.0,<2.0.0)
19
- Requires-Dist: azure-identity (>=1.15.0,<2.0.0)
20
- Requires-Dist: azure-monitor-opentelemetry-exporter (==1.0.0b36)
21
- Requires-Dist: azure-servicebus (>=7.8.0,<7.9.0)
22
- Requires-Dist: azure-storage-blob (>=12.14.1,<13.0.0)
23
- Requires-Dist: cryptography (==43.0.3)
24
- Requires-Dist: datamazing (>=5.1.0,<6.0.0)
25
- Requires-Dist: deltalake (>=1.1.4,<2.0.0)
26
- Requires-Dist: numpy (>=1.26.4,<2.0.0)
27
- Requires-Dist: obstore (>=0.8.2,<0.9.0)
28
- Requires-Dist: opentelemetry-sdk (==1.32.0)
29
- Requires-Dist: pandas (>=2.0.3,<3.0.0)
30
- Requires-Dist: polars (>=1.33.1,<2.0.0)
31
- Requires-Dist: pyarrow (>=19.0.0,<20.0.0)
32
- Requires-Dist: typeguard (>=4.0.1,<5.0.0)