[Storage Queue] Migrating to TypeSpec#45649
Conversation
|
/azp run python - storage - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run python - storage - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
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.pytopyproject.tomland 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. |
| directory: specification/storage/Microsoft.QueueStorage | ||
| commit: <replace with your value> | ||
| repo: <replace with your value> | ||
| additionalDirectories: |
There was a problem hiding this comment.
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).
| # 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") |
There was a problem hiding this comment.
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).
| version = kwargs.pop("version", "2026-06-06") | |
| version = kwargs.pop("version", "2026-04-06") |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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).
| version = kwargs.pop("version", "2026-06-06") | |
| version = kwargs.pop("version", "2026-04-06") |
|
/azp run python - storage - tests |
|
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)) |
There was a problem hiding this comment.
Were we always overriding the sdk_moniker? Because if not - this change could break customers (and our) telemetry.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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...
…ue _shared/models.py Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/azp run python - storage - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
samples failing are also failing on main