diff --git a/QA/for_ci/test-cases-for-python.md b/QA/for_ci/test-cases-for-python.md new file mode 100644 index 000000000000..92b43a17d8b6 --- /dev/null +++ b/QA/for_ci/test-cases-for-python.md @@ -0,0 +1,182 @@ +# Python SDK gen failing on relative tsp path + +## question +This is my 1st time trying to create our Python SDK. The pipeline appears to be failing due to relative paths for included tsp files. Any idea how to get around this? + +``` +Errors occurred while generating SDK from specification/discoverydev/Discovery.Workspace/tspconfig.yaml. Follow the steps at https://aka.ms/azsdk/sdk-automation-faq#how-to-view-the-detailed-sdk-generation-errors to view detailed errors. +2025-10-08 16:27:29 [ERROR] ====== Error occurred in tsp compiler (error stack start) ====== +2025-10-08 16:27:29 [ERROR] /mnt/vss/_work/1/s/azure-sdk-for-python-pr/sdk/discovery-workspace/azure-discovery-workspace/TempTypeSpecFiles/Discovery.Workspace/common.tsp:1:1 - error import-not-found: Couldn't resolve import "../Discovery.Shared/namespace.tsp" +2025-10-08 16:27:29 [ERROR] /mnt/vss/_work/1/s/azure-sdk-for-python-pr/sdk/discovery-workspace/azure-discovery-workspace/TempTypeSpecFiles/Discovery.Workspace/common.tsp:3:1 - error import-not-found: Couldn't resolve import "../Discovery.Shared/data-plane.tsp" +2025-10-08 16:27:29 [ERROR] /mnt/vss/_work/1/s/azure-sdk-for-python-pr/sdk/discovery-workspace/azure-discovery-workspace/TempTypeSpecFiles/Discovery.Workspace/common.tsp:4:1 - error import-not-found: Couldn't resolve import "../Discovery.Shared/shared.tsp" +2025-10-08 16:27:29 [ERROR] /mnt/vss/_work/1/s/azure-sdk-for-python-pr/sdk/discovery-workspace/azure-discovery-workspace/TempTypeSpecFiles/Discovery.Workspace/_project.tsp:5:1 - error import-not-found: Couldn't resolve import "../Discovery.Shared/data-plane.tsp" +2025-10-08 16:27:29 [ERROR] /mnt/vss/_work/1/s/azure-sdk-for-python-pr/sdk/discovery-workspace/azure-discovery-workspace/TempTypeSpecFiles/Discovery.Workspace/_conversation_message_logs.tsp:6:1 - error import-not-found: Couldn't resolve import "../Discovery.Shared/data-plane.tsp" +2025-10-08 16:27:29 [ERROR] /mnt/vss/_work/1/s/azure-sdk-for-python-pr/sdk/discovery-workspace/azure-discovery-workspace/TempTypeSpecFiles/Discovery.Workspace/_tool.tsp:5:1 - error import-not-found: Couldn't resolve import "../Discovery.Shared/data-plane.tsp" +2025-10-08 16:27:29 [ERROR] /mnt/vss/_work/1/s/azure-sdk-for-python-pr/sdk/discovery-workspace/azure-discovery-workspace/TempTypeSpecFiles/Discovery.Workspace/_tool.tsp:6:1 - error import-not-found: Couldn't resolve import "../Discovery.Shared/shared.tsp" +``` + +## answer +According to error log, it seems that your typespec refer to folder outside project folder but you don't declare it in `tspconfig.yaml`. You could add the missing dir like below then try again: +``` +"@azure-tools/typespec-client-generator-cli": + additionalDirectories: + - "specification/keyvault/Security.KeyVault.Common/" +``` + +# MS Learning Documentation Categorization as "Unknown" + +## question +I've released the preview version of azure-ai-transcription (v1.0.0b1), but the documentation is appearing under the "unknown" folder on Microsoft Learn instead of the cognitive-services category. + +During the documentation build, the warning shows: +``` +##[warning]Could not retrieve metadata for azure-ai-transcription from metadata CSV. Using best effort defaults. +The service of package: cognitiveservices +``` + +Can someone help take a look of this issue? Does it require register this package in the metadata CSV with MSDocService: cognitive-services so the documentation appears in the correct location on Microsoft Learn? + +Here is the release [pipeline link: Pipelines - Run 20251203.2](https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5633753&view=results) +Here is MS learning link: [Azure AI Speech Transcription client library for Python | Microsoft Learn](https://learn.microsoft.com/en-us/python/api/overview/azure/ai-transcription-readme?view=azure-python-preview) + +## answer +Yes, to ensure the documentation for azure-ai-transcription appears under the "cognitive-services" category on Microsoft Learn, you need to add or update the metadata for this package in the metadata CSV file located at https://github.com/Azure/azure-sdk/blob/main/_data/releases/latest/python-packages.csv. +Specifically, you should: +1. Find (or add) the row for azure-ai-transcription in python-packages.csv. +2. Set the MSDocService field to "cognitive-services". This value is used to correctly categorize the package in the Learn docs hierarchy. +3. Ensure other relevant fields (ServiceName, DisplayName, Type, etc.) are filled in appropriately. +After updating the CSV, commit and create a PR in the azure-sdk repo. Once merged, the next docs build will pick up the new metadata and your package will be categorized correctly. +If the Notes field for your package is set to "Needs Review", update it to another value to avoid automation overwriting your changes. +References and field details can be found here: +- [CSV field README](https://github.com/Azure/azure-sdk/blob/main/eng/README.md#csv-fields) +- [Relevant CSV file for Python packages](https://github.com/Azure/azure-sdk/blob/main/_data/releases/latest/python-packages.csv) +In summary: Yes, registering your package in the metadata CSV with MSDocService: cognitive-services is required. This action will resolve the warning and correct the Learn categorization. +**References** +[Publish SDK reference docs / Onboard a released package | Azure-sdk-docs-eng](https://eng.ms/docs/products/azure-developer-experience/develop/sdk-docs) +[Metadata CSV update process for Python | Azure Sdk For Python Docs](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/deprecation_process.md) + +# "black" job in pipeline fails, but when I run locally, the tool does not make any changes + +## question +I like to run the "black" tool before PRs, and I ask others in my project to do the same. A few hours ago I found out that I can turn on this check in the pipeline. I was happy to see this. So I added the following to pyproject.toml: + +``` +[tool.azure-sdk-build] +black = true +``` + +I run "black" before commiting my last change to the PR, and no updates were needed. + +But the pipeline called out a "black" failure: https://dev.azure.com/azure-sdk/public/_build/results?buildId=5606772&view=logs&j=b70e5e73-bbb6-5567-0939-8415943fadb9&t=efe9ac6d-3fdb-50af-24e1-4319f36eecb4 + +I see the pipeline used black version 24.4.0. I had a newer version when I run locally. I install 24.4.0 and run that, but it also did not do any changes to the code. + +Any idea how to fix it? (other than removing it from the pipeline...). + +## answer +The "black" job in the Azure SDK for Python pipeline can fail for reasons beyond just code formatting. Even if running "black" locally with the same version (24.4.0) does not produce changes, there are a few areas to check for a root cause: +1. Run Black with the Same Arguments as the Pipeline:The pipeline runs "black" using tox with specific arguments. Make sure you are running locally in the same way. From the official guidance, run: `tox run -e black -c ../../../eng/tox/tox.ini --root . -- .` This ensures that the same config files, paths, and excludes are used. The pipeline may use a different configuration or target files that you are not formatting locally. Or you can tried the same command used by ci: `python -m azpysdk.main black --isolate sdk/ai/azure-ai-projects`. +2. Check for Hidden Files or Config Differences: The pipeline uses the repository’s configuration, including pyproject.toml and any exclude/include patterns. Local runs may inadvertently skip files due to local ignore files, environment differences, or working directory mismatches. Double-check that your local environment matches the CI context. +3. Run `git status` or `git diff` to find out whether there are files already formatted but not pushed to the pr. +4. Line Endings and Whitespace: Sometimes, black fails due to line ending differences (CRLF vs LF) or invisible whitespace issues that are not flagged locally. Make sure your files have consistent line endings (prefer LF in repo). +5. Check the Pipeline Log for Specific Files: Review the pipeline's failure log closely to see which files are reported as needing formatting. Sometimes, it’s a file outside your typical working set (such as generated code or test files). +6. Reproduce in a Clean Environment: To eliminate local state issues, clone your repo in a fresh directory and re-run the pipeline’s black command as above. If you confirm that running "black" via tox in a clean environment with the same version does not report changes, but the pipeline still fails, check for possible pipeline caching or artifact issues. Otherwise, use the pipeline log to identify exactly which file is causing the failure and focus on that file. Removing the check is not recommended; instead, focus on aligning your local runs with the pipeline invocation. If you continue to see unexplained failures, reach out in the Azure SDK language team channel with your findings and the specific pipeline log excerpt. + +# Ubunty 2303 pypy39 specific failure + +## question +Hi, + +I am seeing this error in the pipeline. Can anyone check please? +``` + --- stderr + error: the configured PyPy interpreter version (3.9) is lower than + PyO3's minimum supported version (3.11) + warning: build failed, waiting for other jobs to finish... +``` +[Pipelines - Run 20251030.12 logs](https://dev.azure.com/azure-sdk/public/_build/results?buildId=5517166&view=logs&j=98792cce-2755-554b-a8ad-f8c76be41d33&t=7feb2094-2399-5589-4545-1b2ca3b7ddc8) + +## answer +You have a dependency that doesn't ship a pypy39 dep. That's all. You could swap that with pypy311 in your matrix if you wanted to give it a shot. + +# Python emitter issue with bulleted list TypeSpec doc string, and other + +## question +This TypeSpec repo/branch/folder: https://github.com/Azure/azure-rest-api-specs-pr/tree/feature/ai-foundry/agents-v2/specification/ai/Azure.AI.Projects + +Is emitted into this Python repo/branch/folder: https://github.com/Azure/azure-sdk-for-python/tree/feature/azure-ai-projects/2.0.0b1/sdk/ai/azure-ai-projects + +Using the command `tsp-client update --debug --local-spec-repo ` + +I have a green build, other than errors in the "Build Docs" stage, as seen in this build of the branc: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5527867&view=results + +I need some guidance on how to update TypeSpec to make these Python doc generation go away. + +The errors are the following: +``` +updating environment: [new config] 7 added, 0 changed, 0 removed +docstring of azure.ai.projects.models.Reasoning.generate_summary:6: WARNING: Inline strong start-string without end-string. [docutils] +docstring of azure.ai.projects.models.WorkflowDefinition.workflow:2: WARNING: Duplicate explicit target name: "learn more". [docutils] +docstring of azure.ai.projects.models.WorkflowDefinition.workflow:2: WARNING: Duplicate explicit target name: "learn more". [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:54: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:61: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:64: ERROR: Unexpected indentation. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:65: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:67: ERROR: Unexpected indentation. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:79: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:82: ERROR: Unexpected indentation. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:83: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:89: ERROR: Unexpected indentation. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:90: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:109: WARNING: Definition list ends without a blank line; unexpected unindent. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:112: ERROR: Unexpected indentation. [docutils] +docstring of azure.ai.projects.models.WorkflowDefinition.workflow:2: WARNING: Duplicate explicit target name: "learn more". [docutils] +docstring of azure.ai.projects.models.Response.output:10: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +docstring of azure.ai.projects.models.Response.output:12: WARNING: Definition list ends without a blank line; unexpected unindent. [docutils] +docstring of azure.ai.projects.models.Response.tools:9: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +docstring of azure.ai.projects.models.Response.tools:12: ERROR: Unexpected indentation. [docutils] +docstring of azure.ai.projects.models.Response.tools:13: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +docstring of azure.ai.projects.models.Response.truncation:8: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +docstring of azure.ai.projects.models.Response.truncation:11: ERROR: Unexpected indentation. [docutils] +docstring of azure.ai.projects.models.Response.truncation:12: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +docstring of azure.ai.projects.models.WorkflowDefinition.workflow:2: WARNING: Duplicate explicit target name: "learn more". [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._enums.ServiceTier:4: WARNING: Bullet list ends without a blank line; unexpected unindent. [docutils] +``` + +It comes from two TypeSpec models, direct link here: +Response model - https://github.com/Azure/azure-rest-api-specs-pr/blob/feature/ai-foundry/agents-v2/specification/ai/Azure.AI.Projects/.external-readonly/openai.external.typespec/responses/custom.tsp#L38 +``` +model Response { + ...Response_Pre_Update; + conversation: { + id: string; + } | null; +} +``` +ServiceTier union - https://github.com/Azure/azure-rest-api-specs-pr/blob/feature/ai-foundry/agents-v2/specification/ai/Azure.AI.Projects/.external-readonly/openai.external.typespec/common/models.tsp#L475 +``` +union ServiceTier { + "auto", + "default", + "flex", + "scale", + "priority", +} +``` + +## answer +The Sphinx docstring errors you're seeing in the generated Python SDK (unexpected indentation, block quote ends without a blank line, duplicate explicit target names, bullet/definition list issues) are caused by how TypeSpec documentation comments are emitted into Python docstrings, especially when those comments use Markdown or formatting that doesn't map cleanly to reStructuredText (reST), which Sphinx expects. +To resolve these errors, there are two possible solutions: +1. You need to ensure that the TypeSpec doc comments for the Response model and ServiceTier union are written in a way that avoids problematic Markdown constructs and closely follows what Sphinx/reST expects. +Here are practical steps: +- **Bullet/Definition List Formatting:** - Avoid using Markdown bullet lists (`*`, `-`, or `+`) or definition lists in your TypeSpec doc comments. Instead, use plain sentences, or, if you need a list, format it as numbered items with clear line breaks between each item. - If you must use a list, add a blank line before and after the list, and ensure each item starts on a new line. Do not nest lists or use complex indentation. +- **Inline Strong/Emphasis Markup:** - If you use `**bold**` or `*italic*` in TypeSpec comments, Sphinx may misinterpret these if not balanced. Prefer using plain text or ensure that every start marker has a matching end marker. +- **Explicit Targets (Links):** - If you use `[Learn more](url)` in doc comments, emitting these into Python docstrings can result in duplicate explicit target names. Use plain URLs or avoid repeating the same anchor text multiple times. +- **Block Quotes:** - Avoid using Markdown block quotes (`>`) in TypeSpec doc comments. If you need to highlight something, use plain sentences. +- **Unexpected Indentation:** - Ensure all TypeSpec doc comments are left-aligned, with no leading spaces or tabs before the text, unless you are deliberately creating a code block. For code blocks, use triple backticks and add blank lines before and after the block. +- **General Style:** - Write documentation in simple paragraphs. Do not mix Markdown with reST, and avoid complex formatting. - Example of a safe docstring for a model property: ```tsp /** * The list of available service tiers. Possible values include: * 1. Basic - Entry-level tier. * 2. Standard - Recommended for most workloads. * 3. Premium - Advanced tier for high throughput. */ ``` - Avoid: ```tsp /** * - Basic * - Standard * - Premium */ ``` **Actionable Steps:** - Go to your TypeSpec definitions for Response and ServiceTier, and revise any doc comments containing bullet lists, definition lists, block quotes, repeated anchor text, or excessive indentation. Replace with simple sentences or numbered lists as above. - After making these changes, regenerate the Python SDK and run the Sphinx build again. The warnings/errors should be resolved. - For reference on Python docstring formatting and Sphinx compatibility, see the Azure Python SDK [docstring guidelines](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/docstring.md). If you need a specific example for ServiceTier: ```tsp /** * Service tier for deployment. Possible values: * 1. Basic: Entry-level tier. * 2. Standard: Recommended tier. * 3. Premium: Advanced tier for large workloads. */ union ServiceTier { ... } ``` And for Response model, ensure any lists or references are in plain sentences and do not use block quotes or repeated links. +2. Or you can disable the sphinx environment within the pyproject.toml for the problematic package. By that way you won't hit these sphinx failures. +``` +[tool.azure-sdk-build] +sphinx = false +``` diff --git a/QA/python_2025_10_17.md b/QA/python_2025_10_17.md new file mode 100644 index 000000000000..0e17807eeb52 --- /dev/null +++ b/QA/python_2025_10_17.md @@ -0,0 +1,30 @@ +# Problem releasing remoterendering SDK for deprecation + +## question +Hi, +I'm trying to release the remoterendering SDK with the deprecation notice according to Step 4 in [azure-sdk-for-python/doc/deprecation_process.md at main · Azure/azure-sdk-for-python](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/deprecation_process.md). + +I did all the merging and executed the `Prepare-Release.ps1step` described in the guide, but then I tried to follow [Run release SDK pipeline](https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-pipeline) to actually release the package and I ran into problems. + +The output of the `python - remoterendering` pipeline [here](https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5452798&view=results) does not look at all like the output described on the guide page for the release. I don't see any `package-signed` artifacts or any review step I could do. + +I see that the `Integration` step in the pipeline is skipping quiet a lot of things, but I don't know how to convince it to do more. + +Any help? + +The content of ci.yml contains this: +``` +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: remoterendering + TestProxy: true + Artifacts: + - name: azure-mixedreality-remoterendering + safeName: azuremixedrealityremoterendering +``` + +## answer +Your manually queued build here: [Pipelines - Run 20251015.1](https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5459981&view=results) + +DOES reflect the stages you're expecting. The link you linked to above is the individual CI which runs automatically when a merge happens in that folder to `main`. They both have identical `SHA` ref, so you should be clear to release the deprecation now from your manually queued build. diff --git a/QA/python_2025_10_24.md b/QA/python_2025_10_24.md new file mode 100644 index 000000000000..b39bfd55a8f0 --- /dev/null +++ b/QA/python_2025_10_24.md @@ -0,0 +1,11 @@ +# Python sdk release + +## question +Hu team , I am trying to release python sdk for oracle databse however build keep failing . Please help mitigate the issue , here is the link to the pipeline https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5453800&view=results. + +## answer +Two options. + +1. Regenerate your package using the `emitter-package.json` that's in `main`. Submit that PR. +Submit a targeted PR that changes the `pyproject.toml` for your package to exclude the directories that shouldn't be there. Here is a PR generated from the newer emitter package. https://github.com/Azure/azure-sdk-for-python/pull/43272/files#r2430170753 +2. You could manually update your `pyproject.toml` to align with what you see in this PR. That's also an option. diff --git a/QA/python_2025_10_31.md b/QA/python_2025_10_31.md new file mode 100644 index 000000000000..83d948b83b63 --- /dev/null +++ b/QA/python_2025_10_31.md @@ -0,0 +1,16 @@ +# Ubunty 2303 pypy39 specific failure + +## question +Hi, + +I am seeing this error in the pipeline. Can anyone check please? +``` + --- stderr + error: the configured PyPy interpreter version (3.9) is lower than + PyO3's minimum supported version (3.11) + warning: build failed, waiting for other jobs to finish... +``` +[Pipelines - Run 20251030.12 logs](https://dev.azure.com/azure-sdk/public/_build/results?buildId=5517166&view=logs&j=98792cce-2755-554b-a8ad-f8c76be41d33&t=7feb2094-2399-5589-4545-1b2ca3b7ddc8) + +## answer +You have a dependency that doesn't ship a pypy39 dep. That's all. You could swap that with pypy311 in your matrix if you wanted to give it a shot. diff --git a/QA/python_2025_11_07.md b/QA/python_2025_11_07.md new file mode 100644 index 000000000000..4217c10ba982 --- /dev/null +++ b/QA/python_2025_11_07.md @@ -0,0 +1,79 @@ +# NOTICE.txt updates + +## question +Are there any recommendations to update the NOTICE.txt file in the root of the packages? + +We have recently received a GH issue [NOTICE calls out gpl-3.0 for non-gpl-3.0 packages · Issue #43717 · Azure/azure-sdk-for-python](https://github.com/Azure/azure-sdk-for-python/issues/43717) requesting to update the NOTICE.txt in azure-ai-ml package. + +We found the general recommendations here [NOTICE generation | Docs - Microsoft Open Source](https://docs.opensource.microsoft.com/tools/cg/legal/notice/). Could someone please help us figure out what is the right approach to update the NOTICE.txt? + +## answer +Attaching the links shared by Justin: +1. [Attribution guidelines | Docs - Microsoft Open Source](https://docs.opensource.microsoft.com/legal/cela-guidance/attribution-guidelines/) +2. [NOTICE FAQ | Docs - Microsoft Open Source](https://docs.opensource.microsoft.com/using/guidance-for-open-source-usage/notice-faq/#q-when-do-i-need-a-notice) +3. [NOTICE FAQ | Docs - Microsoft Open Source](https://docs.opensource.microsoft.com/using/guidance-for-open-source-usage/notice-faq/#q-does-cela-need-to-review-the-notice) + +So it seems we would need a notice if: +- compiled build or any other scenario where the recipient can no longer access or view the code in source code form (attribute the full dependency tree that is distributed). + Since it's Python, we only deliver source files in Python. This SDK does not even include native code in C/C++. +- source code repository (attribute open source copied into the repo; not referenced dependencies). + This SDK doesn't copy/paste OSS code from 3P offering. + +The SDK package we put on PyPI doesn't contain any source file that is copied from any other OSS components. So my understanding is that we don't need a NOTICE. + +# Python emitter issue with bulleted list TypeSpec doc string, and other + +## question +This TypeSpec repo/branch/folder: https://github.com/Azure/azure-rest-api-specs-pr/tree/feature/ai-foundry/agents-v2/specification/ai/Azure.AI.Projects + +Is emitted into this Python repo/branch/folder: https://github.com/Azure/azure-sdk-for-python/tree/feature/azure-ai-projects/2.0.0b1/sdk/ai/azure-ai-projects + +Using the command `tsp-client update --debug --local-spec-repo ` + +I have a green build, other than errors in the "Build Docs" stage, as seen in this build of the branc: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5527867&view=results + +I need some guidance on how to update TypeSpec to make these Python doc generation go away. + +The errors are the following: + +``` +updating environment: [new config] 7 added, 0 changed, 0 removed +docstring of azure.ai.projects.models.Reasoning.generate_summary:6: WARNING: Inline strong start-string without end-string. [docutils] +docstring of azure.ai.projects.models.WorkflowDefinition.workflow:2: WARNING: Duplicate explicit target name: "learn more". [docutils] +docstring of azure.ai.projects.models.WorkflowDefinition.workflow:2: WARNING: Duplicate explicit target name: "learn more". [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:54: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:61: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:64: ERROR: Unexpected indentation. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:65: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:67: ERROR: Unexpected indentation. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:79: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:82: ERROR: Unexpected indentation. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:83: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:89: ERROR: Unexpected indentation. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:90: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:109: WARNING: Definition list ends without a blank line; unexpected unindent. [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._models.Response:112: ERROR: Unexpected indentation. [docutils] +docstring of azure.ai.projects.models.WorkflowDefinition.workflow:2: WARNING: Duplicate explicit target name: "learn more". [docutils] +docstring of azure.ai.projects.models.Response.output:10: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +docstring of azure.ai.projects.models.Response.output:12: WARNING: Definition list ends without a blank line; unexpected unindent. [docutils] +docstring of azure.ai.projects.models.Response.tools:9: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +docstring of azure.ai.projects.models.Response.tools:12: ERROR: Unexpected indentation. [docutils] +docstring of azure.ai.projects.models.Response.tools:13: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +docstring of azure.ai.projects.models.Response.truncation:8: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +docstring of azure.ai.projects.models.Response.truncation:11: ERROR: Unexpected indentation. [docutils] +docstring of azure.ai.projects.models.Response.truncation:12: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] +docstring of azure.ai.projects.models.WorkflowDefinition.workflow:2: WARNING: Duplicate explicit target name: "learn more". [docutils] +E:\src\sdk-repos\azure-sdk-for-python\sdk\ai\azure-ai-projects\.tox\sphinx\Lib\site-packages\azure\ai\projects\models\__init__.py:docstring of azure.ai.projects.models._enums.ServiceTier:4: WARNING: Bullet list ends without a blank line; unexpected unindent. [docutils] +``` + +It comes from two TypeSpec models, direct link here: +Response model - https://github.com/Azure/azure-rest-api-specs-pr/blob/feature/ai-foundry/agents-v2/specification/ai/Azure.AI.Projects/.external-readonly/openai.external.typespec/responses/custom.tsp#L38 +ServiceTier union - https://github.com/Azure/azure-rest-api-specs-pr/blob/feature/ai-foundry/agents-v2/specification/ai/Azure.AI.Projects/.external-readonly/openai.external.typespec/responses/custom.tsp#L38 + +## answer +Within the pyproject.toml for the problematic package, disable the sphinx environment is my advice. that way you won't hit these sphinx failures. + +``` +[tool.azure-sdk-build] +sphinx = false +``` \ No newline at end of file diff --git a/QA/python_2025_11_14.md b/QA/python_2025_11_14.md new file mode 100644 index 000000000000..88e4d546b17f --- /dev/null +++ b/QA/python_2025_11_14.md @@ -0,0 +1,66 @@ +# When emitting Python from TypeSpec, how do I rename an operation path parameter? + +## question +I have this operation defined in TypeSpec. I know I can add the `@clientName` to change the name of the input parameter in the emitted Python operation method. This TypeSpec compiles fine (see [full TypeSpec file here](https://github.com/Azure/azure-rest-api-specs-pr/blob/feature/ai-foundry/agents-v2/specification/ai/Azure.AI.Projects/agents/operations.tsp#L56)): + +``` +interface Agents { + + @post + @route("/agents/{agent_name}") + @tag("Agents") + updateAgent is AgentOperation< + { + @path + @clientName("name", "python") + agent_name: string; + + ...UpdateAgentRequest; + }, + AgentObject + >; + +} +``` + +However I'm trying to avoid adding @clientName decorators in TypeSpec model definitions, and instead have them all in the client.tsp file. + +My question: how do I do the above, but using @@clientName in client.tsp file instead? I've tried many things, but no luck. Including: + +``` +@@clientName(Agents.updateAgent::parameters.agent_name, "name", "python"); +``` + +which files to compile with error `Model doesn't have member agent_name`. In the above case it's not a member but a path, so perhaps that's the reason for the error, but I don't know how to fix it. + +## answer +You could define an alias to include path parameters then rename the path parameters by the alias like : +``` + +alias UpdateAgentParams = { + @path originalName1: string; +}; + +interface MyOp { + @post + @route("/name/{originalName1}") + updateAgent1 is AgentOperation< + UpdateAgentParams, + void + >; + + @post + @route("/name/{originalName2}") + updateAgent2 is AgentOperation< + { + @path originalName2: string; + }, + void + >; +} + +@@clientName(UpdateAgentParams.originalName1, "newName1"); // OK + +// Can't work since Typespec can't refer to parameter defined in an anonymous model in Template +// @clientName(MyOp.updateAgent2::parameters.originalName2, "newName2"); +``` diff --git a/QA/python_2025_11_28.md b/QA/python_2025_11_28.md new file mode 100644 index 000000000000..e92cfaa49404 --- /dev/null +++ b/QA/python_2025_11_28.md @@ -0,0 +1,22 @@ +# "black" job in pipeline fails, but when I run locally, the tool does not make any changes + +## question +I like to run the "black" tool before PRs, and I ask others in my project to do the same. A few hours ago I found out that I can turn on this check in the pipeline. I was happy to see this. So I added the following to pyproject.toml: + +``` +[tool.azure-sdk-build] +black = true +``` + +I run "black" before commiting my last change to the PR, and no updates were needed. + +But the pipeline called out a "black" failure: https://dev.azure.com/azure-sdk/public/_build/results?buildId=5606772&view=logs&j=b70e5e73-bbb6-5567-0939-8415943fadb9&t=efe9ac6d-3fdb-50af-24e1-4319f36eecb4 + +I see the pipeline used black version 24.4.0. I had a newer version when I run locally. I install 24.4.0 and run that, but it also did not do any changes to the code. + +Any idea how to fix it? (other than removing it from the pipeline...). + +## answer +I tried the same command used by ci: `python -m azpysdk.main black --isolate /mnt/vss/_work/1/s/sdk/ai/azure-ai-projects`, and find that your project has one file reformatted. + +NOTE: the command ci uses need some time and I recommend you use one simple command which usually has same effect and much faster: `black sdk/ai/azure-ai-projects/ -l 120` diff --git a/QA/python_2025_12_12.md b/QA/python_2025_12_12.md new file mode 100644 index 000000000000..c426fcbf9ac1 --- /dev/null +++ b/QA/python_2025_12_12.md @@ -0,0 +1,66 @@ +# Generate docs CI check keeps failing + +## question +I’m working on a Python SDK PR and the **generate-docs** CI check continues failing. +The error points to `CreateDeploymentDetails.azure_resource_ids` with: +> “Definition list ends without a blank line; unexpected unindent.” +I’ve already updated the docstring based on this message, but CI still reports the same failure. +Here is the error log: [Pipelines - Run 20251209.42 logs](https://dev.azure.com/azure-sdk/public/public%20Team/_build/results?buildId=5652585&view=logs&j=7b8caaf3-aec7-5f50-aa20-46d4a6342ac3&t=286a7ccb-1111-5827-fc90-5c974fed4202&l=313) + +For reference: +- Generated model location: https://github.com/Azure/azure-sdk-for-python/blob/a03b420f1222064b0c332d772ed8955e8ae578d1/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/models/_models.py#L633 +- Patched model location: https://github.com/Azure/azure-sdk-for-python/blob/a03b420f1222064b0c332d772ed8955e8ae578d1/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/azure/ai/language/conversations/authoring/models/_models.py#L633 + +Could you please advise: +1. Is there a recommended way to run the generate-docs step locally so I can verify the fix without pusshing repeatedly? +2. Any guidance on the correct docstring formatting expected here? + +## answer +There is an easy way to repro your failures: install `eng/tools/azure-sdk-tools[build]` . then just `azpysdk sphinx .` from your package directory. + +# Pytest failure: test fixtures not being recognized + +## question +I’m following the Python SDK testing guidance (link: [Dataplane Codegen Quick Start for Test · Azure/azure-sdk-for-python Wiki](https://github.com/Azure/azure-sdk-for-python/wiki/Dataplane-Codegen-Quick-Start-for-Test)), but I’m seeing an issue related to fixtures not being recognized by pytest. +When running the tests, I get the following error: **fixture 'text_analysis_endpoint' not found**. + +But I have the environment variables correctly configured in my `.env` , and I have a `conftest.py` file that follows the guidance exactly. +For reference, here is the `conftest.py` I’m using: [azure-sdk-for-python/sdk/cognitivelanguage/azure-ai-textanalytics/tests/conftest.py at dd52517afed9…](https://github.com/Azure/azure-sdk-for-python/blob/dd52517afed9dffae02a0239bb397be091643310/sdk/cognitivelanguage/azure-ai-textanalytics/tests/conftest.py) +``` +import pytest + +@pytest.fixture(scope="session", autouse=True) +def start_proxy(test_proxy, patch_sleep, patch_async_sleep): + return +``` + +It seems like the fixtures are not being loaded into the test environment. +Did I miss something in the setup? Any pointers would be greatly appreciated — thank you! + +## answer +The issue could resolved by directly defining the endpoint/key fixtures in conftest.py. +``` +import pytest +from devtools_testutils import EnvironmentVariableLoader + +# Environment variable keys +ENV_ENDPOINT = "TEXT_ANALYSIS_ENDPOINT" +ENV_KEY = "TEXT_ANALYSIS_KEY" + +@pytest.fixture(scope="session") +def text_analysis_endpoint(environment_variables: EnvironmentVariableLoader) -> str: + """Endpoint for Text Analysis tests.""" + return environment_variables.get(ENV_ENDPOINT) + +@pytest.fixture(scope="session") +def text_analysis_key(environment_variables: EnvironmentVariableLoader) -> str: + """API key for Text Analysis tests.""" + return environment_variables.get(ENV_KEY) + +# autouse=True will trigger this fixture on each pytest run +# test_proxy auto-starts the test proxy +# patch_sleep and patch_async_sleep remove wait times during polling +@pytest.fixture(scope="session", autouse=True) +def start_proxy(test_proxy, patch_sleep, patch_async_sleep): + return +```