Skip to content

Commit 1891d94

Browse files
committed
Compat layer V1
1 parent a7bdd01 commit 1891d94

14 files changed

Lines changed: 1478 additions & 13 deletions

azure-functions-durable/CHANGELOG.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,58 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
### Added
11+
12+
- Backwards-compatible, deprecated aliases on `DurableFunctionsClient` for the
13+
v1 `DurableOrchestrationClient` method names: `start_new`, `get_status`,
14+
`get_status_all`, `get_status_by`, `raise_event`, `terminate`,
15+
`purge_instance_history`, `purge_instance_history_by`, `suspend`, `resume`,
16+
`restart`, `read_entity_state`, `get_client_response_links`, and
17+
`wait_for_completion_or_create_check_status_response`. Each delegates to the
18+
corresponding durabletask method and emits a `DeprecationWarning`; new code
19+
should use the durabletask names (e.g. `schedule_new_orchestration`,
20+
`get_orchestration_state`).
21+
- `DurableFunctionsClient.signal_entity` now also accepts the v1
22+
`operation_input` keyword (alias for `input`); `task_hub_name` and
23+
`connection_name` are accepted for compatibility and ignored.
24+
- `DurableFunctionsClient.rewind` is present as a deprecated stub that raises
25+
`NotImplementedError`, pending a durabletask rewind implementation.
26+
- Deprecated v1 compatibility aliases are now exported from
27+
`azure.durable_functions`: `DurableOrchestrationClient` (alias for
28+
`DurableFunctionsClient`), `DurableOrchestrationContext`, `DurableEntityContext`,
29+
`EntityId`, `ManagedIdentityTokenSource`, `TokenSource`, `Entity`, and
30+
`OrchestrationRuntimeStatus`.
31+
- v1-compatible return-type wrappers `DurableOrchestrationStatus`,
32+
`PurgeHistoryResult`, and `EntityStateResponse` (exported from
33+
`azure.durable_functions`). The deprecated client methods now return these:
34+
`get_status`/`get_status_all`/`get_status_by` return
35+
`DurableOrchestrationStatus` (wrapping durabletask `OrchestrationState`, with
36+
v1 attributes like `runtime_status`, `output`, `input_`, `custom_status`, and
37+
a falsy value for missing instances); `purge_instance_history`/`_by` return
38+
`PurgeHistoryResult` (with `instances_deleted`); and `read_entity_state`
39+
returns `EntityStateResponse` (with `entity_exists`/`entity_state`).
40+
- `DurableOrchestrationContext.call_http` is present as a stub that raises
41+
`NotImplementedError`, documenting the durable-HTTP gap. `TokenSource` /
42+
`ManagedIdentityTokenSource` remain constructible but only apply to
43+
`call_http`, which is not yet supported.
44+
- `RetryOptions`, a deprecated shim that maps the v1 millisecond-based
45+
constructor onto durabletask `RetryPolicy` (which uses `timedelta`).
46+
`RetryPolicy` is now also exported from `azure.durable_functions`.
47+
1048
### Changed
1149

1250
- `DurableFunctionsClient` is now an async client. Its orchestration and entity
1351
management methods (e.g. `schedule_new_orchestration`, `get_orchestration_state`,
1452
`wait_for_orchestration_completion`) are now coroutines and must be awaited.
1553
This aligns the client with the async API surface of the V1
1654
`DurableOrchestrationClient`.
55+
- `create_http_management_payload` now accepts either the durabletask
56+
`(request, instance_id)` signature or the v1 `(instance_id)` signature for
57+
backwards compatibility.
58+
- `HttpManagementPayload` now supports mapping-style access
59+
(`payload["statusQueryGetUri"]`, iteration, `in`, `keys()`/`items()`/`values()`)
60+
so v1 code that treated the payload as a `dict` keeps working.
61+
1762

1863
## v0.1.0
1964

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,49 @@
11
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT License.
33

4+
# This module intentionally re-exports deprecated v1 compatibility aliases.
5+
# pyright: reportDeprecated=false
6+
7+
from durabletask.task import RetryPolicy
8+
49
from .decorators.durable_app import Blueprint, DFApp
510
from .client import DurableFunctionsClient
611
from .orchestrator import Orchestrator
12+
from .retry_options import RetryOptions
13+
from .orchestration_runtime_status import OrchestrationRuntimeStatus
14+
from .durable_orchestration_status import DurableOrchestrationStatus
15+
from .purge_history_result import PurgeHistoryResult
16+
from .entity_state_response import EntityStateResponse
17+
from .entity_id import EntityId
18+
from .token_source import ManagedIdentityTokenSource, TokenSource
19+
from .compat_aliases import (
20+
DurableEntityContext,
21+
DurableOrchestrationClient,
22+
DurableOrchestrationContext,
23+
Entity,
24+
)
725

826
# IMPORTANT: DO NOT REMOVE. `azure-functions` relies on the presence and value of this variable
927
# for version detection
1028
version = "2.x"
1129

12-
__all__ = ["Blueprint", "DFApp", "DurableFunctionsClient", "Orchestrator", "version"]
30+
__all__ = [
31+
"Blueprint",
32+
"DFApp",
33+
"DurableEntityContext",
34+
"DurableFunctionsClient",
35+
"DurableOrchestrationClient",
36+
"DurableOrchestrationContext",
37+
"DurableOrchestrationStatus",
38+
"Entity",
39+
"EntityId",
40+
"EntityStateResponse",
41+
"ManagedIdentityTokenSource",
42+
"Orchestrator",
43+
"OrchestrationRuntimeStatus",
44+
"PurgeHistoryResult",
45+
"RetryOptions",
46+
"RetryPolicy",
47+
"TokenSource",
48+
"version",
49+
]

0 commit comments

Comments
 (0)