Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the azure-ai-contentunderstanding SDK package, primarily to remove the _models.pyi stub approach for type-checker support and replace it with TYPE_CHECKING-based redeclarations in models/_patch.py, alongside a small spec pointer update and a patch version bump.
Changes:
- Removed
azure/ai/contentunderstanding/models/_models.pyiand moved the.valuetype information toTYPE_CHECKINGredeclarations inmodels/_patch.py. - Regenerated/updated generated client and utility code (operations streaming behavior now supports an internal
decompresstoggle; serialization/model base updates). - Bumped package version to
1.0.1and updated README/CHANGELOG accordingly; updatedtsp-location.yamlcommit pointer.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/contentunderstanding/azure-ai-contentunderstanding/tsp-location.yaml | Updates the pinned swagger/spec commit reference. |
| sdk/contentunderstanding/azure-ai-contentunderstanding/azure/ai/contentunderstanding/models/_patch.py | Adds TYPE_CHECKING redeclarations for ContentField* .value typing; minor formatting changes. |
| sdk/contentunderstanding/azure-ai-contentunderstanding/azure/ai/contentunderstanding/models/_models.pyi | Deleted stub file in favor of TYPE_CHECKING redeclarations. |
| sdk/contentunderstanding/azure-ai-contentunderstanding/azure/ai/contentunderstanding/models/_enums.py | Removes an unnecessary pylint disable. |
| sdk/contentunderstanding/azure-ai-contentunderstanding/azure/ai/contentunderstanding/aio/models/_patch.py | Minor signature formatting. |
| sdk/contentunderstanding/azure-ai-contentunderstanding/azure/ai/contentunderstanding/aio/_patch.py | Minor formatting change. |
| sdk/contentunderstanding/azure-ai-contentunderstanding/azure/ai/contentunderstanding/aio/_operations/_operations.py | Regenerated async operations; adds decompress handling for streaming responses and adjusts pylint disables. |
| sdk/contentunderstanding/azure-ai-contentunderstanding/azure/ai/contentunderstanding/_version.py | Version bump to 1.0.1. |
| sdk/contentunderstanding/azure-ai-contentunderstanding/azure/ai/contentunderstanding/_utils/serialization.py | Regenerated utility; adjusts pylint disables header. |
| sdk/contentunderstanding/azure-ai-contentunderstanding/azure/ai/contentunderstanding/_utils/model_base.py | Regenerated utility; equality tweak and improved XML/enum deserialization behavior; formatting changes. |
| sdk/contentunderstanding/azure-ai-contentunderstanding/azure/ai/contentunderstanding/_patch.py | Minor formatting change. |
| sdk/contentunderstanding/azure-ai-contentunderstanding/azure/ai/contentunderstanding/_operations/_operations.py | Regenerated sync operations; adds decompress handling for streaming responses and adjusts pylint disables. |
| sdk/contentunderstanding/azure-ai-contentunderstanding/README.md | Adds 1.0.1 row to the SDK↔API version table. |
| sdk/contentunderstanding/azure-ai-contentunderstanding/CHANGELOG.md | Adds 1.0.1 (Unreleased) entry describing the type-checking fix. |
...g/azure-ai-contentunderstanding/azure/ai/contentunderstanding/aio/_operations/_operations.py
Outdated
Show resolved
Hide resolved
sdk/contentunderstanding/azure-ai-contentunderstanding/CHANGELOG.md
Outdated
Show resolved
Hide resolved
...standing/azure-ai-contentunderstanding/samples/async_samples/sample_analyze_configs_async.py
Outdated
Show resolved
Hide resolved
Replace blanket mypy/pyright suppressions with proper type-safe patterns: - Use typing.cast() for AnalysisContent downcasts to DocumentContent/AudioVisualContent - Use conditional expressions for Optional[dict] field access (.fields.get()) - Use 'is not None' guards for Optional[list] append - Remove all pyright suppressions from all 16 sample files (8 sync + 8 async) - Remove mypy assignment/union-attr suppressions from all 16 files - Keep minimal mypy attr-defined suppression in only 4 files where needed (invoice samples: .value on field types; raw_json samples: .json() on response)
yungshinlintw
approved these changes
Mar 7, 2026
15f8c80 to
2edb17f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
From customer-reported issue: #45489
Fix type checker visibility for azure-ai-contentunderstanding models
The package included a hand-written
_models.pyistub that provided type info for the.valueproperty onContentFieldsubtypes. Per PEP 561,.pyistubs take complete precedence over.py— since the stub only declared 10 field classes, all other 41 generated model classes (e.g.AnalysisResult,AnalyzerDefinition) were invisible to pyright/mypy, causingUnknowntype errors.Fix: Deleted
_models.pyiand addedTYPE_CHECKING-guarded class redeclarations inmodels/_patch.pyinstead. This survives TypeSpec regeneration.Also includes:
1f65642(updated generated files:_operations.py,model_base.py,_models.py)[tool.azure-sdk-conda]topyproject.toml(fixesverifywhlCI check)"redef"tocspell.jsonignore listtest_model_exports_and_fields.pyto verify all models in__all__are importable, all field.valueproperties exist at runtime, and all TYPE_CHECKING redeclarations are properly exported through_patch.py's__all__.Verified: pyright 0 errors, all tests passed (playback)
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines