René's URL Explorer Experiment


Title: Performance [P3]: Cache Azure managed SDK version lookup by berndverst · Pull Request #203 · microsoft/durabletask-python · GitHub

Open Graph Title: Performance [P3]: Cache Azure managed SDK version lookup by berndverst · Pull Request #203 · microsoft/durabletask-python

X Title: Performance [P3]: Cache Azure managed SDK version lookup by berndverst · Pull Request #203 · microsoft/durabletask-python

Description: Summary Both the sync (DTSDefaultClientInterceptorImpl) and async (DTSAsyncDefaultClientInterceptorImpl) interceptor constructors called importlib.metadata.version('durabletask-azuremanaged') directly. That call walks distribution metadata on disk, so the work was repeated on every interceptor construction — i.e. on every client and worker construction. This change resolves the version once in a module-level functools.lru_cached helper (_get_sdk_version()) and reuses it for every interceptor. Preserved exactly The "unknown" fallback when the version cannot be determined (the helper keeps the original broad except Exception, which still covers importlib.metadata.PackageNotFoundError). The user-agent string format, durabletask-python/{version}, verbatim. The metadata key names and their order: taskhub, x-user-agent, and workerid (sync worker case only). No public API signature changes, no renames, no removed symbols, no changed import paths. The only observable difference is the removed repeat filesystem work. NoteNo changelog entry was added. This is an internal performance change with no user-visible behavior difference, which the repo guidelines say should not be documented in the changelog. Verification Ran against a session-local virtualenv with both packages installed in editable mode. Effectiveness (the actual fix). A probe patched the module-level version symbol and counted calls across three interceptor constructions (sync client, sync worker, async): Variant version() calls Before (uncached) 3 After (cached) 1 Tests. New TestSdkVersionCaching::test_version_resolved_once_across_interceptor_constructions asserts the lookup happens exactly once across three constructions, and pins the full metadata list (keys and order) for all three cases. New TestSdkVersionCaching::test_unknown_fallback_when_version_cannot_be_determined asserts PackageNotFoundError still yields durabletask-python/unknown for both the sync and async interceptors. Both new tests clear the cache in setUp/tearDown so no patched value leaks into other tests. Existing test_worker_includes_workerid_header and test_user_agent_metadata_passed_in_request still pass unchanged. Suites. Provider unit tests (test_durabletask_grpc_interceptor.py, test_sandboxes_extension.py, test_azuremanaged_grpc_resiliency.py): 47 passed. Core unit tests (tests/durabletask, excluding *_e2e.py): 681 passed, 7 skipped. flake8 clean on both changed files. pyright (repo pyrightconfig.json, strict): 441 errors before and after, none in the changed file — unchanged from baseline. *_e2e.py suites and test_dts_activity_sequence.py need a live Durable Task Scheduler endpoint and were not run. Fixes #195

