Skip to content

[Storage Queue] Migrating to TypeSpec#45649

Open
l0lawrence wants to merge 50 commits intoAzure:mainfrom
l0lawrence:storagequeue
Open

[Storage Queue] Migrating to TypeSpec#45649
l0lawrence wants to merge 50 commits intoAzure:mainfrom
l0lawrence:storagequeue

Conversation

@l0lawrence
Copy link
Copy Markdown
Member

@l0lawrence l0lawrence commented Mar 11, 2026

samples failing are also failing on main

@github-actions github-actions Bot added the Storage Storage Service (Queues, Blobs, Files) label Mar 11, 2026
@l0lawrence
Copy link
Copy Markdown
Member Author

/azp run python - storage - tests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@l0lawrence
Copy link
Copy Markdown
Member Author

/azp run python - storage - tests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@l0lawrence l0lawrence changed the title [dnm] storage queue [Storage Queue] Migrating to TypeSpec Apr 3, 2026
Comment thread sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_patch.py Outdated
@l0lawrence l0lawrence marked this pull request as ready for review April 6, 2026 20:09
@l0lawrence l0lawrence requested a review from annatisch as a code owner April 6, 2026 20:09
Copilot AI review requested due to automatic review settings April 6, 2026 20:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates azure-storage-queue to TypeSpec-generated code (dpcodegen), replacing the legacy AutoRest generated layer and updating the handwritten clients/tests/packaging to work with the new generated surface.

Changes:

  • Switch packaging from setup.py to pyproject.toml and add TypeSpec generation metadata files.
  • Update sync/async Queue clients and paging/model handling to use the new generated QueuesClient + model shapes (e.g., items_property).
  • Adjust test proxy sanitization/matching configuration and lint suppressions for large test/client files.

Reviewed changes

Copilot reviewed 50 out of 50 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
sdk/storage/azure-storage-queue/tsp-location.yaml Adds TypeSpec spec location config for queue storage.
sdk/storage/azure-storage-queue/tests/test_queue.py Adds pylint suppression for file length.
sdk/storage/azure-storage-queue/tests/test_queue_async.py Adds pylint suppression for file length.
sdk/storage/azure-storage-queue/tests/conftest.py Updates proxy sanitizers and default matcher behavior.
sdk/storage/azure-storage-queue/setup.py Removes legacy setuptools setup.py packaging.
sdk/storage/azure-storage-queue/pyproject.toml Adds PEP 621 packaging configuration.
sdk/storage/azure-storage-queue/MANIFEST.in Adjusts sdist included files.
sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_service_client_async.py Migrates async service client to new generated client/ops.
sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_client_async.py Migrates async queue client to new generated client/ops and model shapes.
sdk/storage/azure-storage-queue/azure/storage/queue/aio/_models.py Updates async paging extraction for new items_property containers.
sdk/storage/azure-storage-queue/azure/storage/queue/_shared/response_handlers.py Adjusts user delegation key date serialization behavior.
sdk/storage/azure-storage-queue/azure/storage/queue/_queue_service_client.py Migrates sync service client to new generated client/ops.
sdk/storage/azure-storage-queue/azure/storage/queue/_queue_client.py Migrates sync queue client to new generated client/ops and model shapes.
sdk/storage/azure-storage-queue/azure/storage/queue/_models.py Updates message decoding and sync paging extraction for items_property.
sdk/storage/azure-storage-queue/azure/storage/queue/_message_encoding.py Updates decode policy to work with new generated model descriptors.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_service_operations.py Removes old AutoRest-generated service ops.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_queue_operations.py Removes old AutoRest-generated queue ops.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_messages_operations.py Removes old AutoRest-generated messages ops.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_message_id_operations.py Removes old AutoRest-generated message-id ops.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_patch.py Modernizes typing header/__all__ typing.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/init.py Points operations exports to new consolidated _operations module.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_models_py3.py Removes old AutoRest model file.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_enums.py Updates generated enums to dpcodegen names and docstrings.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/init.py Updates exported generated model set to dpcodegen equivalents.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_patch.py Adds runtime patches for dpcodegen model behavior/descriptors.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/apiview-properties.json Adds generated APIView cross-language mapping file.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_service_operations.py Removes old AutoRest async service ops.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_queue_operations.py Removes old AutoRest async queue ops.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_messages_operations.py Removes old AutoRest async messages ops.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_message_id_operations.py Removes old AutoRest async message-id ops.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_patch.py Modernizes typing header/__all__ typing for async ops patch.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/init.py Points async operations exports to new consolidated _operations module.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_patch.py Adds async patched QueuesClient to support pre-built pipeline instantiation.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_configuration.py Updates async generated configuration to dpcodegen + bearer auth policy wiring.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_client.py Updates async generated client to dpcodegen naming/signature and send_request.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/init.py Updates async generated package exports to QueuesClient.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_version.py Adds dpcodegen-generated version constant for generated layer.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_utils/serialization.py Applies formatting changes and minor logging formatting updates.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_utils/init.py Updates generator attribution header.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_patch.py Adds patched QueuesClient to support pre-built pipeline instantiation.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_metadata.json Adds dpcodegen API version metadata.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_configuration.py Updates generated configuration to dpcodegen + bearer auth policy wiring.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_client.py Updates generated client to dpcodegen naming/signature and send_request.
sdk/storage/azure-storage-queue/azure/storage/queue/_generated/init.py Updates generated package exports to QueuesClient and sets __version__.
sdk/storage/azure-storage-queue/apiview-properties.json Adds package-level APIView cross-language mapping file.
sdk/storage/azure-storage-queue/_metadata.json Adds package-level dpcodegen API version metadata.

