diff --git a/eng/emitter-package-lock.json b/eng/emitter-package-lock.json index 54e432921693..e4dc22b4f910 100644 --- a/eng/emitter-package-lock.json +++ b/eng/emitter-package-lock.json @@ -5,7 +5,7 @@ "packages": { "": { "dependencies": { - "@azure-tools/typespec-python": "0.42.2" + "@azure-tools/typespec-python": "0.42.3" }, "devDependencies": { "@azure-tools/typespec-autorest": "~0.54.0", @@ -127,13 +127,13 @@ "dev": true }, "node_modules/@azure-tools/typespec-python": { - "version": "0.42.2", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-python/-/typespec-python-0.42.2.tgz", - "integrity": "sha512-N421iOPt23yTjY5DtdicakPFO8s9DBMMDdnfQl8wgz/VY01osb6oiYSysDI1wUVZrMzS00QwEFkgH7mEViLyEw==", + "version": "0.42.3", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-python/-/typespec-python-0.42.3.tgz", + "integrity": "sha512-ZdC6nERVY3V6yqtJLOlKUoA8jwFx/aE1gXhQW25utH0Tzc+ek3VePOcAHCtV9RBRakVZzc1XLioMWZXPliPahw==", "hasInstallScript": true, "license": "MIT", "dependencies": { - "@typespec/http-client-python": "~0.9.1", + "@typespec/http-client-python": "~0.9.2", "fs-extra": "~11.2.0", "js-yaml": "~4.1.0", "semver": "~7.6.2", @@ -1020,9 +1020,9 @@ } }, "node_modules/@typespec/http-client-python": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/@typespec/http-client-python/-/http-client-python-0.9.1.tgz", - "integrity": "sha512-symHQo4KvdId6fHhN/7biCXQjK915757DVOrMlTuKmDNWaaLoPTK4Y9zgQodsu4mMrkTRiRERHJdjIRFVZYvFg==", + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/@typespec/http-client-python/-/http-client-python-0.9.2.tgz", + "integrity": "sha512-CpLRMV+plAmHcOnaIiKgIJqk/mq4sejPVs/lipt7WllseQydomqcJfyWsQUnZVkqrW7dfl1uyn/AcC5yLxmExA==", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -1617,9 +1617,9 @@ } }, "node_modules/marked": { - "version": "15.0.7", - "resolved": "https://registry.npmjs.org/marked/-/marked-15.0.7.tgz", - "integrity": "sha512-dgLIeKGLx5FwziAnsk4ONoGwHwGPJzselimvlVskE9XLN4Orv9u2VA3GWw/lYUqjfA0rUT/6fqKwfZJapP9BEg==", + "version": "15.0.8", + "resolved": "https://registry.npmjs.org/marked/-/marked-15.0.8.tgz", + "integrity": "sha512-rli4l2LyZqpQuRve5C0rkn6pj3hT8EWPC+zkAxFTAJLxRbENfTAhEQq9itrmf1Y81QtAX5D/MYlGlIomNgj9lA==", "license": "MIT", "bin": { "marked": "bin/marked.js" diff --git a/eng/emitter-package.json b/eng/emitter-package.json index 9cc25c310c15..6a4140a09676 100644 --- a/eng/emitter-package.json +++ b/eng/emitter-package.json @@ -1,7 +1,7 @@ { "main": "dist/src/index.js", "dependencies": { - "@azure-tools/typespec-python": "0.42.2" + "@azure-tools/typespec-python": "0.42.3" }, "devDependencies": { "@typespec/compiler": "^1.0.0-0", diff --git a/scripts/auto_release/PythonSdkLiveTest.yml b/scripts/auto_release/PythonSdkLiveTest.yml index 6987d6754a86..825c3d4bf09c 100644 --- a/scripts/auto_release/PythonSdkLiveTest.yml +++ b/scripts/auto_release/PythonSdkLiveTest.yml @@ -19,14 +19,14 @@ variables: - group: Azure SDK Auto Release Pipeline Secrets jobs: -- job: LiveTestPython310 - displayName: Live Test Python 3.10 +- job: LiveTestPython + displayName: Live Test Python timeoutInMinutes: 1500 strategy: maxParallel: 5 pool: - name: azsdk-pool-mms-ubuntu-2004-general - vmImage: 'ubuntu-20.04' + name: azsdk-pool + vmImage: 'ubuntu-22.04' variables: Codeql.Enabled: false steps: @@ -35,6 +35,10 @@ jobs: versionSpec: '3.10' addToPath: true architecture: 'x64' + - task: NodeTool@0 + displayName: Install Node.js + inputs: + versionSpec: 22.x - bash: | python scripts/dev_setup.py -p azure-core cd .. diff --git a/scripts/collect_api_version_for_multi_api_sdk/README.md b/scripts/collect_api_version_for_multi_api_sdk/README.md deleted file mode 100644 index 2fd430918c5c..000000000000 --- a/scripts/collect_api_version_for_multi_api_sdk/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Overview -This folder contains collecting the multi API versions in use from: -- https://github.com/Azure/azure-cli/blob/dev/src/azure-cli-core/azure/cli/core/profiles/_shared.py -- https://github.com/Azure/azure-rest-api-specs/tree/main/profiles/definitions -- https://github.com/Azure/azure-rest-api-specs/tree/main/profile - -## `main.py` -the script could help to collect all the Api Versions used by Azure CLI and Azure Stack. - -### Usage -``` -pip install -r requirement.txt -python main.py -``` - -### Tip -if you don't want to upload result to github, you could comment out the `upload_to_github` function in `main.py` before running it. diff --git a/scripts/collect_api_version_for_multi_api_sdk/collect_api_version.yml b/scripts/collect_api_version_for_multi_api_sdk/collect_api_version.yml deleted file mode 100644 index 003724854180..000000000000 --- a/scripts/collect_api_version_for_multi_api_sdk/collect_api_version.yml +++ /dev/null @@ -1,52 +0,0 @@ - -trigger: - branches: - exclude: - - '*' - -# avoid being triggered as part of CI check -pr: - branches: - exclude: - - '*' - - -variables: - - group: Azure SDK Auto Release Pipeline Secrets - - group: SDK Release Helper - -jobs: -- job: CollectApiVersion - displayName: CollectApiVersion - timeoutInMinutes: 30 - strategy: - maxParallel: 1 - pool: - name: azsdk-pool-mms-ubuntu-2004-general - vmImage: 'ubuntu-20.04' - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.8' - addToPath: true - architecture: 'x64' - - bash: | - script_path=$(pwd)/scripts/collect_api_version_for_multi_api_sdk - cd .. - git config --global user.email "PythonSdkPipelines" - git config --global user.name "PythonSdkPipelines" - mkdir file-storage - git clone ${FILE_REPO:0:8}$(USR_NAME):$(Yuchao-GitToken)@${FILE_REPO:8} $(pwd)/file-storage - - # import env variable - export TOKEN=$(Yuchao-GitToken) - - # create virtual env - python -m venv venv-sdk - source venv-sdk/bin/activate - python -m pip install -r $script_path/requirement.txt - - # run - cd file-storage - git checkout collect-api-version - python $script_path/main.py diff --git a/scripts/collect_api_version_for_multi_api_sdk/main.py b/scripts/collect_api_version_for_multi_api_sdk/main.py deleted file mode 100644 index f3142deac8b3..000000000000 --- a/scripts/collect_api_version_for_multi_api_sdk/main.py +++ /dev/null @@ -1,204 +0,0 @@ -import os -import re -import json -import logging -import subprocess - -import yaml -from pathlib import Path -from typing import Any, Set, Dict -from github import Github -from tempfile import TemporaryDirectory -import importlib.util - -from github.GithubException import UnknownObjectException - -_LOG = logging.getLogger() - -SOURCE_FILE = { - "azure-cli": "https://github.com/Azure/azure-cli/blob/dev/src/azure-cli-core/azure/cli/core/profiles/_shared.py", - "rest-api-profiles": "https://github.com/Azure/azure-rest-api-specs/tree/main/profiles/definitions", - "rest-api-profile": "https://github.com/Azure/azure-rest-api-specs/tree/main/profile", - "rest-api-specification": "https://github.com/Azure/azure-rest-api-specs/tree/main/specification", -} - - -class CollectApiVersion: - """ - This class can collect api-version that may be used by azure stack - """ - - def __init__(self): - self.github = Github(os.getenv("TOKEN")) - self.rest_repo = self.github.get_repo("Azure/azure-rest-api-specs") - self.package_api_version = {} - self.multi_api_version_from_profiles = {} - self.multi_api_version_from_profile = {} - self.provider_mapping_package = {} - self.output_files = { - "package_api_version": "package_api_version_from_cli.json", - "multi_api_version_from_profiles": "package_api_version_from_profiles.json", - "multi_api_version_from_profile": "package_api_version_from_profile.json", - } - - def get_api_version_from_azure_cli(self): - # read content from github - url_path = SOURCE_FILE["azure-cli"] - cli_repo = self.github.get_repo("Azure/azure-cli") - git_path = url_path.split("dev/")[-1] - file_content = cli_repo.get_contents(git_path) - - # write to temp file - temp_dir = TemporaryDirectory() - file_name = str(Path(f"{temp_dir.name}/cli.py")) - with open(file_name, "wb") as file_in: - file_in.write(file_content.decoded_content) - - # import target object that contains api-version - module_name = "AZURE_API_PROFILES" - spec = importlib.util.spec_from_file_location(module_name, file_name) - foo = importlib.util.module_from_spec(spec) - spec.loader.exec_module(foo) - version_dict = getattr(foo, module_name) - - # extract api version - for info in version_dict.values(): - for package_info in info: - package_name = package_info.import_prefix - if re.search("azure.mgmt.", package_name): - api_version = self.extract_api_version(info[package_info]) - # eg: change them like azure.mgmt.resource to azure-mgmt-resource - package_name = package_name.replace(".", "-") - if package_name not in self.package_api_version: - self.package_api_version[package_name] = set() - self.package_api_version[package_name].update(api_version) - - def get_multiapi_from_rest_api(self): - # map provider to package name, like: {'microsoft.insights': {'azure-mgmt-applicationinsights'}} - url_path = SOURCE_FILE["rest-api-specification"] - git_path = url_path.split("main/")[-1] - service_paths = self.rest_repo.get_contents(git_path) - packge_pattern = re.compile(b"package-name: (azure-mgmt-.*?)\n") - for service_path in service_paths: - try: - resource_manager = self.rest_repo.get_contents(f"{service_path.path}/resource-manager") - except UnknownObjectException: - continue - package_name, providers, multi_api_readme_python = "", set(), False - for resource in resource_manager: - if "Microsoft." in resource.name: - providers.add(resource.name.lower()) - if "readme.python.md" in resource.name: - if b"multiapiscript: true" not in resource.decoded_content: - break - multi_api_readme_python = True - package_name_line = re.search(packge_pattern, resource.decoded_content) - package_name = package_name_line.groups()[0].decode(encoding="utf-8") - if not multi_api_readme_python: - continue - for n in providers: - if not self.provider_mapping_package.get(n): - self.provider_mapping_package[n] = {package_name, } - else: - self.provider_mapping_package[n].add(package_name) - - def find_versions_from_json(self, provider: str, version: Dict[str, Any], multi_api_version: Dict): - if self.provider_mapping_package.get(provider): - for p in self.provider_mapping_package.get(provider): - if not multi_api_version.get(p): - multi_api_version[p] = set(version.keys()) - else: - multi_api_version[p].update(set(version.keys())) - - def get_api_version_from_rest_api_profiles(self): - self.get_multiapi_from_rest_api() - # Find api version mapping to {'azure-mgmt-msi': {'2018-11-30'}} - url_path = SOURCE_FILE["rest-api-profiles"] - git_path = url_path.split("main/")[-1] - file_paths = self.rest_repo.get_contents(git_path) - for file in file_paths: - file_name, file_contents = file.name.replace(".md", ""), file.decoded_content - profiles_content = str(file_contents).split("profiles:")[1].split("operations:")[0] - profiles_content = profiles_content.strip(r"\n").strip().replace(r"\n", "\n") - # Convert to JSON format - content_dict = yaml.load(profiles_content, Loader=yaml.FullLoader) - for provider, version in content_dict[file_name]["resources"].items(): - self.find_versions_from_json(provider, version, self.multi_api_version_from_profiles) - - def get_api_version_from_rest_api_profile(self): - if not self.provider_mapping_package: - self.get_multiapi_from_rest_api() - # map package name to api version like {'azure-mgmt-msi': {'2018-11-30'}} - url_path = SOURCE_FILE["rest-api-profile"] - git_path = url_path.split("main/")[-1] - file_paths = self.rest_repo.get_contents(git_path) - for file in file_paths: - if ".json" not in file.name: - continue - file_name, file_contents = (file.name.replace(".json", ""), file.decoded_content) - content_dict = json.loads(file_contents.decode()) - resource_manager = "resource-manager" if content_dict.get("resource-manager") else "resourcemanager" - for provider, version in content_dict[resource_manager].items(): - self.find_versions_from_json(provider, version, self.multi_api_version_from_profile) - - @staticmethod - def extract_api_version(api_version_info: Any) -> Set[str]: - # convert to string - if isinstance(api_version_info, str): - api_version = api_version_info - else: - api_version = api_version_info.default_api_version + str(api_version_info.profile) - - return set(re.findall(r"\d{4}-\d{2}-\d{2}[-a-z]*", api_version)) - - @staticmethod - def write_file(file_name, content): - json_out = {k: sorted(content[k], reverse=True) for k in content} - with open(file_name, "w") as file_out: - json.dump(json_out, file_out, indent=4) - - def output(self): - # output service and api version from cli or profiles or profile - for k, v in self.output_files.items(): - self.write_file(v, getattr(self, k)) - # merge multi_api_version_from_profiles to package_api_version - for k, v in self.multi_api_version_from_profiles.items(): - self.package_api_version[k] = self.package_api_version[k] | v if self.package_api_version.get(k) else v - # merge multi_api_version_from_profile to package_api_version - for k, v in self.multi_api_version_from_profile.items(): - self.package_api_version[k] = self.package_api_version[k] | v if self.package_api_version.get(k) else v - - # output all apiversion - self.write_file("package_api_version_all.json", self.package_api_version) - - def run(self): - self.get_api_version_from_azure_cli() - self.get_api_version_from_rest_api_profiles() - self.get_api_version_from_rest_api_profile() - self.output() - - -def print_exec(cmd): - _LOG.info("==" + cmd + " ==\n") - subprocess.call(cmd, shell=True) - - -def print_check(cmd): - _LOG.info("==" + cmd + " ==\n") - subprocess.check_call(cmd, shell=True) - - -def upload_to_github(): - print_exec("git add .") - print_exec('git commit -m "update json files"') - print_check("git push origin HEAD -f") - - -if __name__ == "__main__": - main_logger = logging.getLogger() - logging.basicConfig() - main_logger.setLevel(logging.INFO) - - instance = CollectApiVersion() - instance.run() - upload_to_github() diff --git a/scripts/collect_api_version_for_multi_api_sdk/requirement.txt b/scripts/collect_api_version_for_multi_api_sdk/requirement.txt deleted file mode 100644 index 42999fc207b6..000000000000 --- a/scripts/collect_api_version_for_multi_api_sdk/requirement.txt +++ /dev/null @@ -1,2 +0,0 @@ -PyGithub==1.55 -knack==0.9.0 \ No newline at end of file diff --git a/scripts/issue_helper/issue_helper.yml b/scripts/issue_helper/issue_helper.yml index 9d0799b5ebcc..9c9fc504101a 100644 --- a/scripts/issue_helper/issue_helper.yml +++ b/scripts/issue_helper/issue_helper.yml @@ -25,18 +25,18 @@ variables: - group: SDK Release Helper jobs: -- job: IssueHelper - displayName: IssueHelper Python 3.8 +- job: IssueHelper 3.9 + displayName: IssueHelper Python timeoutInMinutes: 30 strategy: maxParallel: 3 pool: - name: azsdk-pool-mms-ubuntu-2004-general - vmImage: 'ubuntu-20.04' + name: azsdk-pool + vmImage: 'ubuntu-22.04' steps: - task: UsePythonVersion@0 inputs: - versionSpec: '3.8' + versionSpec: '3.9' addToPath: true architecture: 'x64' - bash: | diff --git a/scripts/release_helper/release_helper.yml b/scripts/release_helper/release_helper.yml index 770414dfcd80..a41c02202af8 100644 --- a/scripts/release_helper/release_helper.yml +++ b/scripts/release_helper/release_helper.yml @@ -30,19 +30,19 @@ variables: jobs: - job: ReleaseHelper - displayName: ReleaseHelper Python 3.8 + displayName: ReleaseHelper Python 3.9 timeoutInMinutes: 30 strategy: maxParallel: 1 pool: - name: azsdk-pool-mms-ubuntu-2004-general - vmImage: 'ubuntu-20.04' + name: azsdk-pool + vmImage: 'ubuntu-22.04' variables: Codeql.Enabled: false steps: - task: UsePythonVersion@0 inputs: - versionSpec: '3.8' + versionSpec: '3.9' addToPath: true architecture: 'x64' - bash: | @@ -54,7 +54,7 @@ jobs: # clone(REPO: https://github.com/Azure/azure-sdk-for-python.git, USR_NAME: Azure, USR_TOKEN: xxxxxxxxxxxxx) mkdir file-storage git clone ${FILE_REPO:0:8}$(USR_NAME):$(Yuchao-GitToken)@${FILE_REPO:8} $(pwd)/file-storage - + mkdir azure-rest-api-specs git clone -b $(SPEC_BRANCH) https://github.com/Azure/azure-rest-api-specs.git $(pwd)/azure-rest-api-specs diff --git a/scripts/release_sdk_status/release_sdk_status.yml b/scripts/release_sdk_status/release_sdk_status.yml index 6d3dd482f4d7..9cf8b6214e77 100644 --- a/scripts/release_sdk_status/release_sdk_status.yml +++ b/scripts/release_sdk_status/release_sdk_status.yml @@ -29,17 +29,17 @@ variables: jobs: - job: ReleaseSdkStatus - displayName: ReleaseSdkStatus Python 3.8 + displayName: ReleaseSdkStatus Python 3.9 timeoutInMinutes: 300 strategy: maxParallel: 1 pool: - name: azsdk-pool-mms-ubuntu-2004-general - vmImage: 'ubuntu-20.04' + name: azsdk-pool + vmImage: 'ubuntu-22.04' steps: - task: UsePythonVersion@0 inputs: - versionSpec: '3.8' + versionSpec: '3.9' addToPath: true architecture: 'x64' - bash: | diff --git a/swagger_to_sdk_config_autorest.json b/swagger_to_sdk_config_autorest.json index 8370f05d866c..f5c734b1b97f 100644 --- a/swagger_to_sdk_config_autorest.json +++ b/swagger_to_sdk_config_autorest.json @@ -2,7 +2,7 @@ "meta": { "autorest_options": { "version": "3.10.2", - "use": ["@autorest/python@6.27.4", "@autorest/modelerfour@4.27.0"], + "use": ["@autorest/python@6.32.3", "@autorest/modelerfour@4.27.0"], "python": "", "sdkrel:python-sdks-folder": "./sdk/.", "version-tolerant": false, diff --git a/swagger_to_sdk_config_dpg.json b/swagger_to_sdk_config_dpg.json index 89fbd5f3a633..ad101039de6a 100644 --- a/swagger_to_sdk_config_dpg.json +++ b/swagger_to_sdk_config_dpg.json @@ -2,7 +2,7 @@ "meta": { "autorest_options": { "version": "3.10.2", - "use": ["@autorest/python@6.27.4", "@autorest/modelerfour@4.27.0"] + "use": ["@autorest/python@6.32.3", "@autorest/modelerfour@4.27.0"] }, "advanced_options": { "create_sdk_pull_requests": true, diff --git a/tools/azure-sdk-tools/packaging_tools/templates/packaging_files/README.md b/tools/azure-sdk-tools/packaging_tools/templates/packaging_files/README.md index 279250938cf9..001c867d0b97 100644 --- a/tools/azure-sdk-tools/packaging_tools/templates/packaging_files/README.md +++ b/tools/azure-sdk-tools/packaging_tools/templates/packaging_files/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure {{package_pprint_name}} Client Library. -This package has been tested with Python 3.8+. +This package has been tested with Python 3.9+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.8+ is required to use this package. +- Python 3.9+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package diff --git a/tools/azure-sdk-tools/packaging_tools/templates/packaging_files/setup.py b/tools/azure-sdk-tools/packaging_tools/templates/packaging_files/setup.py index 2169b11ab791..7b4716c5bf25 100644 --- a/tools/azure-sdk-tools/packaging_tools/templates/packaging_files/setup.py +++ b/tools/azure-sdk-tools/packaging_tools/templates/packaging_files/setup.py @@ -53,7 +53,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -91,5 +90,5 @@ "azure-mgmt-core>=1.3.2", {%- endif %} ], - python_requires=">=3.8", + python_requires=">=3.9", )