Skip to content

Commit badf2e1

Browse files
authored
Bump http-client-python 0.6.9 to fix output folder of models when output folder is different with namespace in configuration (#3030)
* fix test case for data-plan SDK generation * Update dependencies (2025-01-24 08:39:27) * Regenerate for autorest.python (2025-01-24 08:58:00) * add changelog * bump http-client-python 0.6.9 * add changelog --------- Co-authored-by: AutoPrFromHttpClientPython <AutoPrFromHttpClientPython>
1 parent b8626ba commit badf2e1

39 files changed

+18403
-551
lines changed

packages/autorest.python/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Release
22

3+
34
## 6.28.2
45

56
### Bug Fixes
@@ -10,6 +11,7 @@
1011
- [#3025](https://github.com/Azure/autorest.python/pull/3025) Fix sphinx typing for raising documentation
1112
- [#3025](https://github.com/Azure/autorest.python/pull/3025) fix typing for class methods in _serialization.py
1213
- [#3015](https://github.com/Azure/autorest.python/pull/3015) Order keyword-only args overload first in generated operations
14+
- [#3030](https://github.com/Azure/autorest.python/pull/3030) Fix output folder of models when output folder is different with namespace in configuration
1315

1416

1517
## 6.28.1

packages/autorest.python/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
},
3030
"homepage": "https://github.com/Azure/autorest.python/blob/main/README.md",
3131
"dependencies": {
32-
"@typespec/http-client-python": "~0.6.8",
32+
"@typespec/http-client-python": "~0.6.9",
3333
"@autorest/system-requirements": "~1.0.2",
3434
"fs-extra": "~11.2.0",
3535
"tsx": "~4.19.1"

packages/autorest.python/samples/specification/azure-mgmt-test/readme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ This file is to check whether standard [readme.python.md](https://github.com/Azu
55
### Settings
66

77
``` yaml $(python)
8-
input-file: ../../../node_modules/@microsoft.azure/autorest.testserver/swagger/head.json
8+
input-file: ../../../node_modules/@microsoft.azure/autorest.testserver/swagger/body-array.json
99
azure-arm: true
1010
license-header: MICROSOFT_MIT_NO_VERSION
1111
package-name: azure-mgmt-test
1212
namespace: azure.mgmt.test
1313
package-version: 1.0.0b1
1414
clear-output-folder: true
15+
version-tolerant: false
1516
```
1617
1718
``` yaml $(python)

packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
if TYPE_CHECKING:
1313
from ._patch import * # pylint: disable=unused-wildcard-import
1414

15-
from ._client import AutoRestHeadTestService # type: ignore
15+
from ._auto_rest_swagger_bat_array_service import AutoRestSwaggerBATArrayService # type: ignore
1616
from ._version import VERSION
1717

1818
__version__ = VERSION
@@ -25,7 +25,7 @@
2525
from ._patch import patch_sdk as _patch_sdk
2626

2727
__all__ = [
28-
"AutoRestHeadTestService",
28+
"AutoRestSwaggerBATArrayService",
2929
]
3030
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
3131

packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_client.py renamed to packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_auto_rest_swagger_bat_array_service.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,28 @@
1515
from azure.mgmt.core import ARMPipelineClient
1616
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
1717

18-
from ._configuration import AutoRestHeadTestServiceConfiguration
18+
from . import models as _models
19+
from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration
1920
from ._serialization import Deserializer, Serializer
20-
from .operations import HttpSuccessOperations
21+
from .operations import ArrayOperations
2122

2223
if TYPE_CHECKING:
2324
from azure.core.credentials import TokenCredential
2425

2526

26-
class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword
27-
"""Test Infrastructure for AutoRest.
27+
class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword
28+
"""Test Infrastructure for AutoRest Swagger BAT.
2829
29-
:ivar http_success: HttpSuccessOperations operations
30-
:vartype http_success: azure.mgmt.test.operations.HttpSuccessOperations
30+
:ivar array: ArrayOperations operations
31+
:vartype array: azure.mgmt.test.operations.ArrayOperations
3132
:param credential: Credential needed for the client to connect to Azure. Required.
3233
:type credential: ~azure.core.credentials.TokenCredential
33-
:param endpoint: Service URL. Default value is "http://localhost:3000".
34-
:type endpoint: str
34+
:param base_url: Service URL. Default value is "http://localhost:3000".
35+
:type base_url: str
3536
"""
3637

37-
def __init__(self, credential: "TokenCredential", endpoint: str = "http://localhost:3000", **kwargs: Any) -> None:
38-
self._config = AutoRestHeadTestServiceConfiguration(credential=credential, **kwargs)
38+
def __init__(self, credential: "TokenCredential", base_url: str = "http://localhost:3000", **kwargs: Any) -> None:
39+
self._config = AutoRestSwaggerBATArrayServiceConfiguration(credential=credential, **kwargs)
3940
_policies = kwargs.pop("policies", None)
4041
if _policies is None:
4142
_policies = [
@@ -54,20 +55,21 @@ def __init__(self, credential: "TokenCredential", endpoint: str = "http://localh
5455
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
5556
self._config.http_logging_policy,
5657
]
57-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=endpoint, policies=_policies, **kwargs)
58+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
5859

59-
self._serialize = Serializer()
60-
self._deserialize = Deserializer()
60+
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
61+
self._serialize = Serializer(client_models)
62+
self._deserialize = Deserializer(client_models)
6163
self._serialize.client_side_validation = False
62-
self.http_success = HttpSuccessOperations(self._client, self._config, self._serialize, self._deserialize)
64+
self.array = ArrayOperations(self._client, self._config, self._serialize, self._deserialize)
6365

64-
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
66+
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
6567
"""Runs the network request through the client's chained policies.
6668
6769
>>> from azure.core.rest import HttpRequest
6870
>>> request = HttpRequest("GET", "https://www.example.org/")
6971
<HttpRequest [GET], url: 'https://www.example.org/'>
70-
>>> response = client.send_request(request)
72+
>>> response = client._send_request(request)
7173
<HttpResponse: 200 OK>
7274
7375
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request

packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
from azure.core.credentials import TokenCredential
1818

1919

20-
class AutoRestHeadTestServiceConfiguration: # pylint: disable=too-many-instance-attributes
21-
"""Configuration for AutoRestHeadTestService.
20+
class AutoRestSwaggerBATArrayServiceConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
21+
"""Configuration for AutoRestSwaggerBATArrayService.
2222
2323
Note that all parameters used to create this instance are saved as instance
2424
attributes.

packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
if TYPE_CHECKING:
1313
from ._patch import * # pylint: disable=unused-wildcard-import
1414

15-
from ._client import AutoRestHeadTestService # type: ignore
15+
from ._auto_rest_swagger_bat_array_service import AutoRestSwaggerBATArrayService # type: ignore
1616

1717
try:
1818
from ._patch import __all__ as _patch_all
@@ -22,7 +22,7 @@
2222
from ._patch import patch_sdk as _patch_sdk
2323

2424
__all__ = [
25-
"AutoRestHeadTestService",
25+
"AutoRestSwaggerBATArrayService",
2626
]
2727
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2828

packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/_client.py renamed to packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/_auto_rest_swagger_bat_array_service.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,30 @@
1515
from azure.mgmt.core import AsyncARMPipelineClient
1616
from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy
1717

18+
from .. import models as _models
1819
from .._serialization import Deserializer, Serializer
19-
from ._configuration import AutoRestHeadTestServiceConfiguration
20-
from .operations import HttpSuccessOperations
20+
from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration
21+
from .operations import ArrayOperations
2122

2223
if TYPE_CHECKING:
2324
from azure.core.credentials_async import AsyncTokenCredential
2425

2526

26-
class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword
27-
"""Test Infrastructure for AutoRest.
27+
class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword
28+
"""Test Infrastructure for AutoRest Swagger BAT.
2829
29-
:ivar http_success: HttpSuccessOperations operations
30-
:vartype http_success: azure.mgmt.test.aio.operations.HttpSuccessOperations
30+
:ivar array: ArrayOperations operations
31+
:vartype array: azure.mgmt.test.aio.operations.ArrayOperations
3132
:param credential: Credential needed for the client to connect to Azure. Required.
3233
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
33-
:param endpoint: Service URL. Default value is "http://localhost:3000".
34-
:type endpoint: str
34+
:param base_url: Service URL. Default value is "http://localhost:3000".
35+
:type base_url: str
3536
"""
3637

3738
def __init__(
38-
self, credential: "AsyncTokenCredential", endpoint: str = "http://localhost:3000", **kwargs: Any
39+
self, credential: "AsyncTokenCredential", base_url: str = "http://localhost:3000", **kwargs: Any
3940
) -> None:
40-
self._config = AutoRestHeadTestServiceConfiguration(credential=credential, **kwargs)
41+
self._config = AutoRestSwaggerBATArrayServiceConfiguration(credential=credential, **kwargs)
4142
_policies = kwargs.pop("policies", None)
4243
if _policies is None:
4344
_policies = [
@@ -56,22 +57,23 @@ def __init__(
5657
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
5758
self._config.http_logging_policy,
5859
]
59-
self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=endpoint, policies=_policies, **kwargs)
60+
self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
6061

61-
self._serialize = Serializer()
62-
self._deserialize = Deserializer()
62+
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
63+
self._serialize = Serializer(client_models)
64+
self._deserialize = Deserializer(client_models)
6365
self._serialize.client_side_validation = False
64-
self.http_success = HttpSuccessOperations(self._client, self._config, self._serialize, self._deserialize)
66+
self.array = ArrayOperations(self._client, self._config, self._serialize, self._deserialize)
6567

66-
def send_request(
68+
def _send_request(
6769
self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
6870
) -> Awaitable[AsyncHttpResponse]:
6971
"""Runs the network request through the client's chained policies.
7072
7173
>>> from azure.core.rest import HttpRequest
7274
>>> request = HttpRequest("GET", "https://www.example.org/")
7375
<HttpRequest [GET], url: 'https://www.example.org/'>
74-
>>> response = await client.send_request(request)
76+
>>> response = await client._send_request(request)
7577
<AsyncHttpResponse: 200 OK>
7678
7779
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request

packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/_configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
from azure.core.credentials_async import AsyncTokenCredential
1818

1919

20-
class AutoRestHeadTestServiceConfiguration: # pylint: disable=too-many-instance-attributes
21-
"""Configuration for AutoRestHeadTestService.
20+
class AutoRestSwaggerBATArrayServiceConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
21+
"""Configuration for AutoRestSwaggerBATArrayService.
2222
2323
Note that all parameters used to create this instance are saved as instance
2424
attributes.

packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/operations/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
if TYPE_CHECKING:
1313
from ._patch import * # pylint: disable=unused-wildcard-import
1414

15-
from ._operations import HttpSuccessOperations # type: ignore
15+
from ._array_operations import ArrayOperations # type: ignore
1616

1717
from ._patch import __all__ as _patch_all
1818
from ._patch import *
1919
from ._patch import patch_sdk as _patch_sdk
2020

2121
__all__ = [
22-
"HttpSuccessOperations",
22+
"ArrayOperations",
2323
]
2424
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2525
_patch_sdk()

0 commit comments

Comments
 (0)