Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/autorest.python/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release

## 6.34.1

### Bump dependencies

- Bump to latest typespec version


## 6.34.0

### Bug Fixes
Expand Down
4 changes: 2 additions & 2 deletions packages/autorest.python/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@autorest/python",
"version": "6.34.0",
"version": "6.34.1",
"description": "The Python extension for generators in AutoRest.",
"scripts": {
"start": "node ./scripts/run-python3.js ./scripts/start.py",
Expand Down Expand Up @@ -29,7 +29,7 @@
},
"homepage": "https://github.com/Azure/autorest.python/blob/main/README.md",
"dependencies": {
"@typespec/http-client-python": "~0.11.1",
"@typespec/http-client-python": "~0.11.2",
"@autorest/system-requirements": "~1.0.2",
"fs-extra": "~11.2.0",
"tsx": "~4.19.1"
Expand Down
7 changes: 7 additions & 0 deletions packages/typespec-python/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release

## 0.44.1

### Bump dependencies

- Bump to latest typespec version


## 0.44.0

### Bug Fixes
Expand Down
64 changes: 32 additions & 32 deletions packages/typespec-python/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@azure-tools/typespec-python",
"version": "0.44.0",
"version": "0.44.1",
"author": "Microsoft Corporation",
"description": "TypeSpec emitter for Python SDKs",
"homepage": "https://github.com/Azure/autorest.python",
Expand Down Expand Up @@ -45,45 +45,45 @@
"generator/**"
],
"peerDependencies": {
"@typespec/compiler": "^1.0.0-0",
"@typespec/http": "^1.0.0-0",
"@typespec/rest": ">=0.68.0 <1.0.0",
"@typespec/versioning": ">=0.68.0 <1.0.0",
"@typespec/openapi": "^1.0.0-0",
"@typespec/events": ">=0.68.0 <1.0.0",
"@typespec/sse": ">=0.68.0 <1.0.0",
"@typespec/streams": ">=0.68.0 <1.0.0",
"@typespec/xml": ">=0.68.0 <1.0.0",
"@azure-tools/typespec-azure-core": ">=0.54.0 <1.0.0",
"@azure-tools/typespec-azure-resource-manager": ">=0.54.0 <1.0.0",
"@azure-tools/typespec-autorest": ">=0.54.0 <1.0.0",
"@azure-tools/typespec-azure-rulesets": ">=0.54.0 <1.0.0",
"@azure-tools/typespec-client-generator-core": ">=0.54.2 <1.0.0"
"@typespec/compiler": "^1.0.0-rc.1",
"@typespec/http": "^1.0.0-rc.1",
"@typespec/rest": ">=0.69.0 <1.0.0",
"@typespec/versioning": ">=0.69.0 <1.0.0",
"@typespec/openapi": "^1.0.0-rc.1",
"@typespec/events": ">=0.69.0 <1.0.0",
"@typespec/sse": ">=0.69.0 <1.0.0",
"@typespec/streams": ">=0.69.0 <1.0.0",
"@typespec/xml": ">=0.69.0 <1.0.0",
"@azure-tools/typespec-azure-core": ">=0.55.0 <1.0.0",
"@azure-tools/typespec-azure-resource-manager": ">=0.55.0 <1.0.0",
"@azure-tools/typespec-autorest": ">=0.55.0 <1.0.0",
"@azure-tools/typespec-azure-rulesets": ">=0.55.0 <1.0.0",
"@azure-tools/typespec-client-generator-core": ">=0.55.0 <1.0.0"
},
"dependencies": {
"js-yaml": "~4.1.0",
"semver": "~7.6.2",
"tsx": "~4.19.1",
"@typespec/http-client-python": "~0.11.1",
"@typespec/http-client-python": "~0.11.2",
"fs-extra": "~11.2.0"
},
"devDependencies": {
"@typespec/compiler": "^1.0.0-0",
"@typespec/http": "^1.0.0-0",
"@typespec/rest": "~0.68.0",
"@typespec/versioning": "~0.68.0",
"@typespec/openapi": "^1.0.0-0",
"@typespec/events": "~0.68.0",
"@typespec/sse": "~0.68.0",
"@typespec/streams": "~0.68.0",
"@typespec/xml": "~0.68.0",
"@azure-tools/typespec-azure-resource-manager": "~0.54.0",
"@azure-tools/typespec-azure-core": "~0.54.0",
"@azure-tools/typespec-azure-rulesets": "~0.54.0",
"@azure-tools/typespec-autorest": "~0.54.0",
"@azure-tools/typespec-client-generator-core": "~0.54.2",
"@azure-tools/azure-http-specs": "0.1.0-alpha.14",
"@typespec/http-specs": "0.1.0-alpha.19",
"@typespec/compiler": "^1.0.0-rc.1",
"@typespec/http": "^1.0.0-rc.1",
"@typespec/rest": "~0.69.0",
"@typespec/versioning": "~0.69.0",
"@typespec/openapi": "^1.0.0-rc.1",
"@typespec/events": "~0.69.0",
"@typespec/sse": "~0.69.0",
"@typespec/streams": "~0.69.0",
"@typespec/xml": "~0.69.0",
"@azure-tools/typespec-azure-resource-manager": "~0.55.0",
"@azure-tools/typespec-azure-core": "~0.55.0",
"@azure-tools/typespec-azure-rulesets": "~0.55.0",
"@azure-tools/typespec-autorest": "~0.55.0",
"@azure-tools/typespec-client-generator-core": "~0.55.0",
"@azure-tools/azure-http-specs": "0.1.0-alpha.15",
"@typespec/http-specs": "0.1.0-alpha.20",
"@types/js-yaml": "~4.0.5",
"@types/node": "~22.13.14",
"@types/yargs": "~17.0.33",
Expand Down
2 changes: 2 additions & 0 deletions packages/typespec-python/scripts/eng/mypy.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# global configurations
[mypy]
python_version = 3.9
# Exclude mypy check for sub client tests
exclude = (azure/clientgenerator/core/clientinitialization/operations/_operations\.py|azure/clientgenerator/core/clientinitialization/aio/operations/_operations\.py)


# module level configurations
Expand Down
3 changes: 3 additions & 0 deletions packages/typespec-python/scripts/eng/regenerate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ const AZURE_EMITTER_OPTIONS: Record<string, Record<string, string> | Record<stri
"azure/client-generator-core/client-initialization": {
namespace: "specs.azure.clientgenerator.core.clientinitialization",
},
"azure/client-generator-core/deserialize-empty-string-as-null": {
namespace: "specs.azure.clientgenerator.core.emptystring",
},
"azure/client-generator-core/flatten-property": {
namespace: "specs.azure.clientgenerator.core.flattenproperty",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
"specs.azure.clientgenerator.core.clientinitialization.ParamAliasClient.with_aliased_name": "_Specs_.Azure.ClientGeneratorCore.ClientInitialization.ParamAlias.withAliasedName",
"specs.azure.clientgenerator.core.clientinitialization.aio.ParamAliasClient.with_aliased_name": "_Specs_.Azure.ClientGeneratorCore.ClientInitialization.ParamAlias.withAliasedName",
"specs.azure.clientgenerator.core.clientinitialization.ParamAliasClient.with_original_name": "_Specs_.Azure.ClientGeneratorCore.ClientInitialization.ParamAlias.withOriginalName",
"specs.azure.clientgenerator.core.clientinitialization.aio.ParamAliasClient.with_original_name": "_Specs_.Azure.ClientGeneratorCore.ClientInitialization.ParamAlias.withOriginalName"
"specs.azure.clientgenerator.core.clientinitialization.aio.ParamAliasClient.with_original_name": "_Specs_.Azure.ClientGeneratorCore.ClientInitialization.ParamAlias.withOriginalName",
"specs.azure.clientgenerator.core.clientinitialization.operations.ChildClientOperations.with_query": "_Specs_.Azure.ClientGeneratorCore.ClientInitialization.ParentClient.ChildClient.withQuery",
"specs.azure.clientgenerator.core.clientinitialization.aio.operations.ChildClientOperations.with_query": "_Specs_.Azure.ClientGeneratorCore.ClientInitialization.ParentClient.ChildClient.withQuery",
"specs.azure.clientgenerator.core.clientinitialization.operations.ChildClientOperations.get_standalone": "_Specs_.Azure.ClientGeneratorCore.ClientInitialization.ParentClient.ChildClient.getStandalone",
"specs.azure.clientgenerator.core.clientinitialization.aio.operations.ChildClientOperations.get_standalone": "_Specs_.Azure.ClientGeneratorCore.ClientInitialization.ParentClient.ChildClient.getStandalone",
"specs.azure.clientgenerator.core.clientinitialization.operations.ChildClientOperations.delete_standalone": "_Specs_.Azure.ClientGeneratorCore.ClientInitialization.ParentClient.ChildClient.deleteStandalone",
"specs.azure.clientgenerator.core.clientinitialization.aio.operations.ChildClientOperations.delete_standalone": "_Specs_.Azure.ClientGeneratorCore.ClientInitialization.ParentClient.ChildClient.deleteStandalone"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ def add_sanitizers(test_proxy):
add_general_regex_sanitizer(regex=paramalias_client_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=paramalias_client_secret, value="00000000-0000-0000-0000-000000000000")

parent_subscription_id = os.environ.get("PARENT_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
parent_tenant_id = os.environ.get("PARENT_TENANT_ID", "00000000-0000-0000-0000-000000000000")
parent_client_id = os.environ.get("PARENT_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
parent_client_secret = os.environ.get("PARENT_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=parent_subscription_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=parent_tenant_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=parent_client_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=parent_client_secret, value="00000000-0000-0000-0000-000000000000")

add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]")
add_header_regex_sanitizer(key="Cookie", value="cookie;")
add_body_key_sanitizer(json_path="$..access_token", value="access_token")
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 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 ParentClientTestBase, ParentPreparer


@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestParentChildClientOperations(ParentClientTestBase):
@ParentPreparer()
@recorded_by_proxy
def test_child_client_with_query(self, parent_endpoint):
client = self.create_client(endpoint=parent_endpoint)
response = client.child_client.with_query()

# please add some check logic here by yourself
# ...

@ParentPreparer()
@recorded_by_proxy
def test_child_client_get_standalone(self, parent_endpoint):
client = self.create_client(endpoint=parent_endpoint)
response = client.child_client.get_standalone()

# please add some check logic here by yourself
# ...

@ParentPreparer()
@recorded_by_proxy
def test_child_client_delete_standalone(self, parent_endpoint):
client = self.create_client(endpoint=parent_endpoint)
response = client.child_client.delete_standalone()

# please add some check logic here by yourself
# ...
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 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 ParentPreparer
from testpreparer_async import ParentClientTestBaseAsync


@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestParentChildClientOperationsAsync(ParentClientTestBaseAsync):
@ParentPreparer()
@recorded_by_proxy_async
async def test_child_client_with_query(self, parent_endpoint):
client = self.create_async_client(endpoint=parent_endpoint)
response = await client.child_client.with_query()

# please add some check logic here by yourself
# ...

@ParentPreparer()
@recorded_by_proxy_async
async def test_child_client_get_standalone(self, parent_endpoint):
client = self.create_async_client(endpoint=parent_endpoint)
response = await client.child_client.get_standalone()

# please add some check logic here by yourself
# ...

@ParentPreparer()
@recorded_by_proxy_async
async def test_child_client_delete_standalone(self, parent_endpoint):
client = self.create_async_client(endpoint=parent_endpoint)
response = await client.child_client.delete_standalone()

# please add some check logic here by yourself
# ...
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
MixedParamsClient,
MultipleParamsClient,
ParamAliasClient,
ParentClient,
PathParamClient,
)

Expand Down Expand Up @@ -94,3 +95,17 @@ def create_client(self, endpoint):
ParamAliasPreparer = functools.partial(
PowerShellPreparer, "paramalias", paramalias_endpoint="https://fake_paramalias_endpoint.com"
)


class ParentClientTestBase(AzureRecordedTestCase):

def create_client(self, endpoint):
credential = self.get_credential(ParentClient)
return self.create_client_from_credential(
ParentClient,
credential=credential,
endpoint=endpoint,
)


ParentPreparer = functools.partial(PowerShellPreparer, "parent", parent_endpoint="https://fake_parent_endpoint.com")
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
MixedParamsClient,
MultipleParamsClient,
ParamAliasClient,
ParentClient,
PathParamClient,
)

Expand Down Expand Up @@ -68,3 +69,14 @@ def create_async_client(self, endpoint):
credential=credential,
endpoint=endpoint,
)


class ParentClientTestBaseAsync(AzureRecordedTestCase):

def create_async_client(self, endpoint):
credential = self.get_credential(ParentClient, is_async=True)
return self.create_client_from_credential(
ParentClient,
credential=credential,
endpoint=endpoint,
)
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from ._client import MixedParamsClient # type: ignore
from ._client import PathParamClient # type: ignore
from ._client import ParamAliasClient # type: ignore
from ._client import ParentClient # type: ignore
from ._version import VERSION

__version__ = VERSION
Expand All @@ -34,6 +35,7 @@
"MixedParamsClient",
"PathParamClient",
"ParamAliasClient",
"ParentClient",
]
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore

Expand Down
Loading
Loading