From 1f479b4949b27ace8a56b127b216305c0e754874 Mon Sep 17 00:00:00 2001 From: German Robayo Paz Date: Tue, 7 Oct 2025 18:27:43 +0000 Subject: [PATCH 1/3] fix: use storagev2 BlobClient --- azdev/operations/extensions/__init__.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/azdev/operations/extensions/__init__.py b/azdev/operations/extensions/__init__.py index 55097253c..0bbfb01cb 100644 --- a/azdev/operations/extensions/__init__.py +++ b/azdev/operations/extensions/__init__.py @@ -308,7 +308,7 @@ def build_extensions(extensions, dist_dir='dist'): def publish_extensions(extensions, storage_account, storage_account_key, storage_container, dist_dir='dist', update_index=False, yes=False): - from azure.multiapi.storage.v2018_11_09.blob import BlockBlobService + from azure.multiapi.storagev2.blob.v2022_11_02 import BlobClient heading('Publish Extensions') @@ -329,8 +329,9 @@ def publish_extensions(extensions, storage_account, storage_account_key, storage for whl_path in whl_files: whl_file = os.path.split(whl_path)[-1] - client = BlockBlobService(account_name=storage_account, account_key=storage_account_key) - exists = client.exists(container_name=storage_container, blob_name=whl_file) + account_url = f"https://{storage_account}.blob.core.windows.net" + client = BlobClient(account_url=account_url, container_name=storage_container, credential=storage_account_key, blob_name=whl_file) + exists = client.exists() # check if extension already exists unless user opted not to if not yes: @@ -341,12 +342,10 @@ def publish_extensions(extensions, storage_account, storage_account_key, storage logger.warning("Skipping '%s'...", whl_file) continue # upload the WHL file - client.create_blob_from_path(container_name=storage_container, blob_name=whl_file, - file_path=os.path.abspath(whl_path)) - url = client.make_blob_url(container_name=storage_container, blob_name=whl_file) - - logger.info(url) - uploaded_urls.append(url) + with open(os.path.abspath(whl_path), 'rb') as f: + client.upload_blob(data=f) + logger.info(client.url) + uploaded_urls.append(client.url) if update_index: subheading('Updating Index') From 114f7a762af8036dbc945997018b6810a71bf1f3 Mon Sep 17 00:00:00 2001 From: German Robayo Paz Date: Tue, 7 Oct 2025 18:30:33 +0000 Subject: [PATCH 2/3] fix pylint --- azdev/operations/extensions/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/azdev/operations/extensions/__init__.py b/azdev/operations/extensions/__init__.py index 0bbfb01cb..d40e62ab4 100644 --- a/azdev/operations/extensions/__init__.py +++ b/azdev/operations/extensions/__init__.py @@ -330,7 +330,10 @@ def publish_extensions(extensions, storage_account, storage_account_key, storage whl_file = os.path.split(whl_path)[-1] account_url = f"https://{storage_account}.blob.core.windows.net" - client = BlobClient(account_url=account_url, container_name=storage_container, credential=storage_account_key, blob_name=whl_file) + client = BlobClient(account_url=account_url, + container_name=storage_container, + credential=storage_account_key, + blob_name=whl_file) exists = client.exists() # check if extension already exists unless user opted not to From b4c25bd7fe7a62ef0af8ca3f50f0a7ba2a64d59b Mon Sep 17 00:00:00 2001 From: German Robayo Paz Date: Tue, 7 Oct 2025 18:32:31 +0000 Subject: [PATCH 3/3] update version and add history entry --- HISTORY.rst | 4 ++++ azdev/__init__.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 6fa923964..2762d060c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -2,6 +2,10 @@ Release History =============== +0.2.6 +++++++ +* Use storagev2 utilities to fix `az extension publish` (#529) + 0.2.5 ++++++ * Add support for Python 3.11, 3.12, and 3.13 diff --git a/azdev/__init__.py b/azdev/__init__.py index 186ca1f63..92f475a79 100644 --- a/azdev/__init__.py +++ b/azdev/__init__.py @@ -4,4 +4,4 @@ # license information. # ----------------------------------------------------------------------------- -__VERSION__ = '0.2.5' +__VERSION__ = '0.2.6'