Skip to content
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion doc/analyze_check_versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ Pylint Guidelines Checker | 0.5.7 | 0.5.7 | 2026-04-13 |
MyPy | 1.18.1 | 1.19.1 | 2026-04-13 |
Pyright | 1.1.405 | 1.1.407 | 2026-04-13 |
Sphinx | 8.2.0 | N/A | N/A |
Black | 24.4.0 | N/A | N/A |
Black | 26.3.0 | N/A | N/A |
2 changes: 1 addition & 1 deletion eng/tools/azure-sdk-tools/azpysdk/black.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from .Check import Check

BLACK_VERSION = "24.4.0"
BLACK_VERSION = "26.3.0"
REPO_ROOT = discover_repo_root()


Expand Down
2 changes: 1 addition & 1 deletion eng/tox/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ commands =
description=Runs the code formatter black
skip_install=true
deps=
black==24.4.0
black==26.3.0
-rdev_requirements.txt
commands=
python {repository_root}/eng/tox/run_black.py -t {tox_root}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

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
Expand Down
78 changes: 42 additions & 36 deletions sdk/advisor/azure-mgmt-advisor/setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python

#-------------------------------------------------------------------------
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------
# --------------------------------------------------------------------------

import re
import os.path
Expand All @@ -16,63 +16,69 @@
PACKAGE_PPRINT_NAME = "Advisor"

# a-b-c => a/b/c
package_folder_path = PACKAGE_NAME.replace('-', '/')
package_folder_path = PACKAGE_NAME.replace("-", "/")
# a-b-c => a.b.c
namespace_name = PACKAGE_NAME.replace('-', '.')
namespace_name = PACKAGE_NAME.replace("-", ".")

# Version extraction inspired from 'requests'
with open(os.path.join(package_folder_path, 'version.py')
if os.path.exists(os.path.join(package_folder_path, 'version.py'))
else os.path.join(package_folder_path, '_version.py'), 'r') as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)
with open(
(
os.path.join(package_folder_path, "version.py")
if os.path.exists(os.path.join(package_folder_path, "version.py"))
else os.path.join(package_folder_path, "_version.py")
),
"r",
) as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1)

if not version:
raise RuntimeError('Cannot find version information')
raise RuntimeError("Cannot find version information")

with open('README.md', encoding='utf-8') as f:
with open("README.md", encoding="utf-8") as f:
readme = f.read()
with open('CHANGELOG.md', encoding='utf-8') as f:
with open("CHANGELOG.md", encoding="utf-8") as f:
changelog = f.read()

setup(
name=PACKAGE_NAME,
version=version,
description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME),
long_description=readme + '\n\n' + changelog,
long_description_content_type='text/markdown',
license='MIT License',
author='Microsoft Corporation',
author_email='azpysdkhelp@microsoft.com',
url='https://github.com/Azure/azure-sdk-for-python',
description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME),
long_description=readme + "\n\n" + changelog,
long_description_content_type="text/markdown",
license="MIT License",
author="Microsoft Corporation",
author_email="azpysdkhelp@microsoft.com",
url="https://github.com/Azure/azure-sdk-for-python",
keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product
classifiers=[
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'License :: OSI Approved :: MIT License',
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"License :: OSI Approved :: MIT License",
],
zip_safe=False,
packages=find_packages(exclude=[
'tests',
# Exclude packages that will be covered by PEP420 or nspkg
'azure',
'azure.mgmt',
]),
packages=find_packages(
exclude=[
"tests",
# Exclude packages that will be covered by PEP420 or nspkg
"azure",
"azure.mgmt",
]
),
include_package_data=True,
package_data={
'pytyped': ['py.typed'],
"pytyped": ["py.typed"],
},
install_requires=[
"msrest>=0.7.1",
"azure-common~=1.1",
"azure-mgmt-core>=1.3.2,<2.0.0",
"typing-extensions>=4.3.0; python_version<'3.8.0'",
],
python_requires=">=3.7"
python_requires=">=3.7",
)
1 change: 1 addition & 0 deletions sdk/advisor/azure-mgmt-advisor/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

load_dotenv()


@pytest.fixture(scope="session", autouse=True)
def add_sanitizers(test_proxy):
subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
Expand Down
86 changes: 36 additions & 50 deletions sdk/advisor/azure-mgmt-advisor/tests/test_mgmt_advisor.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
# 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.
#--------------------------------------------------------------------------
# --------------------------------------------------------------------------
import azure.mgmt.advisor
import datetime
import re
import unittest

from azure.mgmt.advisor.models import (
ConfigData
)
from azure.mgmt.advisor.models import ConfigData

from devtools_testutils import (
AzureMgmtRecordedTestCase, ResourceGroupPreparer, recorded_by_proxy
)
from devtools_testutils import AzureMgmtRecordedTestCase, ResourceGroupPreparer, recorded_by_proxy

# the goal of these tests is to validate AutoRest generation of the Python wrapper
# and NOT to validate the behavior of the API. so the tests will primarily attempt
# to verify that all operations are possible using the generated client and that
# the operations can accept valid input and produce valid output.


class TestMgmtAdvisor(AzureMgmtRecordedTestCase):

def setup_method(self, method):
self.client = self.create_mgmt_client(
azure.mgmt.advisor.AdvisorManagementClient
)
self.client = self.create_mgmt_client(azure.mgmt.advisor.AdvisorManagementClient)

