diff --git a/README.md b/README.md index 698f964..21cf90d 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ in the library's project folder. ### Prerequisites -The libraries are supported on Function Apps using Python 3.9 or later. For more details, please read our page on +The libraries are supported on Function Apps using Python 3.10 or later. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). ## SDK Support diff --git a/azurefunctions-extensions-base/pyproject.toml b/azurefunctions-extensions-base/pyproject.toml index c5a4051..a373abd 100644 --- a/azurefunctions-extensions-base/pyproject.toml +++ b/azurefunctions-extensions-base/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "azurefunctions-extensions-base" dynamic = ["version"] -requires-python = ">=3.8" +requires-python = ">=3.10" authors = [{ name = "Azure Functions team at Microsoft Corp.", email = "azurefunctions@microsoft.com"}] description = "Base Python worker extension for Azure Functions." readme = "README.md" @@ -29,7 +29,7 @@ classifiers= [ dev = [ 'flake8', 'mypy', - 'pytest', + 'pytest>=9.0.3', 'pytest-cov', 'coverage', 'pytest-instafail', diff --git a/azurefunctions-extensions-bindings-blob/README.md b/azurefunctions-extensions-bindings-blob/README.md index eb40c8b..2d227dd 100644 --- a/azurefunctions-extensions-bindings-blob/README.md +++ b/azurefunctions-extensions-bindings-blob/README.md @@ -17,7 +17,7 @@ Blob client types can be generated from: ## Getting started ### Prerequisites -* Python 3.9 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). +* Python 3.10 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). * You must have an [Azure subscription](https://azure.microsoft.com/free/) and an [Azure storage account](https://docs.microsoft.com/azure/storage/common/storage-account-overview) to use this package. diff --git a/azurefunctions-extensions-bindings-blob/pyproject.toml b/azurefunctions-extensions-bindings-blob/pyproject.toml index 0620b17..005de01 100644 --- a/azurefunctions-extensions-bindings-blob/pyproject.toml +++ b/azurefunctions-extensions-bindings-blob/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "azurefunctions-extensions-bindings-blob" dynamic = ["version"] -requires-python = ">=3.9" +requires-python = ">=3.10" authors = [{ name = "Azure Functions team at Microsoft Corp.", email = "azurefunctions@microsoft.com"}] description = "Blob Python worker extension for Azure Functions." readme = "README.md" @@ -34,7 +34,7 @@ dependencies = [ dev = [ 'flake8', 'mypy', - 'pytest', + 'pytest>=9.0.3', 'pytest-cov', 'coverage', 'pytest-instafail', diff --git a/azurefunctions-extensions-bindings-blob/samples/README.md b/azurefunctions-extensions-bindings-blob/samples/README.md index 96e0743..a497269 100644 --- a/azurefunctions-extensions-bindings-blob/samples/README.md +++ b/azurefunctions-extensions-bindings-blob/samples/README.md @@ -30,7 +30,7 @@ examples on how to use the Azure Storage Blob client library, please see [Azure * From BlobInput ## Prerequisites -* Python 3.9 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). +* Python 3.10 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). * You must have an [Azure subscription](https://azure.microsoft.com/free/) and an [Azure storage account](https://docs.microsoft.com/azure/storage/common/storage-account-overview) to use this package. diff --git a/azurefunctions-extensions-bindings-cosmosdb/README.md b/azurefunctions-extensions-bindings-cosmosdb/README.md index 176292d..283bf53 100644 --- a/azurefunctions-extensions-bindings-cosmosdb/README.md +++ b/azurefunctions-extensions-bindings-cosmosdb/README.md @@ -14,7 +14,7 @@ Cosmos DB client types can be generated from: ## Getting started ### Prerequisites -* Python 3.9 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). +* Python 3.10 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). * You must have an [Azure subscription](https://azure.microsoft.com/free/) and an [Azure storage account](https://docs.microsoft.com/azure/storage/common/storage-account-overview) to use this package. diff --git a/azurefunctions-extensions-bindings-cosmosdb/pyproject.toml b/azurefunctions-extensions-bindings-cosmosdb/pyproject.toml index 863d75a..e12287d 100644 --- a/azurefunctions-extensions-bindings-cosmosdb/pyproject.toml +++ b/azurefunctions-extensions-bindings-cosmosdb/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "azurefunctions-extensions-bindings-cosmosdb" dynamic = ["version"] -requires-python = ">=3.9" +requires-python = ">=3.10" authors = [{ name = "Azure Functions team at Microsoft Corp.", email = "azurefunctions@microsoft.com"}] description = "Cosmos DB Python worker extension for Azure Functions." readme = "README.md" @@ -32,7 +32,7 @@ dependencies = [ [project.optional-dependencies] dev = [ - 'pytest', + 'pytest>=9.0.3', 'pytest-cov', 'coverage', 'pytest-instafail', diff --git a/azurefunctions-extensions-bindings-cosmosdb/samples/README.md b/azurefunctions-extensions-bindings-cosmosdb/samples/README.md index dec6d4e..226e8e5 100644 --- a/azurefunctions-extensions-bindings-cosmosdb/samples/README.md +++ b/azurefunctions-extensions-bindings-cosmosdb/samples/README.md @@ -27,7 +27,7 @@ examples on how to use the Azure Storage Cosmos DB client library, please see [A * From CosmosDBInput ## Prerequisites -* Python 3.9 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). +* Python 3.10 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). * You must have an [Azure subscription](https://azure.microsoft.com/free/) and an [Azure storage account](https://docs.microsoft.com/azure/storage/common/storage-account-overview) to use this package. diff --git a/azurefunctions-extensions-bindings-eventhub/README.md b/azurefunctions-extensions-bindings-eventhub/README.md index 6221d2f..acbb490 100644 --- a/azurefunctions-extensions-bindings-eventhub/README.md +++ b/azurefunctions-extensions-bindings-eventhub/README.md @@ -18,7 +18,7 @@ The supported EventHub SDK types include: ## Getting started ### Prerequisites -* Python 3.9 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). +* Python 3.10 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). * You must have an [Azure subscription](https://azure.microsoft.com/free/) and an [Azure storage account](https://docs.microsoft.com/azure/storage/common/storage-account-overview) to use this package. diff --git a/azurefunctions-extensions-bindings-eventhub/pyproject.toml b/azurefunctions-extensions-bindings-eventhub/pyproject.toml index 6c7d7de..b5161b3 100644 --- a/azurefunctions-extensions-bindings-eventhub/pyproject.toml +++ b/azurefunctions-extensions-bindings-eventhub/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "azurefunctions-extensions-bindings-eventhub" dynamic = ["version"] -requires-python = ">=3.9" +requires-python = ">=3.10" authors = [{ name = "Azure Functions team at Microsoft Corp.", email = "azurefunctions@microsoft.com"}] description = "EventHub Python worker extension for Azure Functions." readme = "README.md" @@ -31,7 +31,7 @@ dependencies = [ [project.optional-dependencies] dev = [ - 'pytest', + 'pytest>=9.0.3', 'pytest-cov', 'coverage', 'pytest-instafail', diff --git a/azurefunctions-extensions-bindings-eventhub/samples/README.md b/azurefunctions-extensions-bindings-eventhub/samples/README.md index b543a24..71926aa 100644 --- a/azurefunctions-extensions-bindings-eventhub/samples/README.md +++ b/azurefunctions-extensions-bindings-eventhub/samples/README.md @@ -21,7 +21,7 @@ examples on how to use the Azure EventHub library, please see [Azure EventHub sa * From EventHubTrigger ## Prerequisites -* Python 3.9 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). +* Python 3.10 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). * You must have an [Azure subscription](https://azure.microsoft.com/free/) and an [Azure storage account](https://docs.microsoft.com/azure/storage/common/storage-account-overview) to use this package. diff --git a/azurefunctions-extensions-bindings-servicebus/README.md b/azurefunctions-extensions-bindings-servicebus/README.md index 0326d87..7e87fff 100644 --- a/azurefunctions-extensions-bindings-servicebus/README.md +++ b/azurefunctions-extensions-bindings-servicebus/README.md @@ -19,7 +19,7 @@ The supported ServiceBus SDK types include: ## Getting started ### Prerequisites -* Python 3.9 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). +* Python 3.10 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). * You must have an [Azure subscription](https://azure.microsoft.com/free/) and a [ServiceBus Resource](https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus?tabs=isolated-process%2Cextensionv5%2Cextensionv3&pivots=programming-language-python) to use this package. diff --git a/azurefunctions-extensions-bindings-servicebus/pyproject.toml b/azurefunctions-extensions-bindings-servicebus/pyproject.toml index 1214930..8cd2810 100644 --- a/azurefunctions-extensions-bindings-servicebus/pyproject.toml +++ b/azurefunctions-extensions-bindings-servicebus/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "azurefunctions-extensions-bindings-servicebus" dynamic = ["version"] -requires-python = ">=3.9" +requires-python = ">=3.10" authors = [{ name = "Azure Functions team at Microsoft Corp.", email = "azurefunctions@microsoft.com"}] description = "ServiceBus Python worker extension for Azure Functions." readme = "README.md" @@ -37,7 +37,7 @@ dependencies = [ dev = [ 'flake8', 'mypy', - 'pytest', + 'pytest>=9.0.3', 'pytest-cov', 'coverage', 'pytest-instafail', diff --git a/azurefunctions-extensions-bindings-servicebus/samples/README.md b/azurefunctions-extensions-bindings-servicebus/samples/README.md index 947f5f3..4e81fbb 100644 --- a/azurefunctions-extensions-bindings-servicebus/samples/README.md +++ b/azurefunctions-extensions-bindings-servicebus/samples/README.md @@ -26,7 +26,7 @@ examples on how to use the Azure ServiceBus client library, please see [Azure Se ## Prerequisites -* Python 3.9 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). +* Python 3.10 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). ## Setup diff --git a/azurefunctions-extensions-connectors/README.md b/azurefunctions-extensions-connectors/README.md index c28cc32..99544a1 100644 --- a/azurefunctions-extensions-connectors/README.md +++ b/azurefunctions-extensions-connectors/README.md @@ -16,7 +16,7 @@ Office365 client types can be generated from: ## Getting started ### Prerequisites -* Python 3.9 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). +* Python 3.10 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). * You must have an [Azure subscription](https://azure.microsoft.com/free/) and an Office365 account to use this package. diff --git a/azurefunctions-extensions-connectors/pyproject.toml b/azurefunctions-extensions-connectors/pyproject.toml index b4b50f7..ebc1b3b 100644 --- a/azurefunctions-extensions-connectors/pyproject.toml +++ b/azurefunctions-extensions-connectors/pyproject.toml @@ -33,7 +33,7 @@ dependencies = [ dev = [ 'flake8', 'mypy', - 'pytest', + 'pytest>=9.0.3', 'pytest-cov', 'coverage', 'pytest-instafail', diff --git a/azurefunctions-extensions-http-fastapi/README.md b/azurefunctions-extensions-http-fastapi/README.md index 640cc90..84ea17d 100644 --- a/azurefunctions-extensions-http-fastapi/README.md +++ b/azurefunctions-extensions-http-fastapi/README.md @@ -10,7 +10,7 @@ This library contains HttpV2 extensions for FastApi Request/Response types to us ## Getting started ### Prerequisites -* Python 3.8 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). +* Python 3.10 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). ### Instructions diff --git a/azurefunctions-extensions-http-fastapi/pyproject.toml b/azurefunctions-extensions-http-fastapi/pyproject.toml index 14cf00b..4a965e9 100644 --- a/azurefunctions-extensions-http-fastapi/pyproject.toml +++ b/azurefunctions-extensions-http-fastapi/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "azurefunctions-extensions-http-fastapi" dynamic = ["version"] -requires-python = ">=3.8" +requires-python = ">=3.10" authors = [{ name = "Azure Functions team at Microsoft Corp.", email = "azurefunctions@microsoft.com"}] description = "FastApi Python worker extension for Azure Functions." readme = "README.md" @@ -26,7 +26,7 @@ classifiers= [ ] dependencies = [ 'azurefunctions-extensions-base', - 'fastapi>=0.115.0,<1.0', + 'fastapi>=0.141.1,<1.0', 'uvicorn>=0.32.0,<1.0', 'pydantic>=2.10.0,<3.0', ] @@ -35,7 +35,7 @@ dependencies = [ dev = [ 'flake8', 'mypy', - 'pytest', + 'pytest>=9.0.3', 'pytest-cov', 'coverage', 'pytest-instafail', diff --git a/azurefunctions-extensions-http-fastapi/samples/README.md b/azurefunctions-extensions-http-fastapi/samples/README.md index c0f9d53..6c20b60 100644 --- a/azurefunctions-extensions-http-fastapi/samples/README.md +++ b/azurefunctions-extensions-http-fastapi/samples/README.md @@ -22,7 +22,7 @@ information on FastAPI, please see the [FastApi documentation](https://fastapi.t * [fastapi_samples_streaming_download](https://github.com/Azure/azure-functions-python-extensions/tree/dev/azurefunctions-extensions-http-fastapi/samples/fastapi_samples_streaming_download) - An example on how to send your HTTP response via streaming to the caller. ## Prerequisites -* Python 3.8 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). +* Python 3.10 or later is required to use this package. For more details, please read our page on [Python Functions version support policy](https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=isolated-process%2Cv4&pivots=programming-language-python#languages). ## Setup diff --git a/eng/ci/extension-release.yml b/eng/ci/extension-release.yml index d189be8..ac5b966 100644 --- a/eng/ci/extension-release.yml +++ b/eng/ci/extension-release.yml @@ -22,6 +22,11 @@ extends: name: 1es-pool-azfunc image: 1es-windows-2022 os: windows + sdl: + componentgovernance: + alertWarningLevel: Medium + failOnAlert: true + verbosity: Normal stages: - stage: Release diff --git a/eng/ci/official-build.yml b/eng/ci/official-build.yml index ec0c832..34e291b 100644 --- a/eng/ci/official-build.yml +++ b/eng/ci/official-build.yml @@ -38,6 +38,11 @@ extends: name: 1es-pool-azfunc image: 1es-windows-2022 os: windows + sdl: + componentgovernance: + alertWarningLevel: Medium + failOnAlert: true + verbosity: Normal stages: - stage: Build diff --git a/eng/ci/public-build.yml b/eng/ci/public-build.yml index fca91a3..30e2f9d 100644 --- a/eng/ci/public-build.yml +++ b/eng/ci/public-build.yml @@ -36,6 +36,10 @@ extends: compiled: enabled: true # still only runs for default branch runSourceLanguagesInSourceAnalysis: true + componentgovernance: + alertWarningLevel: Medium + failOnAlert: true + verbosity: Normal settings: skipBuildTagsForGitHubPullRequests: ${{ variables['System.PullRequest.IsFork'] }} diff --git a/eng/templates/official/jobs/publish-release.yml b/eng/templates/official/jobs/publish-release.yml index 59a1a34..df8cced 100644 --- a/eng/templates/official/jobs/publish-release.yml +++ b/eng/templates/official/jobs/publish-release.yml @@ -219,6 +219,9 @@ jobs: displayName: 'Use Python 3.11' inputs: versionSpec: 3.11 + - template: /eng/templates/steps/component-governance.yml@self + parameters: + projectDirectory: $(ExtensionName) - pwsh: | $newLibraryVersion = "$(NewLibraryVersion)" $pypiToken = "$(PypiToken)" diff --git a/eng/templates/official/jobs/unit-tests.yml b/eng/templates/official/jobs/unit-tests.yml index 3146443..325e40b 100644 --- a/eng/templates/official/jobs/unit-tests.yml +++ b/eng/templates/official/jobs/unit-tests.yml @@ -5,9 +5,6 @@ parameters: - name: python_versions type: object default: - # 3.8 is EOL. Don't run tests for it - python39: - PYTHON_VERSION: '3.9' python310: PYTHON_VERSION: '3.10' python311: @@ -33,6 +30,9 @@ jobs: - task: UsePythonVersion@0 inputs: versionSpec: $(PYTHON_VERSION) + - template: /eng/templates/steps/component-governance.yml@self + parameters: + projectDirectory: azurefunctions-extensions-base - bash: | python -m pip install --upgrade pip cd azurefunctions-extensions-base @@ -57,6 +57,9 @@ jobs: - task: UsePythonVersion@0 inputs: versionSpec: $(PYTHON_VERSION) + - template: /eng/templates/steps/component-governance.yml@self + parameters: + projectDirectory: azurefunctions-extensions-bindings-blob - bash: | python -m pip install --upgrade pip cd azurefunctions-extensions-bindings-blob @@ -89,6 +92,9 @@ jobs: - task: UsePythonVersion@0 inputs: versionSpec: $(PYTHON_VERSION) + - template: /eng/templates/steps/component-governance.yml@self + parameters: + projectDirectory: azurefunctions-extensions-bindings-cosmosdb - bash: | python -m pip install --upgrade pip cd azurefunctions-extensions-bindings-cosmosdb @@ -116,6 +122,9 @@ jobs: - task: UsePythonVersion@0 inputs: versionSpec: $(PYTHON_VERSION) + - template: /eng/templates/steps/component-governance.yml@self + parameters: + projectDirectory: azurefunctions-extensions-bindings-eventhub - bash: | python -m pip install --upgrade pip cd azurefunctions-extensions-bindings-eventhub @@ -140,6 +149,9 @@ jobs: - task: UsePythonVersion@0 inputs: versionSpec: $(PYTHON_VERSION) + - template: /eng/templates/steps/component-governance.yml@self + parameters: + projectDirectory: azurefunctions-extensions-http-fastapi - bash: | python -m pip install --upgrade pip cd azurefunctions-extensions-http-fastapi @@ -164,6 +176,9 @@ jobs: - task: UsePythonVersion@0 inputs: versionSpec: $(PYTHON_VERSION) + - template: /eng/templates/steps/component-governance.yml@self + parameters: + projectDirectory: azurefunctions-extensions-bindings-servicebus - bash: | python -m pip install --upgrade pip cd azurefunctions-extensions-bindings-servicebus @@ -188,13 +203,14 @@ jobs: - task: UsePythonVersion@0 inputs: versionSpec: $(PYTHON_VERSION) + - template: /eng/templates/steps/component-governance.yml@self + parameters: + projectDirectory: azurefunctions-extensions-connectors - bash: | python -m pip install --upgrade pip cd azurefunctions-extensions-connectors python -m pip install -U -e .[dev] displayName: 'Install Connectors Dependencies' - condition: ne(variables['PYTHON_VERSION'], '3.9') - bash: | python -m pytest -q --instafail azurefunctions-extensions-connectors/tests/ displayName: "Running Connectors $(PYTHON_VERSION) Python Extension Tests" - condition: ne(variables['PYTHON_VERSION'], '3.9') \ No newline at end of file diff --git a/eng/templates/steps/component-governance.yml b/eng/templates/steps/component-governance.yml new file mode 100644 index 0000000..23feba7 --- /dev/null +++ b/eng/templates/steps/component-governance.yml @@ -0,0 +1,44 @@ +parameters: + - name: projectDirectory + type: string + +steps: + - bash: | + if ! python -c "import tomllib" 2>/dev/null; then + python -m pip install tomli + fi + + python - <<'PY' + from pathlib import Path + + try: + import tomllib + except ModuleNotFoundError: + import tomli as tomllib + + pyproject_path = Path("pyproject.toml") + pyproject = tomllib.loads(pyproject_path.read_text(encoding="utf-8")) + optional_dependencies = pyproject["project"].get( + "optional-dependencies", {} + ) + requirements = [ + *pyproject["build-system"].get("requires", []), + *pyproject["project"].get("dependencies", []), + *( + dependency + for group in optional_dependencies.values() + for dependency in group + ), + ] + requirements = list(dict.fromkeys(requirements)) + Path("requirements.txt").write_text( + "\n".join(requirements) + "\n", + encoding="utf-8", + ) + print( + f"Generated requirements.txt with " + f"{len(requirements)} direct dependencies" + ) + PY + displayName: 'Generate Component Governance requirements' + workingDirectory: $(Build.SourcesDirectory)/${{ parameters.projectDirectory }} \ No newline at end of file