Add version property to DurableOrchestrationContext class#557
Merged
Conversation
849dbe7 to
86326ea
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a version property on the DurableOrchestrationContext so orchestrator functions can detect their configured version, updates tests to cover this behavior, and adds a sample app showing how to use it.
- Extracts the first
ExecutionStartedevent’s version and exposes it viacontext.version. - Adds unit tests to verify version detection and fallback to
None. - Provides a sample Function app and configuration demonstrating versioned orchestrations.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/models/test_DurableOrchestrationContext.py | Added tests for extracting version from history events. |
| samples-v2/orchestration_versioning/requirements.txt | Added dependencies for the versioning sample. |
| samples-v2/orchestration_versioning/host.json | Configured "defaultVersion" under durableTask. |
| samples-v2/orchestration_versioning/function_app.py | Demonstrated branching logic on context.version. |
| azure/durable_functions/models/DurableOrchestrationContext.py | Implemented _version field, version property, and extraction. |
Comments suppressed due to low confidence (1)
samples-v2/orchestration_versioning/function_app.py:5
- [nitpick] Variable
myAppuses camelCase, which deviates from PEP8 snake_case conventions. Consider renaming tomy_apporappfor consistency.
myApp = df.DFApp(http_auth_level=func.AuthLevel.ANONYMOUS)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
cgillum
requested changes
Jun 13, 2025
nytian
reviewed
Jun 13, 2025
nytian
approved these changes
Jun 20, 2025
andystaples
approved these changes
Jun 25, 2025
cgillum
approved these changes
Jun 25, 2025
greenie-msft
pushed a commit
to greenie-msft/azure-functions-durable-python
that referenced
this pull request
Sep 25, 2025
Add version property to DurableOrchestrationContext class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add 'version' property to the
contextobject passed to orchestrator functions.As a result, Python Functions users will be able to specify a version in host.json:
{ "extensions": { "durableTask": { "defaultVersion": "2.0" } } }and check the orchestration version in their orchestrator functions in order to keep them backward compatible, for example:
Note: Microsoft.Azure.WebJobs.Extensions.DurableTask 3.1.0+ is required for this to work properly.