@recorded_by_proxy
def test_generate_recommendations(self):
Expand All @@ -40,8 +35,8 @@ def call(response, *args, **kwargs):
response = self.client.recommendations.generate(cls=call)

# we should get a valid Location header back
assert 'Location' in response.headers
location = response.headers['Location']
assert "Location" in response.headers
location = response.headers["Location"]

# extract the operation ID from the Location header
operation_id = re.findall("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", location)
Expand All @@ -51,10 +46,7 @@ def call(response, *args, **kwargs):
assert len(operation_id), 1

# we should be able to get generation status for this operation ID
response = self.client.recommendations.get_generate_status(
cls=call,
operation_id = operation_id[0]
)
response = self.client.recommendations.get_generate_status(cls=call, operation_id=operation_id[0])
status_code = response.status_code

# and the status should be 202 or 204
Expand Down Expand Up @@ -82,57 +74,54 @@ def test_suppressions(self):
assert rec.short_description != None
assert rec.short_description.problem != None
assert rec.short_description.solution != None
if (rec.impacted_value != None):
if rec.impacted_value != None:
recommendation = rec

# construct the properties needed for further operations
resourceUri = recommendation.id[:recommendation.id.find("/providers/Microsoft.Advisor/recommendations")]
resourceUri = recommendation.id[: recommendation.id.find("/providers/Microsoft.Advisor/recommendations")]
recommendationName = recommendation.name
suppressionName = "Python_SDK_Test"
timeToLive = "00:01:00:00"

# get the individual recommendation
output = self.client.recommendations.get(
resource_uri = resourceUri,
recommendation_id = recommendationName
)
output = self.client.recommendations.get(resource_uri=resourceUri, recommendation_id=recommendationName)

# it should be identical to what we got from list
assert output.id == rec.id
assert output.name == rec.name

# create a new suppression
suppression = self.client.suppressions.create(
resource_uri = resourceUri,
recommendation_id = recommendationName,
name = suppressionName,
ttl = timeToLive
resource_uri=resourceUri, recommendation_id=recommendationName, name=suppressionName, ttl=timeToLive
)

# it should get created successfully
assert suppression.ttl == "01:00:00"

# get the suppression
sup = self.client.suppressions.get(
resource_uri = resourceUri,
recommendation_id = recommendationName,
name = suppressionName
resource_uri=resourceUri, recommendation_id=recommendationName, name=suppressionName
)

# it should be identical to what we just added
assert sup.name == suppressionName
assert sup.id == resourceUri + "/providers/Microsoft.Advisor/recommendations/" + recommendationName + "/suppressions/" + suppressionName
assert (
sup.id
== resourceUri
+ "/providers/Microsoft.Advisor/recommendations/"
+ recommendationName
+ "/suppressions/"
+ suppressionName
)

# delete the suppression
self.client.suppressions.delete(
resource_uri = resourceUri,
recommendation_id = recommendationName,
name = suppressionName
resource_uri=resourceUri, recommendation_id=recommendationName, name=suppressionName
)

# the suppression should be gone
#response = list(self.client.suppressions.list())
#for sup in response:
# response = list(self.client.suppressions.list())
# for sup in response:
# assert sup.Name != suppressionName

@unittest.skip("unavailable")
Expand All @@ -141,7 +130,7 @@ def test_configurations_subscription(self):

# create a new configuration to update low CPU threshold to 20
input = ConfigData()
input.low_cpu_threshold=20
input.low_cpu_threshold = 20

# update the configuration
response = self.client.configurations.create_in_subscription(input)
Expand All @@ -153,7 +142,7 @@ def test_configurations_subscription(self):
assert output.low_cpu_threshold == "20"

# restore the default configuration
input.low_cpu_threshold=5
input.low_cpu_threshold = 5
response = self.client.configurations.create_in_subscription(input)

# retrieve the configurations
Expand All @@ -170,35 +159,32 @@ def test_configurations_resourcegroup(self, resource_group):

# create a new configuration to update exclude to True
input = ConfigData()
input.exclude=True
input.exclude = True

# update the configuration
self.client.configurations.create_in_resource_group(
configuration_name=configurationName,
resource_group=resourceGroupName,
config_contract=input
configuration_name=configurationName, resource_group=resourceGroupName, config_contract=input
)

# retrieve the configurations
output = list(self.client.configurations.list_by_resource_group(resource_group = resourceGroupName))[0]
output = list(self.client.configurations.list_by_resource_group(resource_group=resourceGroupName))[0]

# it should be identical to what we just set
assert output.exclude == True

# restore the default configuration
input.exclude=False
input.exclude = False
self.client.configurations.create_in_resource_group(
configuration_name=configurationName,
resource_group=resourceGroupName,
config_contract=input
configuration_name=configurationName, resource_group=resourceGroupName, config_contract=input
)

# retrieve the configurations
output = list(self.client.configurations.list_by_resource_group(resource_group = resourceGroupName))[0]
output = list(self.client.configurations.list_by_resource_group(resource_group=resourceGroupName))[0]

# it should be identical to what we just set
assert output.exclude == False

#------------------------------------------------------------------------------
if __name__ == '__main__':

# ------------------------------------------------------------------------------
if __name__ == "__main__":
unittest.main()
Loading
Loading