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
8 changes: 8 additions & 0 deletions .chronus/changes/mixinImportsFix-2025-6-23-14-18-42.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
changeKind: fix
packages:
- "@autorest/python"
- "@azure-tools/typespec-python"
---

Fix regression that ignored patches to mixin operation groups when patched in the `operations` folder
2 changes: 1 addition & 1 deletion packages/autorest.python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"homepage": "https://github.com/Azure/autorest.python/blob/main/README.md",
"dependencies": {
"@typespec/http-client-python": "~0.14.1-dev.2",
"@typespec/http-client-python": "~0.14.1",
"@autorest/system-requirements": "~1.0.2",
"fs-extra": "~11.2.0",
"tsx": "~4.19.1"
Expand Down
6 changes: 1 addition & 5 deletions packages/autorest.python/scripts/eng/regenerate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,14 @@ function getEmitterOption(spec: string): Record<string, string>[] {

// Function to execute CLI commands asynchronously
async function executeCommand(tspCommand: TspCommand): Promise<void> {
try {
rmSync(tspCommand.outputDir, { recursive: true, force: true });
} catch (error) {
console.error(`rm error: ${error}`);
}
try {
console.log(`exec: ${tspCommand.command}`);
const { stdout, stderr } = await exec(tspCommand.command);
if (stdout) console.log(`stdout: ${stdout}`);
if (stderr) console.error(`stderr: ${stderr}`);
} catch (error) {
console.error(`exec error: ${error}`);
rmSync(tspCommand.outputDir, { recursive: true, force: true });
throw error;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/typespec-python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"js-yaml": "~4.1.0",
"semver": "~7.6.2",
"tsx": "~4.19.1",
"@typespec/http-client-python": "~0.14.1-dev.2",
"@typespec/http-client-python": "~0.14.1",
"fs-extra": "~11.2.0"
},
"devDependencies": {
Expand Down
6 changes: 1 addition & 5 deletions packages/typespec-python/scripts/eng/regenerate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,18 +253,14 @@ function getEmitterOption(spec: string, flavor: string): Record<string, string>[

// Function to execute CLI commands asynchronously
async function executeCommand(tspCommand: TspCommand): Promise<void> {
try {
rmSync(tspCommand.outputDir, { recursive: true, force: true });
} catch (error) {
console.error(`rm error: ${error}`);
}
try {
console.log(`exec: ${tspCommand.command}`);
const { stdout, stderr } = await exec(tspCommand.command);
if (stdout) console.log(`stdout: ${stdout}`);
if (stderr) console.error(`stderr: ${stderr}`);
} catch (error) {
console.error(`exec error: ${error}`);
rmSync(tspCommand.outputDir, { recursive: true, force: true });
throw error;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
# 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.
# --------------------------------------------------------------------------

"""Customize generated code here.

Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import List

__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
from ._operations import _ApiKeyClientOperationsMixin as Generated


class _ApiKeyClientOperationsMixin(Generated):

def patch_added_operation(self) -> bool:
"""This is a placeholder for the operation that was added in the patch.

This method is a no-op and does not perform any action.

:return: Always returns True.
:rtype: bool
"""
return True


__all__: List[str] = [
"_ApiKeyClientOperationsMixin"
] # Add all objects you want publicly available to users at this package level


def patch_sdk():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
# 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.
# --------------------------------------------------------------------------

"""Customize generated code here.

Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import List

__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
from ._operations import _ApiKeyClientOperationsMixin as Generated


class _ApiKeyClientOperationsMixin(Generated):

def patch_added_operation(self) -> bool:
"""This is a placeholder for the operation that was added in the patch.

This method is a no-op and does not perform any action.

:return: Always returns True.
:rtype: bool
"""
return True


__all__: List[str] = [
"_ApiKeyClientOperationsMixin"
] # Add all objects you want publicly available to users at this package level


def patch_sdk():
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------


def test_patch_mixin_operation_group_in_operations_folder(key_credential):
from authentication.apikey import ApiKeyClient, aio

assert hasattr(ApiKeyClient(key_credential), "patch_added_operation")
assert hasattr(aio.ApiKeyClient(key_credential), "patch_added_operation")
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,25 @@
"""
from typing import List

__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
from ._operations import _ApiKeyClientOperationsMixin as Generated


class _ApiKeyClientOperationsMixin(Generated):

def patch_added_operation(self) -> bool:
"""This is a placeholder for the operation that was added in the patch.

This method is a no-op and does not perform any action.

:return: Always returns True.
:rtype: bool
"""
return True


__all__: List[str] = [
"_ApiKeyClientOperationsMixin"
] # Add all objects you want publicly available to users at this package level


def patch_sdk():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,25 @@
"""
from typing import List

__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
from ._operations import _ApiKeyClientOperationsMixin as Generated


class _ApiKeyClientOperationsMixin(Generated):

def patch_added_operation(self) -> bool:
"""This is a placeholder for the operation that was added in the patch.

This method is a no-op and does not perform any action.

:return: Always returns True.
:rtype: bool
"""
return True


__all__: List[str] = [
"_ApiKeyClientOperationsMixin"
] # Add all objects you want publicly available to users at this package level


def patch_sdk():
Expand Down
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading