-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[Search 2026-08-01-preview] python SDK codegen #48349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
efrainretana
merged 23 commits into
main
from
copilot/generate-azure-search-sdk-python-2026-08-01-previe
Aug 24, 2026
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
278e23d
Initial plan
Copilot 005e456
[Search 2026-08-01-preview] Add 2026-08-01-preview ApiVersion; docume…
Copilot e6ebb5d
[Search] Update tsp-location.yaml to spec commit f05186b; begin regen…
Copilot 8062791
[Search] Regenerate at spec commit f05186b; document persistent codeg…
Copilot 4f4d5f2
Regen with latest commit SHA
efrainretana 59ef7ac
Update tests and changelog
efrainretana dd513aa
[Search] Refresh api.md and api.metadata.yml via azpysdk apistub
Copilot efdf4b9
Export api md
efrainretana bd17d60
updatet api.md
efrainretana 4d70bd6
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
efrainretana 4412fcb
regen w/ new version
efrainretana 784c6c4
Clean build
efrainretana b779636
Fix linter
efrainretana 6aed2fd
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
efrainretana ddfbc4c
Merge branches 'copilot/generate-azure-search-sdk-python-2026-08-01-p…
efrainretana 8ffa3ec
Regen with latest commit SHA, finalize SDK, update samples
efrainretana e971b75
Merge branch 'copilot/generate-azure-search-sdk-python-2026-08-01-pre…
efrainretana 91c6f8c
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
efrainretana 1564a40
Final regen
efrainretana 3467e7d
Merge branch 'copilot/generate-azure-search-sdk-python-2026-08-01-pre…
efrainretana d866d09
Add File KKS tests, green tests
efrainretana 4a402b6
Address copilot comments
efrainretana db151fc
Fix type import error
efrainretana File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
212 changes: 212 additions & 0 deletions
212
...ch-documents/.github/skills/azure-search-documents/scripts/apply_generator_workarounds.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,212 @@ | ||
| #!/usr/bin/env python3 | ||
| """Apply temporary azure-search-documents Python emitter workarounds. Delete when emitter fixes the issues.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import argparse | ||
| from dataclasses import dataclass | ||
| from pathlib import Path | ||
|
|
||
|
|
||
| PACKAGE_ROOT = Path(__file__).resolve().parents[4] | ||
|
|
||
|
|
||
| @dataclass(frozen=True) | ||
| class Replacement: | ||
| path: str | ||
| description: str | ||
| generated: str | ||
| patched: str | ||
| applies_when: str | None = None | ||
|
|
||
|
|
||
| REPLACEMENTS = ( | ||
| Replacement( | ||
| "azure/search/documents/models/__init__.py", | ||
| "export SemanticQueryRewritesResultType", | ||
| """ SemanticFieldState, | ||
| SemanticSearchResultsType, | ||
| """, | ||
| """ SemanticFieldState, | ||
| SemanticQueryRewritesResultType, | ||
| SemanticSearchResultsType, | ||
| """, | ||
| ), | ||
| Replacement( | ||
| "azure/search/documents/models/__init__.py", | ||
| "include SemanticQueryRewritesResultType in __all__", | ||
| """ "SemanticFieldState", | ||
| "SemanticSearchResultsType", | ||
| """, | ||
| """ "SemanticFieldState", | ||
| "SemanticQueryRewritesResultType", | ||
| "SemanticSearchResultsType", | ||
| """, | ||
| ), | ||
| Replacement( | ||
| "azure/search/documents/types.py", | ||
| "use the imported SemanticQueryRewritesResultType enum", | ||
| '"@search.semanticQueryRewritesResultType": Union[str, "_enums.SemanticQueryRewritesResultType"],', | ||
| '"@search.semanticQueryRewritesResultType": Union[str, "SemanticQueryRewritesResultType"],', | ||
|
efrainretana marked this conversation as resolved.
|
||
| applies_when="@search.semanticQueryRewritesResultType", | ||
| ), | ||
| Replacement( | ||
| "azure/search/documents/knowledgebases/types.py", | ||
| "remove the duplicate KnowledgeSourceKind type-only import", | ||
| """ KnowledgeSourceIngestionPermissionOption, | ||
| KnowledgeSourceKind, | ||
| KnowledgeSourceResultsProcessing, | ||
| """, | ||
| """ KnowledgeSourceIngestionPermissionOption, | ||
| KnowledgeSourceResultsProcessing, | ||
| """, | ||
| applies_when="KnowledgeSourceIngestionPermissionOption", | ||
| ), | ||
| Replacement( | ||
| "azure/search/documents/indexes/types.py", | ||
| "avoid overriding TypedDict field requiredness", | ||
| """class SearchIndexerKnowledgeStoreTableProjectionSelector( | ||
| SearchIndexerKnowledgeStoreProjectionSelector | ||
| ): # pylint: disable=name-too-long | ||
| \"\"\"Description for what data to store in Azure Tables. | ||
|
|
||
| :ivar referenceKeyName: Name of reference key to different projection. | ||
| :vartype referenceKeyName: str | ||
| :ivar source: Source data to project. | ||
| :vartype source: str | ||
| :ivar sourceContext: Source context for complex projections. | ||
| :vartype sourceContext: str | ||
| :ivar inputs: Nested inputs for complex projections. | ||
| :vartype inputs: list[\"InputFieldMappingEntry\"] | ||
| :ivar generatedKeyName: Name of generated key to store projection under. Required. | ||
| :vartype generatedKeyName: str | ||
| :ivar tableName: Name of the Azure table to store projected data in. Required. | ||
| :vartype tableName: str | ||
| \"\"\" | ||
|
|
||
| generatedKeyName: Required[str] | ||
| \"\"\"Name of generated key to store projection under. Required.\"\"\" | ||
| tableName: Required[str] | ||
| \"\"\"Name of the Azure table to store projected data in. Required.\"\"\" | ||
| """, | ||
| ( | ||
| "class SearchIndexerKnowledgeStoreTableProjectionSelector(TypedDict, total=False): " | ||
| "# pylint: disable=name-too-long\n" | ||
| """ \"\"\"Description for what data to store in Azure Tables. | ||
|
|
||
| :ivar referenceKeyName: Name of reference key to different projection. | ||
| :vartype referenceKeyName: str | ||
| :ivar source: Source data to project. | ||
| :vartype source: str | ||
| :ivar sourceContext: Source context for complex projections. | ||
| :vartype sourceContext: str | ||
| :ivar inputs: Nested inputs for complex projections. | ||
| :vartype inputs: list[\"InputFieldMappingEntry\"] | ||
| :ivar generatedKeyName: Name of generated key to store projection under. Required. | ||
| :vartype generatedKeyName: str | ||
| :ivar tableName: Name of the Azure table to store projected data in. Required. | ||
| :vartype tableName: str | ||
| \"\"\" | ||
|
|
||
| referenceKeyName: str | ||
| \"\"\"Name of reference key to different projection.\"\"\" | ||
| source: str | ||
| \"\"\"Source data to project.\"\"\" | ||
| sourceContext: str | ||
| \"\"\"Source context for complex projections.\"\"\" | ||
| inputs: list[\"InputFieldMappingEntry\"] | ||
| \"\"\"Nested inputs for complex projections.\"\"\" | ||
| generatedKeyName: Required[str] | ||
| \"\"\"Name of generated key to store projection under. Required.\"\"\" | ||
| tableName: Required[str] | ||
| \"\"\"Name of the Azure table to store projected data in. Required.\"\"\" | ||
| """ | ||
| ), | ||
| ), | ||
| Replacement( | ||
| "azure/search/documents/indexes/types.py", | ||
| "import KnowledgeSourceIngestionParameters from the public models namespace", | ||
| " from ..knowledgebases.types import KnowledgeRetrievalReasoningEffort, KnowledgeSourceIngestionParameters\n", | ||
| " from ..knowledgebases.models import KnowledgeSourceIngestionParameters\n" | ||
| " from ..knowledgebases.types import KnowledgeRetrievalReasoningEffort\n", | ||
| ), | ||
|
efrainretana marked this conversation as resolved.
|
||
| Replacement( | ||
| "azure/search/documents/indexes/_operations/_operations.py", | ||
| "suppress protected access for the generated SearchIndexResponse type", | ||
| " list[_models1._models.SearchIndexResponse],\n" | ||
| ' deserialized.get("value", []),\n' | ||
| " )", | ||
| " list[_models1._models.SearchIndexResponse], # pylint: disable=protected-access\n" | ||
| ' deserialized.get("value", []),\n' | ||
| " )", | ||
| ), | ||
| Replacement( | ||
| "azure/search/documents/indexes/aio/_operations/_operations.py", | ||
| "suppress protected access for the generated async SearchIndexResponse type", | ||
| " list[_models2._models.SearchIndexResponse],\n" | ||
| ' deserialized.get("value", []),\n' | ||
| " )", | ||
| " list[_models2._models.SearchIndexResponse], # pylint: disable=protected-access\n" | ||
| ' deserialized.get("value", []),\n' | ||
| " )", | ||
| ), | ||
| ) | ||
|
|
||
|
|
||
| def update_sources(*, check: bool) -> int: | ||
| sources: dict[Path, str] = {} | ||
| pending: list[str] = [] | ||
|
|
||
| for replacement in REPLACEMENTS: | ||
| path = PACKAGE_ROOT / replacement.path | ||
| source = sources.setdefault(path, path.read_text(encoding="utf-8")) | ||
| generated_count = source.count(replacement.generated) | ||
| patched_count = source.count(replacement.patched) | ||
|
|
||
| if generated_count == 1 and patched_count == 0: | ||
| sources[path] = source.replace(replacement.generated, replacement.patched, 1) | ||
| pending.append(replacement.description) | ||
| elif generated_count == 0 and patched_count == 1: | ||
| continue | ||
| elif replacement.applies_when is not None and replacement.applies_when not in source: | ||
| continue | ||
| else: | ||
| raise RuntimeError( | ||
| f"Unexpected emitter output in {replacement.path} while attempting to " | ||
| f"{replacement.description}; expected exactly one generated or patched snippet" | ||
| ) | ||
|
|
||
| if check: | ||
| if pending: | ||
| print("Generator workarounds are required:") | ||
| for description in pending: | ||
| print(f"- {description}") | ||
| return 1 | ||
| print("Generator workarounds are applied.") | ||
| return 0 | ||
|
|
||
| for path, source in sources.items(): | ||
| path.write_text(source, encoding="utf-8") | ||
|
|
||
| if pending: | ||
| print("Applied generator workarounds:") | ||
| for description in pending: | ||
| print(f"- {description}") | ||
| else: | ||
| print("Generator workarounds were already applied.") | ||
| return 0 | ||
|
|
||
|
|
||
| def main() -> int: | ||
| parser = argparse.ArgumentParser(description=__doc__) | ||
| parser.add_argument( | ||
| "--check", | ||
| action="store_true", | ||
| help="verify that all workarounds are applied without changing files", | ||
| ) | ||
| args = parser.parse_args() | ||
| return update_sources(check=args.check) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| raise SystemExit(main()) | ||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.