Open Graph Description: Summary Both the sync (DTSDefaultClientInterceptorImpl) and async (DTSAsyncDefaultClientInterceptorImpl) interceptor constructors called importlib.metadata.version('durabletask-azuremanaged'...

X Description: Summary Both the sync (DTSDefaultClientInterceptorImpl) and async (DTSAsyncDefaultClientInterceptorImpl) interceptor constructors called importlib.metadata.version('durabletask-azuremanaged...

Opengraph URL: https://github.com/microsoft/durabletask-python/pull/203

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:d75244d2-095a-0052-8622-6be0d3599194
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD932:398661:21DAE3:2E30FE:6AFE4BD3
html-safe-nonce84e42bb56ee7a3d21bab2c8e3057149c11bca78b424e238f4b23efb504b5716b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTMyOjM5ODY2MToyMURBRTM6MkUzMEZFOjZBRkU0QkQzIiwidmlzaXRvcl9pZCI6IjgxOTc5NjczMDU2MDczNjc2MzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac678bce17de130e3349024daca884e6f4bfa0bff3774501299cda70381fc47cf7
hovercard-subject-tagpull_request:4139788210
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/microsoft/durabletask-python/pull/203/files
twitter:imagehttps://avatars.githubusercontent.com/u/4535280?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/4535280?s=400&v=4
og:image:altSummary Both the sync (DTSDefaultClientInterceptorImpl) and async (DTSAsyncDefaultClientInterceptorImpl) interceptor constructors called importlib.metadata.version('durabletask-azuremanaged'...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None894d3c8b932306ed8425e8dcbe0c1089667e487c5fe7b8a05d17e7b685207429
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/microsoft/durabletask-python git https://github.com/microsoft/durabletask-python.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id627664515
octolytics-dimension-repository_nwomicrosoft/durabletask-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id627664515
octolytics-dimension-repository_network_root_nwomicrosoft/durabletask-python
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release44570ad53e12be09be8000af683c29166c4007cb
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/microsoft/durabletask-python/pull/203/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fdurabletask-python%2Fpull%2F203%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fdurabletask-python%2Fpull%2F203%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=microsoft%2Fdurabletask-python
Reloadhttps://github.com/microsoft/durabletask-python/pull/203/files
Reloadhttps://github.com/microsoft/durabletask-python/pull/203/files
Reloadhttps://github.com/microsoft/durabletask-python/pull/203/files
microsofthttps://github.com/microsoft
durabletask-pythonhttps://github.com/microsoft/durabletask-python
Codehttps://github.com/microsoft/durabletask-python
Issues15 (15)https://github.com/microsoft/durabletask-python/issues
Pull requests12 (12)https://github.com/microsoft/durabletask-python/pulls
Actionshttps://github.com/microsoft/durabletask-python/actions
Projectshttps://github.com/microsoft/durabletask-python/projects
Security and qualityhttps://github.com/microsoft/durabletask-python/security
Insightshttps://github.com/microsoft/durabletask-python/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fmicrosoft%2Fdurabletask-python%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fmicrosoft%2Fdurabletask-python%2Fissues%2Fnew%2Fchoose
Bernd Verst (berndverst)https://github.com/berndverst
mainhttps://github.com/microsoft/durabletask-python/tree/main
berndverst-cache-azure-managed-sdk-versionhttps://github.com/microsoft/durabletask-python/tree/berndverst-cache-azure-managed-sdk-version
Conversation 5 https://github.com/microsoft/durabletask-python/pull/203
Commits 4 https://github.com/microsoft/durabletask-python/pull/203/commits
Checks 24 https://github.com/microsoft/durabletask-python/pull/203/checks
Files changed https://github.com/microsoft/durabletask-python/pull/203/files
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/203/files
Performance [P3]: Cache Azure managed SDK version lookup https://github.com/microsoft/durabletask-python/pull/203/files#top
Show all changes 4 commits https://github.com/microsoft/durabletask-python/pull/203/files
2ad2085 Performance: cache Azure managed SDK version lookup Jul 27, 2026 https://github.com/microsoft/durabletask-python/pull/203/commits/2ad20857805540bebb1250218f4bd621b9cdfc07
0a852f0 Merge origin/main into berndverst-cache-azure-managed-sdk-version Jul 27, 2026 https://github.com/microsoft/durabletask-python/pull/203/commits/0a852f077387a1cb439ce892d8579273572428ea
814e60a Merge origin/main into berndverst-cache-azure-managed-sdk-version Jul 27, 2026 https://github.com/microsoft/durabletask-python/pull/203/commits/814e60a28c596588c23f5456012c93889b09f7d9
2b4264d Merge remote-tracking branch 'origin/main' into berndverst-cache-azur… Jul 27, 2026 https://github.com/microsoft/durabletask-python/pull/203/commits/2b4264dc2313d846a78e364e449d080abf7fb83e
Clear filters https://github.com/microsoft/durabletask-python/pull/203/files
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/203/files
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/203/files
durabletask_grpc_interceptor.py https://github.com/microsoft/durabletask-python/pull/203/files#diff-cdbdb923774470dc042042ef33d6cbe733c2398fd7d24c7c44dae54a8326ebbc
test_durabletask_grpc_interceptor.py https://github.com/microsoft/durabletask-python/pull/203/files#diff-8ca4e0ba6893c08e8500e9262abe4a4c6c927c0fdebb06acf2d3a7e374ce1e2a
durabletask-azuremanaged/durabletask/azuremanaged/internal/durabletask_grpc_interceptor.pyhttps://github.com/microsoft/durabletask-python/pull/203/files#diff-cdbdb923774470dc042042ef33d6cbe733c2398fd7d24c7c44dae54a8326ebbc
View file https://github.com/microsoft/durabletask-python/blob/2b4264dc2313d846a78e364e449d080abf7fb83e/durabletask-azuremanaged/durabletask/azuremanaged/internal/durabletask_grpc_interceptor.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/durabletask-python/pull/203/{{ revealButtonHref }}
https://github.com/microsoft/durabletask-python/pull/203/files#diff-cdbdb923774470dc042042ef33d6cbe733c2398fd7d24c7c44dae54a8326ebbc
https://github.com/microsoft/durabletask-python/pull/203/files#diff-cdbdb923774470dc042042ef33d6cbe733c2398fd7d24c7c44dae54a8326ebbc
https://github.com/microsoft/durabletask-python/pull/203/files#diff-cdbdb923774470dc042042ef33d6cbe733c2398fd7d24c7c44dae54a8326ebbc
https://github.com/microsoft/durabletask-python/pull/203/files#diff-cdbdb923774470dc042042ef33d6cbe733c2398fd7d24c7c44dae54a8326ebbc
https://github.com/microsoft/durabletask-python/pull/203/files#diff-cdbdb923774470dc042042ef33d6cbe733c2398fd7d24c7c44dae54a8326ebbc
tests/durabletask-azuremanaged/test_durabletask_grpc_interceptor.pyhttps://github.com/microsoft/durabletask-python/pull/203/files#diff-8ca4e0ba6893c08e8500e9262abe4a4c6c927c0fdebb06acf2d3a7e374ce1e2a
View file https://github.com/microsoft/durabletask-python/blob/2b4264dc2313d846a78e364e449d080abf7fb83e/tests/durabletask-azuremanaged/test_durabletask_grpc_interceptor.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/durabletask-python/pull/203/{{ revealButtonHref }}
https://github.com/microsoft/durabletask-python/pull/203/files#diff-8ca4e0ba6893c08e8500e9262abe4a4c6c927c0fdebb06acf2d3a7e374ce1e2a
https://github.com/microsoft/durabletask-python/pull/203/files#diff-8ca4e0ba6893c08e8500e9262abe4a4c6c927c0fdebb06acf2d3a7e374ce1e2a
https://github.com/microsoft/durabletask-python/pull/203/files#diff-8ca4e0ba6893c08e8500e9262abe4a4c6c927c0fdebb06acf2d3a7e374ce1e2a
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/203/files
https://github.com/microsoft/durabletask-python/pull/203/files#diff-8ca4e0ba6893c08e8500e9262abe4a4c6c927c0fdebb06acf2d3a7e374ce1e2a
Please reload this pagehttps://github.com/microsoft/durabletask-python/pull/203/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.