diff --git a/.chronus/changes/auto-microsoft-clear-output-dir-python-2025-9-11-13-42-52.md b/.chronus/changes/auto-microsoft-clear-output-dir-python-2025-9-11-13-42-52.md new file mode 100644 index 00000000000..541890bf327 --- /dev/null +++ b/.chronus/changes/auto-microsoft-clear-output-dir-python-2025-9-11-13-42-52.md @@ -0,0 +1,8 @@ +--- +changeKind: feature +packages: + - "@autorest/python" + - "@azure-tools/typespec-python" +--- + +Add logic to clear output folder \ No newline at end of file diff --git a/.chronus/changes/auto-microsoft-clear-output-dir-python-2025-9-30-2-33-3.md b/.chronus/changes/auto-microsoft-clear-output-dir-python-2025-9-30-2-33-3.md new file mode 100644 index 00000000000..3656022b6cf --- /dev/null +++ b/.chronus/changes/auto-microsoft-clear-output-dir-python-2025-9-30-2-33-3.md @@ -0,0 +1,8 @@ +--- +changeKind: internal +packages: + - "@autorest/python" + - "@azure-tools/typespec-python" +--- + +Exclude unnecessary files from pylint checks to improve execution speed \ No newline at end of file diff --git a/packages/autorest.python/package.json b/packages/autorest.python/package.json index 60ee0fa000b..7e2f999bfe9 100644 --- a/packages/autorest.python/package.json +++ b/packages/autorest.python/package.json @@ -29,7 +29,7 @@ }, "homepage": "https://github.com/Azure/autorest.python/blob/main/README.md", "dependencies": { - "@typespec/http-client-python": "~0.19.2", + "@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTUxNTI4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.19.2.tgz", "@autorest/system-requirements": "~1.0.2", "fs-extra": "~11.2.0", "tsx": "~4.19.1" diff --git a/packages/typespec-python/package.json b/packages/typespec-python/package.json index 971294c0953..56c8aa56980 100644 --- a/packages/typespec-python/package.json +++ b/packages/typespec-python/package.json @@ -67,7 +67,7 @@ "js-yaml": "~4.1.0", "semver": "~7.6.2", "tsx": "~4.19.1", - "@typespec/http-client-python": "~0.19.2", + "@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTUxNTI4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.19.2.tgz", "fs-extra": "~11.2.0" }, "devDependencies": { diff --git a/packages/typespec-python/scripts/eng/regenerate.ts b/packages/typespec-python/scripts/eng/regenerate.ts index f13ff810d9a..a9ca87a921e 100644 --- a/packages/typespec-python/scripts/eng/regenerate.ts +++ b/packages/typespec-python/scripts/eng/regenerate.ts @@ -431,11 +431,45 @@ async function runTaskPool(tasks: Array<() => Promise>, poolLimit: number) await Promise.all(workers); } +// create some files before regeneration. After regeneration, these files should be deleted and we will test it +// in test case +async function preprocess(flags: RegenerateFlagsInput): Promise { + if (flags.flavor === "azure") { + const generalParts = [PLUGIN_DIR, "test", "azure", "generated"]; + await promises.writeFile( + join( + ...generalParts, + "authentication-api-key", + "authentication", + "apikey", + "_operations", + "to_be_deleted.py", + ), + "# This file is to be deleted after regeneration", + ); + + const folderParts = [...generalParts, "generation-subdir"]; + await promises.writeFile( + join(...folderParts, "generation", "subdir", "_generated", "to_be_deleted.py"), + "# This file is to be deleted after regeneration", + ); + await promises.writeFile( + join(...folderParts, "generated_tests", "to_be_deleted.py"), + "# This file is to be kept after regeneration", + ); + await promises.writeFile( + join(...folderParts, "generation", "subdir", "to_be_kept.py"), + "# This file is to be kept after regeneration", + ); + } +} + async function regenerate(flags: RegenerateFlagsInput): Promise { if (flags.flavor === undefined) { await regenerate({ ...flags, flavor: "azure" }); await regenerate({ ...flags, flavor: "unbranded" }); } else { + await preprocess(flags); const flagsResolved = { debug: false, flavor: flags.flavor, ...flags }; const subdirectoriesForAzure = await getSubdirectories(AZURE_HTTP_SPECS, flagsResolved); const subdirectoriesForNonAzure = await getSubdirectories(HTTP_SPECS, flagsResolved); diff --git a/packages/typespec-python/test/azure/generated/azure-payload-pageable/specs/azure/payload/pageable/_validation.py b/packages/typespec-python/test/azure/generated/azure-payload-pageable/specs/azure/payload/pageable/_validation.py deleted file mode 100644 index f5af3a4eb8a..00000000000 --- a/packages/typespec-python/test/azure/generated/azure-payload-pageable/specs/azure/payload/pageable/_validation.py +++ /dev/null @@ -1,66 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import functools - - -def api_version_validation(**kwargs): - params_added_on = kwargs.pop("params_added_on", {}) - method_added_on = kwargs.pop("method_added_on", "") - api_versions_list = kwargs.pop("api_versions_list", []) - - def _index_with_default(value: str, default: int = -1) -> int: - """Get the index of value in lst, or return default if not found. - - :param value: The value to search for in the api_versions_list. - :type value: str - :param default: The default value to return if the value is not found. - :type default: int - :return: The index of the value in the list, or the default value if not found. - :rtype: int - """ - try: - return api_versions_list.index(value) - except ValueError: - return default - - def decorator(func): - @functools.wraps(func) - def wrapper(*args, **kwargs): - try: - # this assumes the client has an _api_version attribute - client = args[0] - client_api_version = client._config.api_version # pylint: disable=protected-access - except AttributeError: - return func(*args, **kwargs) - - if _index_with_default(method_added_on) > _index_with_default(client_api_version): - raise ValueError( - f"'{func.__name__}' is not available in API version " - f"{client_api_version}. Pass service API version {method_added_on} or newer to your client." - ) - - unsupported = { - parameter: api_version - for api_version, parameters in params_added_on.items() - for parameter in parameters - if parameter in kwargs and _index_with_default(api_version) > _index_with_default(client_api_version) - } - if unsupported: - raise ValueError( - "".join( - [ - f"'{param}' is not available in API version {client_api_version}. " - f"Use service API version {version} or newer.\n" - for param, version in unsupported.items() - ] - ) - ) - return func(*args, **kwargs) - - return wrapper - - return decorator diff --git a/packages/typespec-python/test/azure/generated/generation-subdir/generation/subdir/to_be_kept.py b/packages/typespec-python/test/azure/generated/generation-subdir/generation/subdir/to_be_kept.py new file mode 100644 index 00000000000..97b93312202 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/generation-subdir/generation/subdir/to_be_kept.py @@ -0,0 +1 @@ +# This file is to be kept after regeneration diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/generated_tests/test_pageable.py b/packages/typespec-python/test/azure/generated/payload-pageable/generated_tests/test_pageable.py deleted file mode 100644 index e70a8bbfe17..00000000000 --- a/packages/typespec-python/test/azure/generated/payload-pageable/generated_tests/test_pageable.py +++ /dev/null @@ -1,22 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils import recorded_by_proxy -from testpreparer import PageableClientTestBase, PageablePreparer - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestPageable(PageableClientTestBase): - @PageablePreparer() - @recorded_by_proxy - def test_list_without_continuation(self, pageable_endpoint): - client = self.create_client(endpoint=pageable_endpoint) - response = client.list_without_continuation() - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/generated_tests/test_pageable_async.py b/packages/typespec-python/test/azure/generated/payload-pageable/generated_tests/test_pageable_async.py deleted file mode 100644 index 10c7503f986..00000000000 --- a/packages/typespec-python/test/azure/generated/payload-pageable/generated_tests/test_pageable_async.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from devtools_testutils.aio import recorded_by_proxy_async -from testpreparer import PageablePreparer -from testpreparer_async import PageableClientTestBaseAsync - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestPageableAsync(PageableClientTestBaseAsync): - @PageablePreparer() - @recorded_by_proxy_async - async def test_list_without_continuation(self, pageable_endpoint): - client = self.create_async_client(endpoint=pageable_endpoint) - response = client.list_without_continuation() - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/__init__.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/__init__.py deleted file mode 100644 index 0c5748aa41b..00000000000 --- a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _PageableClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/_operations.py deleted file mode 100644 index ef60883c676..00000000000 --- a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/_operations.py +++ /dev/null @@ -1,125 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict - -from .. import models as _models1 -from .._configuration import PageableClientConfiguration -from .._utils.model_base import _deserialize -from .._utils.serialization import Serializer -from .._utils.utils import ClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_pageable_list_without_continuation_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = "/payload/pageable/simple" - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -class _PageableClientOperationsMixin( - ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], PageableClientConfiguration] -): - - @distributed_trace - def list_without_continuation(self, **kwargs: Any) -> ItemPaged["_models1.Pet"]: - """list_without_continuation. - - :return: An iterator like instance of Pet - :rtype: ~azure.core.paging.ItemPaged[~payload.pageable.models.Pet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[list[_models1.Pet]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_pageable_list_without_continuation_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - _request = HttpRequest("GET", next_link) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(list[_models1.Pet], deserialized.get("pets", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_utils/utils.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_utils/utils.py deleted file mode 100644 index 35c9c836f85..00000000000 --- a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_utils/utils.py +++ /dev/null @@ -1,25 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from abc import ABC -from typing import Generic, TYPE_CHECKING, TypeVar - -if TYPE_CHECKING: - from .serialization import Deserializer, Serializer - - -TClient = TypeVar("TClient") -TConfig = TypeVar("TConfig") - - -class ClientMixinABC(ABC, Generic[TClient, TConfig]): - """DO NOT use this class. It is for internal typing use only.""" - - _client: TClient - _config: TConfig - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/__init__.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/__init__.py deleted file mode 100644 index 0c5748aa41b..00000000000 --- a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import _PageableClientOperationsMixin # type: ignore # pylint: disable=unused-import - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py deleted file mode 100644 index 10a4fe6aab1..00000000000 --- a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py +++ /dev/null @@ -1,108 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace - -from ... import models as _models2 -from ..._operations._operations import build_pageable_list_without_continuation_request -from ..._utils.model_base import _deserialize -from ..._utils.utils import ClientMixinABC -from .._configuration import PageableClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class _PageableClientOperationsMixin( - ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], PageableClientConfiguration] -): - - @distributed_trace - def list_without_continuation(self, **kwargs: Any) -> AsyncItemPaged["_models2.Pet"]: - """list_without_continuation. - - :return: An iterator like instance of Pet - :rtype: ~azure.core.async_paging.AsyncItemPaged[~payload.pageable.models.Pet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[list[_models2.Pet]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_pageable_list_without_continuation_request( - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - else: - _request = HttpRequest("GET", next_link) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.endpoint", self._config.endpoint, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(list[_models2.Pet], deserialized.get("pets", [])) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/packages/typespec-python/test/azure/mock_api_tests/test_clear_output_folder.py b/packages/typespec-python/test/azure/mock_api_tests/test_clear_output_folder.py new file mode 100644 index 00000000000..3489be72e16 --- /dev/null +++ b/packages/typespec-python/test/azure/mock_api_tests/test_clear_output_folder.py @@ -0,0 +1,22 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from pathlib import Path + +GENERATED_PATH = Path(__file__).parent.parent.resolve() / "generated" + + +def test_clear_output_folder(): + folder = GENERATED_PATH / "authentication-api-key/authentication/apikey/_operations" + assert folder.exists(), "Operations folder should exist" + assert not (folder / "to_be_deleted.py").exists(), "File to_be_deleted.py should be deleted after regeneration" + + assert (GENERATED_PATH / "generation-subdir/generated_tests").exists() + assert not (GENERATED_PATH / "generation-subdir/generated_tests/to_be_deleted.py").exists() + + assert (GENERATED_PATH / "generation-subdir/generation/subdir/_generated").exists() + assert not (GENERATED_PATH / "generation-subdir/generation/subdir/_generated/to_be_deleted.py").exists() + + assert (GENERATED_PATH / "generation-subdir/generation/subdir/to_be_kept.py").exists() diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 487f168f19b..88074059dc9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -60,8 +60,8 @@ importers: specifier: ~1.0.2 version: 1.0.2 '@typespec/http-client-python': - specifier: ~0.19.2 - version: 0.19.2(v262dab2qaapor3zxkb4zsb4ba) + specifier: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTUxNTI4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.19.2.tgz + version: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTUxNTI4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.19.2.tgz(v262dab2qaapor3zxkb4zsb4ba) fs-extra: specifier: ~11.2.0 version: 11.2.0 @@ -82,8 +82,8 @@ importers: packages/typespec-python: dependencies: '@typespec/http-client-python': - specifier: ~0.19.2 - version: 0.19.2(v262dab2qaapor3zxkb4zsb4ba) + specifier: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTUxNTI4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.19.2.tgz + version: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTUxNTI4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.19.2.tgz(v262dab2qaapor3zxkb4zsb4ba) fs-extra: specifier: ~11.2.0 version: 11.2.0 @@ -1681,8 +1681,9 @@ packages: peerDependencies: '@typespec/compiler': ^1.5.0 - '@typespec/http-client-python@0.19.2': - resolution: {integrity: sha512-73l8MbbbuISmzlJcKHErYoJf73RBFndg8vn60IsmloHCd1xaxhtTP5rFeTVgFnpaitd+k44oOjfmTXyRwUXJGw==} + '@typespec/http-client-python@https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTUxNTI4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.19.2.tgz': + resolution: {tarball: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTUxNTI4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.19.2.tgz} + version: 0.19.2 engines: {node: '>=20.0.0'} peerDependencies: '@azure-tools/typespec-autorest': '>=0.61.0 <1.0.0' @@ -6465,7 +6466,7 @@ snapshots: dependencies: '@typespec/compiler': 1.5.0(@types/node@24.1.0) - '@typespec/http-client-python@0.19.2(v262dab2qaapor3zxkb4zsb4ba)': + '@typespec/http-client-python@https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTUxNTI4Ny9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.19.2.tgz(v262dab2qaapor3zxkb4zsb4ba)': dependencies: '@azure-tools/typespec-autorest': 0.61.0(yehncn3lp4xzygpesuojuhtg7i) '@azure-tools/typespec-azure-core': 0.61.0(@typespec/compiler@1.5.0(@types/node@24.1.0))(@typespec/http@1.5.0(@typespec/compiler@1.5.0(@types/node@24.1.0))(@typespec/streams@0.75.0(@typespec/compiler@1.5.0(@types/node@24.1.0))))(@typespec/rest@0.75.0(@typespec/compiler@1.5.0(@types/node@24.1.0))(@typespec/http@1.5.0(@typespec/compiler@1.5.0(@types/node@24.1.0))(@typespec/streams@0.75.0(@typespec/compiler@1.5.0(@types/node@24.1.0)))))