[AutoPR azure-ai-contentsafety]-generated-from-SDK Generation - Python-6640811 - #48375
[AutoPR azure-ai-contentsafety]-generated-from-SDK Generation - Python-6640811#48375azure-sdk-automation[bot] wants to merge 6 commits into
Conversation
…fig.yaml', API Version: 2026-07-01-preview, SDK Release Type: beta, and CommitSHA: '829ccecea7e9c1609881104b9a8d0f8cb65ce644' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6640811 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release.
|
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. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot could not run the full agentic suite for this review because it was automatically requested on a bot-authored pull request. Request a review from Copilot under Reviewers to retry with the full agentic suite. Improved support for bot-authored pull requests is coming soon.
Updates the azure-ai-contentsafety Python SDK to a newer REST spec commit and regenerates the client to include new preview APIs (Content Provenance, Shield Prompt, protected material), along with modernized packaging metadata.
Changes:
- Bumps generated code/spec commit and package version to
1.1.0b1, adding Content Provenance Detection, Shield Prompt, and protected-material APIs. - Migrates packaging from
setup.py/sdk_packaging.tomlto PEP 621pyproject.tomland updates dependencies / supported Python versions. - Adds generated samples/tests plus new sanitizer setup for recordings.
Reviewed changes
Copilot reviewed 62 out of 63 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/contentsafety/azure-ai-contentsafety/tsp-location.yaml | Updates swagger/spec commit reference; adjusts additional directory config. |
| sdk/contentsafety/azure-ai-contentsafety/tests/conftest.py | Minor formatting change in test proxy fixture file. |
| sdk/contentsafety/azure-ai-contentsafety/setup.py | Removes legacy setuptools build script (migration to pyproject). |
| sdk/contentsafety/azure-ai-contentsafety/sdk_packaging.toml | Removes old packaging config (moved into pyproject). |
| sdk/contentsafety/azure-ai-contentsafety/samples/sample_manage_blocklist.py | Adds pylint disables for generated-sample linting. |
| sdk/contentsafety/azure-ai-contentsafety/pyproject.toml | Introduces PEP 621 metadata / build-system; moves packaging config. |
| sdk/contentsafety/azure-ai-contentsafety/generated_tests/testpreparer_async.py | Adds generated async test base/preparer helpers. |
| sdk/contentsafety/azure-ai-contentsafety/generated_tests/testpreparer.py | Adds generated sync test base/preparer helpers. |
| sdk/contentsafety/azure-ai-contentsafety/generated_tests/test_content_safety_async.py | Adds generated async tests (currently skipped). |
| sdk/contentsafety/azure-ai-contentsafety/generated_tests/test_content_safety.py | Adds generated sync tests (currently skipped). |
| sdk/contentsafety/azure-ai-contentsafety/generated_tests/test_content_provenance_async.py | Adds generated async tests for provenance APIs (skipped). |
| sdk/contentsafety/azure-ai-contentsafety/generated_tests/test_content_provenance.py | Adds generated sync tests for provenance APIs (skipped). |
| sdk/contentsafety/azure-ai-contentsafety/generated_tests/test_blocklist_async.py | Adds generated async tests for blocklist APIs (skipped). |
| sdk/contentsafety/azure-ai-contentsafety/generated_tests/test_blocklist.py | Adds generated sync tests for blocklist APIs (skipped). |
| sdk/contentsafety/azure-ai-contentsafety/generated_tests/conftest.py | Adds sanitizer/test-proxy setup for generated recordings. |
| sdk/contentsafety/azure-ai-contentsafety/generated_samples/shield_prompt.py | Adds generated sample for Shield Prompt API. |
| sdk/contentsafety/azure-ai-contentsafety/generated_samples/remove_blocklist_items.py | Adds generated sample for removing blocklist items. |
| sdk/contentsafety/azure-ai-contentsafety/generated_samples/provenance_get_operation_status.py | Adds generated sample for querying provenance LRO status. |
| sdk/contentsafety/azure-ai-contentsafety/generated_samples/provenance_detect.py | Adds generated sample for starting provenance detection LRO. |
| sdk/contentsafety/azure-ai-contentsafety/generated_samples/list_text_blocklists.py | Adds generated sample for listing blocklists. |
| sdk/contentsafety/azure-ai-contentsafety/generated_samples/list_text_blocklist_items.py | Adds generated sample for listing blocklist items. |
| sdk/contentsafety/azure-ai-contentsafety/generated_samples/get_text_blocklist_item.py | Adds generated sample for fetching a blocklist item. |
| sdk/contentsafety/azure-ai-contentsafety/generated_samples/get_text_blocklist.py | Adds generated sample for fetching a blocklist. |
| sdk/contentsafety/azure-ai-contentsafety/generated_samples/detect_text_protected_material.py | Adds generated sample for protected-material detection API. |
| sdk/contentsafety/azure-ai-contentsafety/generated_samples/delete_text_blocklist.py | Adds generated sample for deleting a blocklist. |
| sdk/contentsafety/azure-ai-contentsafety/generated_samples/create_or_update_text_blocklist.py | Adds generated sample for creating/updating a blocklist. |
| sdk/contentsafety/azure-ai-contentsafety/generated_samples/analyze_text.py | Adds generated sample for text analysis API. |
| sdk/contentsafety/azure-ai-contentsafety/generated_samples/analyze_image.py | Adds generated sample for image analysis API. |
| sdk/contentsafety/azure-ai-contentsafety/generated_samples/add_or_update_blocklist_items.py | Adds generated sample for adding/updating blocklist items. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/types.py | Adds TypedDict request/shape types for the public surface. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/models/_patch.py | Updates patch header and __all__ typing style. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/models/_models.py | Regenerates models, adds provenance + shield/protected-material models, migrates model base/util imports. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/models/_enums.py | Adds provenance/polling enums; improves enum docstrings. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/models/init.py | Exposes new models/enums and updates import/patch mechanics. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/aio/_vendor.py | Removes legacy typing-only vendor mixins (replaced by shared utils). |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/aio/_patch.py | Updates patch header and __all__ typing style. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/aio/_operations/_patch.py | Updates patch header and __all__ typing style. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/aio/_operations/_operations.py | Adds provenance/shield/protected-material ops; refactors mixins and streaming/decompression handling. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/aio/_operations/init.py | Updates exports/import pattern for operations mixins. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/aio/_configuration.py | Adds ContentProvenance config; updates api version defaults. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/aio/_client.py | Adds async ContentProvenanceClient and refactors mixin inheritance; adds Self typing. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/aio/init.py | Exposes ContentProvenanceClient from aio namespace. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_version.py | Bumps package version to 1.1.0b1. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_vendor.py | Removes legacy typing-only vendor mixins (replaced by shared utils). |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_validation.py | Adds API-version gating decorator used by new preview operations. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_utils/utils.py | Adds shared internal ClientMixin ABC to replace vendor files. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_utils/init.py | Adds utils package init for internal helpers. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_patch.py | Updates patch header and __all__ typing style. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_operations/_patch.py | Updates patch header and __all__ typing style. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_operations/init.py | Updates exports/import pattern for operations mixins. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_model_base.py | Removes legacy model base implementation (replaced by new utils model base). |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_configuration.py | Adds ContentProvenance config; updates api version defaults. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_client.py | Adds sync ContentProvenanceClient and refactors mixin inheritance; adds Self typing. |
| sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/init.py | Exposes ContentProvenanceClient from sync namespace. |
| sdk/contentsafety/azure-ai-contentsafety/apiview-properties.json | Adds APIView cross-language metadata mappings for new surface area. |
| sdk/contentsafety/azure-ai-contentsafety/api.metadata.yml | Adds API parser metadata captured during generation. |
| sdk/contentsafety/azure-ai-contentsafety/api.md | Adds regenerated API signature document for review/validation. |
| sdk/contentsafety/azure-ai-contentsafety/_metadata.json | Adds generation metadata (api version, emitter version, spec commit). |
| sdk/contentsafety/azure-ai-contentsafety/MANIFEST.in | Minor formatting update. |
| sdk/contentsafety/azure-ai-contentsafety/CHANGELOG.md | Adds 1.1.0b1 entry placeholder text. |
Comments suppressed due to low confidence (5)
sdk/contentsafety/azure-ai-contentsafety/tsp-location.yaml:1
additionalDirectories:is now an explicit null value, whereas previously it was an empty list ([]). If tooling expects a list, this can break spec resolution; set this back toadditionalDirectories: [](or provide a proper YAML list).
sdk/contentsafety/azure-ai-contentsafety/pyproject.toml:1- PEP 621
project.licenseis not a plain string; it should be a table (e.g.,license = { text = \"MIT\" }) orlicense = { file = \"LICENSE\" }. As-is, some build backends may reject this metadata.
sdk/contentsafety/azure-ai-contentsafety/pyproject.toml:1 [tool.setuptools.package-data]keys must be package names (or\"*\"), not an arbitrary label. This likely preventspy.typedfrom being included in the built wheel. Use the actual package (e.g.azure.ai.contentsafety) or\"*\"to includepy.typed.
sdk/contentsafety/azure-ai-contentsafety/generated_samples/analyze_text.py:1- Using
boolas a sample value will serialize as a Python type object and will fail JSON serialization (TypeError: Object of type type is not JSON serializable) if the sample is run. Replace with a real boolean placeholder (e.g.True/False) to keep samples runnable.
sdk/contentsafety/azure-ai-contentsafety/generated_samples/shield_prompt.py:1 - These samples construct clients with
credentialas a plain string, but the SDK expects anAzureKeyCredentialor token credential type. Update the sample to show correct credential creation (e.g.AzureKeyCredential(...)orDefaultAzureCredential()), otherwise the sample will fail at runtime.
| def decorator(func): | ||
| @functools.wraps(func) | ||
| def wrapper(*args, **kwargs): | ||
| try: | ||
| # this assumes the client has an _api_version attribute | ||
| client = args[0] | ||
| client_api_version = client._config.api_version # pylint: disable=protected-access | ||
| except AttributeError: | ||
| return func(*args, **kwargs) | ||
|
|
||
| if _index_with_default(method_added_on) > _index_with_default(client_api_version): | ||
| raise ValueError( | ||
| f"'{func.__name__}' is not available in API version " | ||
| f"{client_api_version}. Pass service API version {method_added_on} or newer to your client." | ||
| ) | ||
|
|
||
| unsupported = { | ||
| parameter: api_version | ||
| for api_version, parameters in params_added_on.items() | ||
| for parameter in parameters | ||
| if parameter in kwargs and _index_with_default(api_version) > _index_with_default(client_api_version) | ||
| } | ||
| if unsupported: | ||
| raise ValueError( | ||
| "".join( | ||
| [ | ||
| f"'{param}' is not available in API version {client_api_version}. " | ||
| f"Use service API version {version} or newer.\n" | ||
| for param, version in unsupported.items() | ||
| ] | ||
| ) | ||
| ) | ||
| return func(*args, **kwargs) |
| """Analyze Image. | ||
|
|
||
| A synchronous API for the analysis of potentially harmful image content. Currently, it supports | ||
| four categories: Hate, SelfHarm, Sexual, and Violence. |
| ## 1.1.0b1 (2026-07-30) | ||
|
|
||
| skip changelog generation for data-plane package and please add changelog manually. |
This comment has been minimized.
This comment has been minimized.
…test_blocklist.py)
…ests/test_content_safety.py)
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 61 out of 62 changed files in this pull request and generated no new comments.
Suppressed comments (6)
sdk/contentsafety/azure-ai-contentsafety/pyproject.toml:16
- The release version is
1.1.0b1, but this metadata advertises the distribution as Production/Stable. Beta package versions in this repository useDevelopment Status :: 4 - Beta(for example,sdk/search/azure-search-documents/pyproject.toml:20), so PyPI metadata would otherwise misrepresent this release.
sdk/contentsafety/azure-ai-contentsafety/pyproject.toml:26 - This raises the minimum Python version from 3.7 to 3.10, but the new changelog entry does not disclose that 3.7–3.9 support is dropped, and
README.md:21still says Python 3.7 is supported. Update both user-facing documents so affected users are warned before upgrading.
sdk/contentsafety/azure-ai-contentsafety/generated_tests/test_content_provenance.py:14 - This class-level skip leaves both new provenance operations entirely untested; the existing package tests cover only Content Safety and Blocklist clients, while the async generated counterpart is also skipped. Add runnable sync and async coverage for starting, polling, and retrieving a provenance operation before releasing the new client.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/types.py:201 blocklistItemIdis service-generated and read-only (the generated model also gives itvisibility=["read"]), so requiring it in this request TypedDict rejects valid request dictionaries during type checking and led the generated sample to send a fabricated ID. Exclude the read-only field from the input shape and update the generated API artifacts/sample accordingly.
sdk/contentsafety/azure-ai-contentsafety/CHANGELOG.md:12- The release also exposes the new
DetectOutcomeenum, but this enum list omits it. Include it so the release notes accurately describe the provenance API surface.
- Added enums `DetectedProvenanceType` and `ProvenanceOperationKind`.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/models/_models.py:786
- The public model documentation uses the plural “properties” after the singular article “An.” Fix the source description to “An optional property…” and regenerate so the duplicate generated docstrings stay consistent.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 61 out of 62 changed files in this pull request and generated no new comments.
Suppressed comments (5)
sdk/contentsafety/azure-ai-contentsafety/pyproject.toml:1
[tool.setuptools.package-data]keys are package names, butpytypedis not a package. This will likely preventpy.typedfrom being included in the built wheel/sdist. Use the actual package name key (e.g.,azure.ai.contentsafety) for thepy.typedentry so typing markers are shipped correctly.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/models/_models.py:1ODataV4Formatis referenced in docstrings/types asazure.core.ODataV4Format, but it's imported fromazure.core.exceptions. This is likely an import-path bug that can raiseImportErrorat runtime. ImportODataV4Formatfrom the correctazure.coremodule/path that actually defines it (and keep the annotation consistent).
sdk/contentsafety/azure-ai-contentsafety/tsp-location.yaml:1additionalDirectories:is now present without a value, which parses asnull(not a list). Tooling that expects a list (previously[]) can break. Set it explicitly to an empty list (additionalDirectories: []) or provide the intended list values.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/types.py:1- The TypedDict field is named
blocklistItems, but the docstring documentsblocklist_items. This mismatch makes the public typing/docs confusing. Update the docstring to document the actual key name(s) supported by the TypedDict (blocklistItems, and optionally any snake_case alias if intentionally supported).
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_validation.py:36 api_version_validationalways wraps with a syncdef wrapper, even when decoratingasync defAPIs. When stacked with@distributed_trace_async, this can break coroutine detection/async tracing behavior because the wrapped callable is no longer aniscoroutinefunction. Consider generating anasync def wrapperwhenfuncis async (e.g., viainspect.iscoroutinefunction(func)) andawait func(...)to preserve async semantics and tracing compatibility.
def decorator(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
try:
# this assumes the client has an _api_version attribute
client = args[0]
client_api_version = client._config.api_version # pylint: disable=protected-access
This comment has been minimized.
This comment has been minimized.
…minimum in CHANGELOG
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 61 out of 62 changed files in this pull request and generated no new comments.
Suppressed comments (3)
sdk/contentsafety/azure-ai-contentsafety/pyproject.toml:16
- This release is explicitly beta and
_version.pysets1.1.0b1, but this classifier advertises the distribution as production/stable on package indexes. Use the Beta classifier, as other beta packages do (for examplesdk/search/azure-search-documents/pyproject.toml:20andsdk/identity/azure-identity/pyproject.toml:15).
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/types.py:201 blocklistItemIdis server-generated and read-only in the source contract, yet this requestTypedDictmakes it required. Consequently, the dictionary overload cannot type-check the valid create shape used by the existing model-based tests without supplying a read-only value, and plain dictionaries will serialize that value instead of filtering it. Generate a request shape that omits this read-only property (and refresh the derived API snapshot/samples).
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_client.py:120- The maintained test suite covers the existing clients but has no executable coverage for this new provenance client or its LRO behavior. Add sync coverage for
begin_detect/polling andget_operation_status(and async coverage where supported), including response deserialization and failure paths, before releasing the new API.
class ContentProvenanceClient(_ContentProvenanceClientOperationsMixin):
[Pilot] PR Pipeline Failure AnalysisA CI pipeline failed on this pull request. Here is an automated analysis of what went wrong and how to get the build green. What failedTwo categories of failures were detected in the pipeline run:
Both failures share the same root cause: the package metadata ( Recommended next steps
Raw pipeline analysis (azsdk ci analyze)
|
Configurations: 'specification/cognitiveservices/ContentSafety/tspconfig.yaml', API Version: 2026-07-01-preview, SDK Release Type: beta, and CommitSHA: '829ccecea7e9c1609881104b9a8d0f8cb65ce644' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6640811 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. Release plan link: https://azsdk-releaseplan-dashboard-hveph5aqhhcfhtgu.westus-01.azurewebsites.net/?releaseplan=2242 Submitted by: Connor.Wood@microsoft.com