azure-functions-durable 1.3.2__py3-none-any.whl → 1.3.3__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.
@@ -100,6 +100,8 @@ class DurableOrchestrationContext:
100
100
  self.open_tasks = defaultdict(list)
101
101
  self.deferred_tasks: Dict[Union[int, str], Tuple[HistoryEvent, bool, str]] = {}
102
102
 
103
+ self._version: str = self._extract_version_from_history(self._histories)
104
+
103
105
  @classmethod
104
106
  def from_json(cls, json_string: str):
105
107
  """Convert the value passed into a new instance of the class.
@@ -752,3 +754,25 @@ class DurableOrchestrationContext:
752
754
  "https://github.com/Azure/azure-functions-durable-python.\n"\
753
755
  "Error trace: " + e.message
754
756
  raise e
757
+
758
+ @property
759
+ def version(self) -> Optional[str]:
760
+ """Get the version assigned to the orchestration instance on creation.
761
+
762
+ Returns
763
+ -------
764
+ Optional[str]
765
+ The version assigned to the orchestration instance on creation, or None if not found.
766
+ """
767
+ return self._version
768
+
769
+ @staticmethod
770
+ def _extract_version_from_history(history_events: List[HistoryEvent]) -> Optional[str]:
771
+ """Extract the version from the execution started event in history.
772
+
773
+ Returns None if not found.
774
+ """
775
+ for event in history_events:
776
+ if event.event_type == HistoryEventType.EXECUTION_STARTED:
777
+ return event.Version
778
+ return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: azure-functions-durable
3
- Version: 1.3.2
3
+ Version: 1.3.3
4
4
  Summary: Durable Functions For Python
5
5
  Home-page: https://github.com/Azure/azure-functions-durable-python
6
6
  Author: Azure Functions team at Microsoft Corp.
@@ -20,7 +20,7 @@ Requires-Python: >=3.9,<4
20
20
  Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
22
  Requires-Dist: azure-functions>=1.12.0
23
- Requires-Dist: aiohttp>=3.12.9
23
+ Requires-Dist: aiohttp>=3.12.14
24
24
  Requires-Dist: requests==2.*
25
25
  Requires-Dist: python-dateutil>=2.8.0
26
26
  Requires-Dist: furl>=2.1.0
@@ -9,7 +9,7 @@ azure/durable_functions/models/DurableEntityContext.py,sha256=cyZmjjZu18oV9S4A2N
9
9
  azure/durable_functions/models/DurableHttpRequest.py,sha256=a5kgRdg4eA0sgyDcpmQWc0dbwP-o3BwWW2Ive0BYO_Q,2021
10
10
  azure/durable_functions/models/DurableOrchestrationBindings.py,sha256=_hp61WjN3bQYCqYFQuvUaDdRu7C14fPg7lFbaA9TRe4,2408
11
11
  azure/durable_functions/models/DurableOrchestrationClient.py,sha256=kQBqeKugvi2mi-7dDbCxlu67r20doEhDknlchYxcLBE,33018
12
- azure/durable_functions/models/DurableOrchestrationContext.py,sha256=Vrox-oX8QfSFmcPampUOTgMx85DuZs_HMQyzavqozEc,31256
12
+ azure/durable_functions/models/DurableOrchestrationContext.py,sha256=fZNbUisN9vkublT2L7wYbj0CNfQNOyYcqRwZ9T-SgN8,32090
13
13
  azure/durable_functions/models/DurableOrchestrationStatus.py,sha256=BXWz9L7np4Q9k6z4NsfLX97i2U2IFh94TVeRSV2BjM4,6049
14
14
  azure/durable_functions/models/EntityStateResponse.py,sha256=f48W8gmlb-D5iJw3eDyUMYVwHpmIxP6k6a7o2TRHwII,674
15
15
  azure/durable_functions/models/FunctionContext.py,sha256=4gHTmIo8DZN-bZLM-hyjoQFlv-AbsfLMT1_X4WxWxqY,274
@@ -60,7 +60,7 @@ tests/models/test_DecoratorMetadata.py,sha256=0PeUDszF_gAJZMZR-K-Ro7c3I1D960amOL
60
60
  tests/models/test_Decorators.py,sha256=y2dhoSlP74J5uAVBDY2JfFkSA-AhyagVBZO5tGi6KaQ,2925
61
61
  tests/models/test_DurableOrchestrationBindings.py,sha256=pjuoKlpEc6KAIL-Nq2taoqW0HYWXoupgUxcsPwc1Psg,2961
62
62
  tests/models/test_DurableOrchestrationClient.py,sha256=7htzuMMfkRU9Hf-9Gr-rYHpJXJdpnAp0WheAFpMKHNo,31791
63
- tests/models/test_DurableOrchestrationContext.py,sha256=7fWdnvpSEces0VM4Xm11uLZmshXqGl7wtYo8ELixypc,3930
63
+ tests/models/test_DurableOrchestrationContext.py,sha256=ewNEH2g8gn60bVftXT6zmI6nkANXB1u7XsC1l9vXFxg,4328
64
64
  tests/models/test_DurableOrchestrationStatus.py,sha256=fnUZxrHGy771OoaD5TInELhaG836aB8XqtMdNjnEFp8,2485
65
65
  tests/models/test_OrchestrationState.py,sha256=L-k8ScrqoDIZEqIUORbxXA7yCuMbVAUPr-7VmyuQkUc,1272
66
66
  tests/models/test_RpcManagementOptions.py,sha256=hvDzlJED8egJloju5nFvKYusgwLgy-o_avJAY6uzfdg,3190
@@ -96,8 +96,8 @@ tests/test_utils/json_utils.py,sha256=B0q3COMya7TGxbH-7sD_0ypWDSuaF4fpD4QV_oJPgG
96
96
  tests/test_utils/testClasses.py,sha256=U_u5qKxC9U81SzjLo7ejjPjEn_cE5qjaqoq8edGD6l8,1521
97
97
  tests/utils/__init__.py,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
98
98
  tests/utils/test_entity_utils.py,sha256=kdk5_DV_-bFu_5q2mw9o1yjyzh8Lcxv1jo1Q7is_ukA,748
99
- azure_functions_durable-1.3.2.dist-info/LICENSE,sha256=-VS-Izmxdykuae1Xc4vHtVUx02rNQi6SSQlONvvuYeQ,1090
100
- azure_functions_durable-1.3.2.dist-info/METADATA,sha256=3zhhixYOOBegIn-AnvaaAfMzQtFs7s7X6ggHofdvrDQ,3523
101
- azure_functions_durable-1.3.2.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
102
- azure_functions_durable-1.3.2.dist-info/top_level.txt,sha256=h-L8XDVPJ9YzBbHlPvM7FVo1cqNGToNK9ix99ySGOUY,12
103
- azure_functions_durable-1.3.2.dist-info/RECORD,,
99
+ azure_functions_durable-1.3.3.dist-info/LICENSE,sha256=-VS-Izmxdykuae1Xc4vHtVUx02rNQi6SSQlONvvuYeQ,1090
100
+ azure_functions_durable-1.3.3.dist-info/METADATA,sha256=3chTZDt7a-uj_TSYe2X48a03t5K7A7Ieyp1coS3H86c,3524
101
+ azure_functions_durable-1.3.3.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
102
+ azure_functions_durable-1.3.3.dist-info/top_level.txt,sha256=h-L8XDVPJ9YzBbHlPvM7FVo1cqNGToNK9ix99ySGOUY,12
103
+ azure_functions_durable-1.3.3.dist-info/RECORD,,
@@ -100,3 +100,11 @@ def test_get_input_json_str():
100
100
  result = context.get_input()
101
101
 
102
102
  assert 'Seattle' == result['city']
103
+
104
+ def test_version_equals_version_from_execution_started_event():
105
+ builder = ContextBuilder('test_function_context')
106
+ builder.history_events = []
107
+ builder.add_orchestrator_started_event()
108
+ builder.add_execution_started_event(name="TestOrchestrator", version="1.0")
109
+ context = DurableOrchestrationContext.from_json(builder.to_json_string())
110
+ assert context.version == "1.0"