in azure/durable_functions/__init__.py [0:0]
def validate_extension_bundles():
"""Raise a warning if host.json contains bundle-range V1.
Effects
------
Warning: Warning prompting the user to update to bundles V2
"""
# No need to validate if we're running tests
if "pytest" in sys.modules:
return
host_path = "host.json"
bundles_key = "extensionBundle"
version_key = "version"
host_file = Path(host_path)
if not host_file.exists():
# If it doesn't exist, we ignore it
return
with open(host_path) as f:
host_settings = json.loads(f.read())
try:
version_range = host_settings[bundles_key][version_key]
except Exception:
# If bundle info is not available, we ignore it.
# For example: it's possible the user is using a manual extension install
return
# We do a best-effort attempt to detect bundles V1
# This is the string hard-coded into the bundles V1 template in VSCode
if version_range == "[1.*, 2.0.0)":
message = "Your application is currently configured to use Extension Bundles V1."\
" Durable Functions for Python works best with Bundles V2,"\
" which provides additional features like Durable Entities, better performance,"\
" and is actively being developed."\
" Please update to Bundles V2 in your `host.json`."\
" You can set extensionBundles version to be: [2.*, 3.0.0)"
warnings.warn(message)