Skip to content

Commit 1feff61

Browse files
authored
[Python] fix logic about which scenario to add msrest as dependency (#3267)
* Update dependencies * Add changelog .chronus/changes/auto-microsoft-python-fix-msrest-dependency-2025-10-28-11-58-45.md * Update dependencies (2025-11-28 04:57:04) * Regenerate for autorest.python (2025-11-28 05:16:39) * add test case --------- Co-authored-by: AutoPrFromHttpClientPython <AutoPrFromHttpClientPython>
1 parent 4e704c3 commit 1feff61

File tree

77 files changed

+192
-88
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+192
-88
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
changeKind: fix
3+
packages:
4+
- "@autorest/python"
5+
- "@azure-tools/typespec-python"
6+
---
7+
8+
fix logic about which scenario to add msrest as dependency

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": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTYxODM0NC9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.20.3.tgz",
32+
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTYxODM5OC9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.20.3.tgz",
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-pyproject/test/azure-mgmt-pyproject/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ requires-python = ">=3.9"
3131
keywords = ["azure", "azure sdk"]
3232

3333
dependencies = [
34-
"msrest>=0.7.1",
34+
"isodate>=0.6.1",
3535
"azure-mgmt-core>=1.6.0",
3636
"typing-extensions>=4.6.0",
3737
]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"azure.mgmt.test": ["py.typed"],
6464
},
6565
install_requires=[
66-
"msrest>=0.7.1",
66+
"isodate>=0.6.1",
6767
"azure-mgmt-core>=1.6.0",
6868
"typing-extensions>=4.6.0",
6969
],

packages/autorest.python/samples/specification/management/generated/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
packages=find_packages(),
2424
include_package_data=True,
2525
install_requires=[
26-
"msrest>=0.7.1",
26+
"isodate>=0.6.1",
2727
"azure-mgmt-core>=1.6.0",
2828
"typing-extensions>=4.6.0",
2929
],

packages/autorest.python/test/azure/legacy/AcceptanceTests/test_duration.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,8 @@
2424
#
2525
# --------------------------------------------------------------------------
2626

27-
import unittest
28-
import subprocess
29-
import sys
30-
import isodate
31-
import tempfile
32-
import json
3327
from uuid import uuid4
34-
from datetime import date, datetime, timedelta
35-
import os
28+
from datetime import timedelta
3629
from os.path import dirname, pardir, join, realpath
3730

3831
from azure.core.exceptions import DeserializationError
@@ -76,3 +69,28 @@ def test_operation_groups(self):
7669
from bodyduration.operations._duration_operations import DurationOperations as DurationOperationsPy2
7770

7871
assert DurationOperations == DurationOperationsPy2
72+
73+
def test_setup_py_requirements(self):
74+
# this file is generated, so we can basic check on it
75+
# We want to make sure "isodate" is a dependency and not "msrest"
76+
setup_path = realpath(
77+
join(
78+
dirname(realpath(__file__)),
79+
"..",
80+
"Expected",
81+
"AcceptanceTests",
82+
"AzureBodyDuration",
83+
"setup.py",
84+
)
85+
)
86+
# Super ugly, but I don't want to write a parser for a setup.py
87+
with open(setup_path, "r") as setup_file:
88+
content = setup_file.read()
89+
90+
# Let's just check the install_requires is what we expect
91+
# We can't use ast, since it's not abstract syntax tree, it's just text.
92+
# Let's find the install_requires
93+
install_requires_part = content[content.find("install_requires") :]
94+
# This is very fragile, but for a test on generated code, that's what we want
95+
assert "isodate" in install_requires_part
96+
assert "msrest" not in install_requires_part

packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
packages=find_packages(),
2424
include_package_data=True,
2525
install_requires=[
26-
"msrest>=0.7.1",
26+
"isodate>=0.6.1",
2727
"azure-core>=1.35.0",
2828
"typing-extensions>=4.6.0",
2929
],

packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
packages=find_packages(),
2424
include_package_data=True,
2525
install_requires=[
26-
"msrest>=0.7.1",
26+
"isodate>=0.6.1",
2727
"azure-core>=1.35.0",
2828
"typing-extensions>=4.6.0",
2929
],

packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
packages=find_packages(),
2424
include_package_data=True,
2525
install_requires=[
26-
"msrest>=0.7.1",
26+
"isodate>=0.6.1",
2727
"azure-mgmt-core>=1.6.0",
2828
"typing-extensions>=4.6.0",
2929
],

packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
packages=find_packages(),
2424
include_package_data=True,
2525
install_requires=[
26-
"msrest>=0.7.1",
26+
"isodate>=0.6.1",
2727
"azure-core>=1.35.0",
2828
"typing-extensions>=4.6.0",
2929
],

0 commit comments

Comments
 (0)