Skip to content

[Document] Py sdk 2026-05-15-preview - #47984

Open
amberchen-86 wants to merge 72 commits into
Azure:mainfrom
amberchen-86:v-amber/document-pysdk-2026-05-15-preview-continued
Open

[Document] Py sdk 2026-05-15-preview#47984
amberchen-86 wants to merge 72 commits into
Azure:mainfrom
amberchen-86:v-amber/document-pysdk-2026-05-15-preview-continued

Conversation

@amberchen-86

Copy link
Copy Markdown
Member

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copilot AI balanced review requested due to automatic review settings July 9, 2026 21:30

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving the ci.yml changes for EngSys

@amberchen-86

Copy link
Copy Markdown
Member Author

/check-enforcer override

@msyyc Yuchao Yan (msyyc) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approval is just for ci.yml since I am one of owner about this file.

Copilot AI review requested due to automatic review settings July 17, 2026 18:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 57 out of 58 changed files in this pull request and generated 12 comments.

@amberchen-86
amberchen-86 marked this pull request as draft July 17, 2026 18:34
@amberchen-86
amberchen-86 marked this pull request as ready for review July 22, 2026 21:20
Copilot AI review requested due to automatic review settings July 22, 2026 21:20
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
9 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 57 out of 58 changed files in this pull request and generated 9 comments.

Comment thread sdk/cognitivelanguage/azure-ai-language-documents/pyproject.toml
Comment thread sdk/cognitivelanguage/azure-ai-textanalytics/assets.json
Comment thread sdk/cognitivelanguage/azure-ai-textanalytics-authoring/assets.json
Comment thread sdk/cognitivelanguage/azure-ai-language-conversations/assets.json
@github-actions

This comment has been minimized.

Copilot AI review requested due to automatic review settings August 11, 2026 23:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 57 out of 58 changed files in this pull request and generated no new comments.

Suppressed comments (20)

sdk/cognitivelanguage/azure-ai-language-documents/samples/sample_submit_job.py:58

  • The RedactionPolicyKind wire discriminator is entityMask (lowercase e), not EntityMask. Using the wrong casing makes this sample request violate the service contract and may be rejected during discriminator deserialization.
    sdk/cognitivelanguage/azure-ai-language-documents/samples/sample_get_job_state.py:58
  • Use the declared entityMask discriminator value here. EntityMask does not match the generated RedactionPolicyKind wire value, so the copied sample can submit an invalid request.
    sdk/cognitivelanguage/azure-ai-language-documents/samples/sample_cancel_job.py:58
  • The service contract defines this discriminator as entityMask. The capitalized value does not match the wire enum and can prevent the cancel sample from creating the job it intends to cancel.
    sdk/cognitivelanguage/azure-ai-language-documents/samples/async_samples/sample_submit_job_async.py:60
  • Use entityMask, which is the exact RedactionPolicyKind wire value. The current capitalized discriminator makes the async sample request inconsistent with the API schema.
    sdk/cognitivelanguage/azure-ai-language-documents/samples/async_samples/sample_get_job_state_async.py:60
  • The discriminator is case-sensitive in the API contract and is defined as entityMask. Correcting this value prevents the async get-state sample from submitting a schema-invalid job.
    sdk/cognitivelanguage/azure-ai-language-documents/samples/async_samples/sample_cancel_job_async.py:60
  • EntityMask is not the declared wire discriminator; the API and generated enum use entityMask. Fix the casing so this sample can create a job before attempting cancellation.
    sdk/cognitivelanguage/azure-ai-language-documents/tests/test_analyze_documents.py:50
  • All three request bodies in this test file use EntityMask, while the generated discriminator and service contract require entityMask. Update every occurrence (lines 50, 105, and 172); otherwise these integration tests exercise schema-invalid requests rather than the operations under test.
    sdk/cognitivelanguage/azure-ai-language-documents/tests/test_analyze_documents_async.py:63
  • The three async test requests use the wrong discriminator casing. The API wire value is entityMask, so update lines 63, 120, and 192 to avoid submitting invalid redaction policies.
    sdk/cognitivelanguage/azure-ai-language-documents/README.md:162
  • Each README snippet uses EntityMask, but the public wire value is entityMask. Correct all four snippets (lines 162, 234, 293, and 360), ideally by fixing the source samples and regenerating the embedded snippets, so copied examples conform to the API.
                                    "policyKind": "EntityMask",

sdk/cognitivelanguage/azure-ai-language-documents/azure/ai/language/documents/_operations/_patch.py:36

  • Operation-Location includes ?api-version=2026-05-15-preview in this API, so taking the raw trailing substring makes details["operation_id"] equal to <job-id>?api-version=.... The get-state and cancel samples then place that malformed value into the {jobId} path. Strip the URL query before extracting the final path segment.
    path = op_loc.rstrip("/")

sdk/cognitivelanguage/azure-ai-language-documents/azure/ai/language/documents/aio/_operations/_patch.py:36

  • The service's Operation-Location value contains the API-version query string. This raw rstrip therefore leaves the query attached to operation_id, and the async get-state/cancel samples subsequently send an invalid job ID. Remove the query/fragment before selecting the final path segment.
    sdk/cognitivelanguage/azure-ai-language-documents/samples/sample_submit_job.py:47
  • Both document locations are polymorphic DocumentLocation values, whose required discriminator is kind. Add "kind": "AzureBlob" to the source and target objects; without it this copied sample sends request bodies that do not conform to the API schema.

This issue also appears on line 58 of the same file.
sdk/cognitivelanguage/azure-ai-language-documents/samples/sample_get_job_state.py:47

  • The source and target locations require the DocumentLocation.kind discriminator. Include "kind": "AzureBlob" in both dictionaries so the job-state sample can submit a valid request.

This issue also appears on line 58 of the same file.
sdk/cognitivelanguage/azure-ai-language-documents/samples/sample_cancel_job.py:47

  • These location objects omit the required polymorphic discriminator. Add "kind": "AzureBlob" to both source and target; otherwise the sample may fail while submitting the job and never reach cancellation.

This issue also appears on line 58 of the same file.
sdk/cognitivelanguage/azure-ai-language-documents/samples/async_samples/sample_submit_job_async.py:49

  • source and target are discriminated DocumentLocation models, and kind is required on the wire. Add "kind": "AzureBlob" to both objects to make this async sample request valid.

This issue also appears on line 60 of the same file.
sdk/cognitivelanguage/azure-ai-language-documents/samples/async_samples/sample_get_job_state_async.py:49

  • Add the required kind discriminator to both location dictionaries. The schema defines these as DocumentLocation unions, so a bare location cannot identify the AzureBlob variant.

This issue also appears on line 60 of the same file.
sdk/cognitivelanguage/azure-ai-language-documents/samples/async_samples/sample_cancel_job_async.py:49

  • The async cancellation sample omits the required DocumentLocation.kind value for both inputs. Set each to AzureBlob so job submission succeeds before cancellation is attempted.

This issue also appears on line 60 of the same file.
sdk/cognitivelanguage/azure-ai-language-documents/tests/test_analyze_documents.py:35

  • Every source and target object in this file omits the required DocumentLocation.kind discriminator. Add "kind": "AzureBlob" to both location objects in all three request bodies; otherwise the integration tests submit schema-invalid jobs.

This issue also appears on line 50 of the same file.
sdk/cognitivelanguage/azure-ai-language-documents/tests/test_analyze_documents_async.py:48

  • All three async requests need "kind": "AzureBlob" in both their source and target location objects. kind is a required discriminator in the API schema, so the current test payloads are incomplete.

This issue also appears on line 63 of the same file.
sdk/cognitivelanguage/azure-ai-language-documents/README.md:151

  • The four README requests omit the required kind discriminator from each source and target location. Add "kind": "AzureBlob" throughout (preferably by correcting the source samples and regenerating these snippets), or users copying the examples will submit incomplete DocumentLocation values.

This issue also appears on line 162 of the same file.

                            "source": {"location": source_location},
                            "target": {"location": target_location},

@github-actions

Copy link
Copy Markdown
Contributor
[Pilot] PR Pipeline Failure Analysis

A CI pipeline failed on this pull request. Here is an automated analysis of what went wrong and how to get the build green.

What failed

Build: #6688755 | Workflow: API.md Consistency

Four distinct failures across multiple check stages:

  1. Pylint (validation) — 2 packages failed with C4758 (docstring-keyword-should-match-keyword-only) and C0301 (line-too-long) errors:

    • sdk/cognitivelanguage/azure-ai-language-documents_patch.py methods begin_submit_job and begin_cancel_job are missing keyword-only args (polling, polling_interval, continuation_token, cls, etc.) in their docstrings.
    • sdk/textanalytics/azure-ai-textanalytics_response_handlers.py line 561 is 124 characters (limit: 120).
  2. MyPy (validation)sdk/textanalytics/azure-ai-textanalytics failed with multiple [assignment] type errors in _models.py (e.g., Any | None assigned to str, list[...], etc.).

  3. Sphinx (validation)sdk/cognitivelanguage/azure-ai-textanalytics sphinx build failed because azure.ai.textanalytics.models.rst was not found (FileNotFoundError).

  4. update_snippet (validation) — Snippets out of sync in azure-ai-language-conversations and azure-ai-textanalytics (2 failures).

  5. API.md Consistency (validation) — Script aborted with ERROR: multiple matches for 'azure-ai-textanalytics' — both sdk/cognitivelanguage/azure-ai-textanalytics and sdk/textanalytics/azure-ai-textanalytics exist, causing ambiguity.

Recommended next steps

  • Pylint – azure-ai-language-documents: Add the missing keyword-only arguments (polling, polling_interval, content_type, continuation_token, cls) to the :keyword: section of the docstrings for begin_submit_job and begin_cancel_job in both azure/ai/language/documents/_operations/_patch.py and the aio counterpart. See pylint guide.
  • Pylint – azure-ai-textanalytics: Shorten line 561 of sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_response_handlers.py to ≤120 characters.
  • MyPy – azure-ai-textanalytics: Fix the [assignment] type errors in sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_models.py — use Optional[...] or assert non-None before assignment, or widen the type annotations. Run azpysdk mypy . from the package directory to validate.
  • Sphinx – azure-ai-textanalytics (cognitivelanguage): The sphinx doc build cannot find azure.ai.textanalytics.models.rst. Verify the models RST file is generated/present in sdk/cognitivelanguage/azure-ai-textanalytics — this may be a side-effect of having two packages with the same name (see API.md item below).
  • update_snippet: Run azpysdk update_snippet . from sdk/cognitivelanguage/azure-ai-language-conversations and sdk/textanalytics/azure-ai-textanalytics to regenerate out-of-sync snippet files, then commit the results.
  • API.md Consistency: Resolve the duplicate azure-ai-textanalytics package paths (sdk/cognitivelanguage/azure-ai-textanalytics vs sdk/textanalytics/azure-ai-textanalytics). The regenerate script cannot disambiguate them — confirm whether both are intentional or if one should be removed/renamed.
  • See the CI troubleshooting guide: https://aka.ms/ci-fix
  • Push new commits to address the failures; this comment updates automatically on the next failing run.
Raw pipeline analysis (azsdk ci analyze)
Build: 6688755
Project: public
PipelineUrl: https://dev.azure.com/azure-sdk/public/_build/results?buildId=6688755

=== PYLINT FAILURES ===

Package: sdk/cognitivelanguage/azure-ai-language-documents  ->  FAIL(16)
  azure/ai/language/documents/aio/_operations/_patch.py:119: [C4758] "polling, polling_interval, content_type, continuation_token, cls" missing in docstring
  azure/ai/language/documents/aio/_operations/_patch.py:245: [C4758] "polling, polling_interval, continuation_token, cls" missing in docstring
  azure/ai/language/documents/_operations/_patch.py:119: [C4758] (same as above)
  azure/ai/language/documents/_operations/_patch.py:244: [C4758] (same as above)

Package: sdk/textanalytics/azure-ai-textanalytics  ->  FAIL(16)
  azure/ai/textanalytics/_response_handlers.py:561: [C0301] Line too long (124/120)

=== MYPY FAILURES ===

Package: sdk/textanalytics/azure-ai-textanalytics  ->  FAIL(1)
  _models.py:73,74,75,116,117,159,160,161,207,208,209,271,272,314,315,360,361,402,403,...
  error: Incompatible types in assignment (expression has type "Any | None", variable has type "str"/"list[...]"/etc)  [assignment]

=== SPHINX FAILURE ===

Package: sdk/cognitivelanguage/azure-ai-textanalytics  ->  FAIL(1)
  FileNotFoundError: azure.ai.textanalytics.models.rst does not exist

=== UPDATE_SNIPPET FAILURES ===

Package: azure-ai-language-conversations  ->  FAIL(1)
  Snippets for azure-ai-language-conversations are out of sync.
  Run 'azpysdk update_snippet .' from the package directory to fix.

Package: azure-ai-textanalytics  ->  FAIL(1)
  Snippets for azure-ai-textanalytics are out of sync.
  Run 'azpysdk update_snippet .' from the package directory to fix.

=== API.md CONSISTENCY FAILURE ===

Workflow: https://github.com/Azure/azure-sdk-for-python/actions/runs/31546941799
  ERROR: multiple matches for 'azure-ai-textanalytics':
    sdk/cognitivelanguage/azure-ai-textanalytics
    sdk/textanalytics/azure-ai-textanalytics
  ##[error]Unhandled error: Error: Command failed: node .github/workflows/src/api-md-consistency/regenerate.js

Copilot detected the failing pipeline and generated the analysis above. To have it attempt a fix automatically, reply with @copilot please fix the failing pipeline on this PR.

Generated by Pipeline Analysis - Next Steps · 53.1 AIC · ⌖ 6.68 AIC · ⊞ 6.6K ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Cognitive - Language Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants