diff --git a/tools/azure-sdk-tools/ci_tools/parsing/parse_functions.py b/tools/azure-sdk-tools/ci_tools/parsing/parse_functions.py index 994cd5479371..c3f940816335 100644 --- a/tools/azure-sdk-tools/ci_tools/parsing/parse_functions.py +++ b/tools/azure-sdk-tools/ci_tools/parsing/parse_functions.py @@ -330,6 +330,25 @@ def setup(*args, **kwargs): def parse_pyproject( pyproject_filename: str, ) -> Tuple[str, str, str, List[str], bool, str, str, Dict[str, Any], bool, List[str], List[str], str, List[Extension]]: + """ + Used to evaluate a pyproject (or a directory containing a pyproject.toml) with a [project] configuration within. + Returns a tuple containing: + ( + , + , + , + , + , + , + , + , + , + , + , + , + + ) + """ toml_dict = get_pyproject_dict(pyproject_filename) project_config = toml_dict.get("project", None) @@ -351,6 +370,8 @@ def parse_pyproject( parsed_version = parsed_version.group(1) else: parsed_version = "0.0.0" + else: + raise ValueError(f"Unable to find a version value directly set in \"{pyproject_filename}\", nor is it available in a \"version.py\" or \"_version.py.\"") name = project_config.get("name") version = parsed_version @@ -449,6 +470,8 @@ def parse_setup( , ) + + If a pyproject.toml (containing [project]) or a setup.py is NOT found, a ValueError will be raised. """ targeted_path = setup_filename_or_folder if os.path.isfile(setup_filename_or_folder): diff --git a/tools/azure-sdk-tools/tests/integration/scenarios/pyproject_build_config/README.md b/tools/azure-sdk-tools/tests/integration/scenarios/pyproject_build_config/README.md index 4d6a1d44b396..2516773d4c00 100644 --- a/tools/azure-sdk-tools/tests/integration/scenarios/pyproject_build_config/README.md +++ b/tools/azure-sdk-tools/tests/integration/scenarios/pyproject_build_config/README.md @@ -1 +1 @@ -The `pyproject.toml` and `setup.py` files in this folder are used to verify successful azure-sdk build configuration from a parsed setup.py. \ No newline at end of file +The `pyproject.toml` and `setup.py` files in this folder are used to verify successful azure-sdk build configuration from a parsed configuration file. \ No newline at end of file diff --git a/tools/azure-sdk-tools/tests/integration/scenarios/pyproject_project_def_with_extension/pyproject.toml b/tools/azure-sdk-tools/tests/integration/scenarios/pyproject_project_def_with_extension/pyproject.toml index 45fe84ecc6f3..c2b026427fab 100644 --- a/tools/azure-sdk-tools/tests/integration/scenarios/pyproject_project_def_with_extension/pyproject.toml +++ b/tools/azure-sdk-tools/tests/integration/scenarios/pyproject_project_def_with_extension/pyproject.toml @@ -8,7 +8,7 @@ authors = [ {name = "Microsoft Corporation", email = "azurekeyvault@microsoft.com"} ] description = "Microsoft Azure Key Vault Keys Client Library for Python" -requires-python = ">=3.7" +requires-python = ">=3.8" license = {text = "MIT License"} classifiers = [ "Development Status :: 5 - Production/Stable",