Comment on lines +1 to +4
directory: specification/storage/Microsoft.QueueStorage
commit: <replace with your value>
repo: <replace with your value>
additionalDirectories:
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tsp-location.yaml still contains placeholder values for commit and repo ("") and an empty additionalDirectories entry. This will break or mislead TypeSpec generation tooling; please replace these with the actual spec repo URL + commit SHA (and set additionalDirectories to a valid YAML list, e.g. [], if none are needed).

Copilot uses AI. Check for mistakes.
Comment thread sdk/storage/azure-storage-queue/pyproject.toml
Comment thread sdk/storage/azure-storage-queue/pyproject.toml
Comment thread sdk/storage/azure-storage-queue/MANIFEST.in Outdated
# When a pre-built pipeline is provided, skip the generated credential/policy setup.
_endpoint = "{url}"
self._config = QueuesClientConfiguration.__new__(QueuesClientConfiguration)
version = kwargs.pop("version", "2026-06-06")
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pipeline-based fallback defaults version to "2026-06-06", which doesn’t match the API version declared elsewhere in the generated code/metadata (2026-04-06). If callers instantiate QueuesClient(..., pipeline=...) without explicitly passing version, requests may be sent with an invalid/unsupported service version. Please default to the generated client’s actual API version (or derive it from _metadata.json).

Suggested change
version = kwargs.pop("version", "2026-06-06")
version = kwargs.pop("version", "2026-04-06")

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair -- need to look into gen code versions

# When a pre-built pipeline is provided, skip the generated credential/policy setup.
_endpoint = "{url}"
self._config = QueuesClientConfiguration.__new__(QueuesClientConfiguration)
version = kwargs.pop("version", "2026-06-06")
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The async pipeline-based fallback defaults version to "2026-06-06", which doesn’t match the API version declared elsewhere in the generated code/metadata (2026-04-06). If callers instantiate QueuesClient(..., pipeline=...) without explicitly passing version, requests may be sent with an invalid/unsupported service version. Please default to the generated client’s actual API version (or derive it from _metadata.json).

Suggested change
version = kwargs.pop("version", "2026-06-06")
version = kwargs.pop("version", "2026-04-06")

Copilot uses AI. Check for mistakes.
@l0lawrence
Copy link
Copy Markdown
Member Author

/azp run python - storage - tests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

self.version = version
kwargs.setdefault("sdk_moniker", "azurequeuestorage/{}".format(VERSION))
self.credential_scopes = kwargs.pop("credential_scopes", ["https://storage.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "storage-queue/{}".format(VERSION))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were we always overriding the sdk_moniker? Because if not - this change could break customers (and our) telemetry.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we do here:

if _pipeline is not None:
# When a pre-built pipeline is provided, skip the generated credential/policy setup.
_endpoint = "{url}"
self._config = QueuesClientConfiguration.__new__(QueuesClientConfiguration)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems..... awkward?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming all changes to the _shared directory have been duplicated across the other storage sdks?

from .._utils.model_base import Model as _Model, rest_field, _MyMutableMapping, _RestField


def _patched_getattr(self, name):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we had to do this for blobs because of the datalake dependency - though I'm not sure it's the best approach for queues/files?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I can try just editing the _models.py file for this and files


# The original ``Model.__new__`` does ``rf._module = cls.__module__`` which
# lets an external subclass (e.g. from azure-storage-file-datalake) overwrite
# ``_module`` on the *shared* descriptor, corrupting type resolution for
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also feels like it's specific to the Blobs/Datalake issue, and is added complexity that's not needed for queues?

object.__setattr__(self, name, value)


def _patched_getattribute(self, name):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is patching getattribute going to assist with the missing methods on the baseclass?
It doesn't appear to be specifically matching for the lost method names....
Or has the decision been made to take a breaking change there? That seems risky for Storage...

@l0lawrence
Copy link
Copy Markdown
Member Author

/azp run python - storage - tests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Storage Storage Service (Queues, Blobs, Files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants