stinger-python-utils 0.2.0__tar.gz → 0.3.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: stinger-python-utils
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: Common utilities for Stinger Python services.
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "stinger-python-utils"
7
- version = "0.2.0"
7
+ version = "0.3.0"
8
8
  description = "Common utilities for Stinger Python services."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -211,7 +211,7 @@ class MessageCreator:
211
211
  cls,
212
212
  topic: str,
213
213
  property_obj: BaseModel,
214
- version: str,
214
+ version: Optional[int],
215
215
  response_topic: str,
216
216
  correlation_id: Union[str, bytes, None] = None,
217
217
  ) -> Message:
@@ -233,13 +233,13 @@ class MessageCreator:
233
233
  topic: str,
234
234
  payload: bytes,
235
235
  content_type: str,
236
- version: str,
236
+ version: Optional[int],
237
237
  response_topic: str,
238
238
  correlation_id: Union[str, bytes, None] = None,
239
239
  ) -> Message:
240
240
  cls._validate_topic(topic)
241
241
  cls._validate_topic(response_topic, "response_topic")
242
- return Message(
242
+ msg = Message(
243
243
  topic=topic,
244
244
  payload=payload,
245
245
  qos=1,
@@ -251,15 +251,17 @@ class MessageCreator:
251
251
  if isinstance(correlation_id, str)
252
252
  else correlation_id
253
253
  ),
254
- user_properties={"PropertyVersion": str(version)},
255
254
  )
255
+ if version is not None:
256
+ msg.user_properties = {"PropertyVersion": str(version)}
257
+ return msg
256
258
 
257
259
  @classmethod
258
260
  def property_response_message(
259
261
  cls,
260
262
  response_topic: str,
261
263
  property_obj: BaseModel,
262
- version: str,
264
+ version: Optional[int],
263
265
  return_code: Union[int, MethodReturnCode],
264
266
  correlation_id: Union[str, bytes, None] = None,
265
267
  debug_info: Optional[str] = None,
@@ -283,7 +285,7 @@ class MessageCreator:
283
285
  response_topic: str,
284
286
  payload: bytes,
285
287
  content_type: str,
286
- version: str,
288
+ version: Optional[int],
287
289
  return_code: Union[int, MethodReturnCode],
288
290
  correlation_id: Union[str, bytes, None] = None,
289
291
  debug_info: Optional[str] = None,
@@ -307,13 +309,13 @@ class MessageCreator:
307
309
  ),
308
310
  user_properties={
309
311
  "ReturnCode": str(rc),
310
- "PropertyVersion": str(version),
311
312
  },
312
313
  )
313
- if (
314
- debug_info is not None and msg_obj.user_properties is not None
315
- ): # user_properties should never be None here, but checking to satisfy type checker
316
- msg_obj.user_properties["DebugInfo"] = debug_info
314
+ if msg_obj.user_properties is not None: # user_properties should never be None here, but checking to satisfy type checker
315
+ if version is not None:
316
+ msg_obj.user_properties["PropertyVersion"] = str(version)
317
+ if debug_info is not None:
318
+ msg_obj.user_properties["DebugInfo"] = debug_info
317
319
  return msg_obj
318
320
 
319
321
  @classmethod
@@ -1388,7 +1388,7 @@ wheels = [
1388
1388
 
1389
1389
  [[package]]
1390
1390
  name = "stinger-python-utils"
1391
- version = "0.2.0"
1391
+ version = "0.3.0"
1392
1392
  source = { editable = "." }
1393
1393
  dependencies = [
1394
1394
  { name = "pydantic", version = "2.5.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.8'" },