This release is a pre-release and may not be stable for production use.
Azure Functions Durable (Python) — 2.x
azure-functions-durable is the Python SDK provider for
Durable Azure Functions,
built on top of the durabletask SDK.
[!NOTE] 2.x is a ground-up rewrite of the Durable Functions Python SDK on top of the
durabletaskruntime. It is currently a preview (beta) release; APIs may change before the stable 2.0.0.
Requirements
- Python 3.13+
- The decorator-based Azure Functions programming model (
DFApp/Blueprint)
Installation
pip install azure-functions-durable
Overview
Author orchestrations, activities, and entities as Azure Functions and let the
Durable Task runtime handle scheduling, checkpointing, and replay. Both
durabletask-native two-argument functions (def orchestrator(ctx, input)) and
v1-style single-argument functions (def orchestrator(context)) are supported,
along with class-based entities and a compatibility layer over the v1 API.
Key capabilities include durable orchestrations and sub-orchestrations, durable
timers, external events, durable entities, retries, versioning, durable HTTP
calls (context.call_http(...)), recurring scheduled tasks, and history export.
Unit testing entities
Use execute_entity() to run one entity operation in-process without a
Functions host or Durable Task backend. It supports v1-style entity functions,
durabletask-native entity functions, and DurableEntity subclasses:
from azure.durable_functions.testing import execute_entity
from durabletask.entities import DurableEntity
class Counter(DurableEntity):
def add(self, amount: int) -> int:
value = self.get_state(int, 0) + amount
self.set_state(value)
return value
outcome = execute_entity(Counter, "add", input=2, state=3)
assert outcome.get_result() == 5
assert outcome.get_state() == 5
assert outcome.actions == ()
For an entity_trigger-decorated function, pass the exposed entity function:
import azure.durable_functions as df
from azure.durable_functions.testing import execute_entity
app = df.DFApp()
@app.entity_trigger(context_name="context")
def counter(context: df.DurableEntityContext) -> None:
value = context.get_state(initializer=lambda: 0)
value += context.get_input()
context.set_state(value)
context.set_result(value)
entity_function = counter.build().get_user_function().entity_function
outcome = execute_entity(entity_function, "add", input=2, state=3)
assert outcome.get_result() == 5
assert outcome.get_state() == 5
The returned EntityTestResult provides get_result() and get_state()
methods plus typed signal or orchestration-start actions scheduled by the
operation. Pass expected_type when reconstructing a custom payload:
assert outcome.get_state(expected_type=CounterState) == CounterState(value=5)
Links
- 2.x samples
- Migration guide from 1.x
- Changelog
- Durable Functions documentation
durabletaskon PyPI- Azure Functions Durable 1.x source
- Azure Functions Python library
- Azure Functions Python worker
- Repository
License
Licensed under the MIT License.
Release files for azure-functions-durable 2.0.0b3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| azure_functions_durable-2.0.0b3.tar.gz | 54.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| azure_functions_durable-2.0.0b3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 124.1 kB
Release files / azure_functions_durable-2.0.0b3.tar.gz
| Download URL | azure_functions_durable-2.0.0b3.tar.gz |
|---|---|
| Size | 54.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de593a4d5dc5e4a8f68df1a685f2ce681bf6e99a7dc12eb8ebaf35a2abdfa35e
|
|
BLAKE2b-256 checksum How to use checksums |
8e928c564ae4eb059ab440e299e4ef2b55bfb7326e1af8b8a67a4f23c1401d9c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
RestSharp/106.13.0.0
|
Release files / azure_functions_durable-2.0.0b3-py3-none-any.whl
| Download URL | azure_functions_durable-2.0.0b3-py3-none-any.whl |
|---|---|
| Size | 69.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8a0ffa6bbfdfab2f42cc7cd23a2dbea5ea951cc9dccd1bd39e2b1d51ef89a72f
|
|
BLAKE2b-256 checksum How to use checksums |
4d8795d41552af9e1aef733d1eb0ca304300f09e1fa9148f5a2be0709f22e020
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
RestSharp/106.13.0.0
|