Skip to content

[Python] Speed up xml deserialization#10698

Open
annatisch wants to merge 8 commits into
mainfrom
xmlperf
Open

[Python] Speed up xml deserialization#10698
annatisch wants to merge 8 commits into
mainfrom
xmlperf

Conversation

@annatisch
Copy link
Copy Markdown
Member

No description provided.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:python Issue for the Python client emitter: @typespec/http-client-python label May 14, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 14, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-python@10698

commit: e81f986

@azure-sdk-automation
Copy link
Copy Markdown

azure-sdk-automation Bot commented May 14, 2026

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 14, 2026

All changed packages have been documented.

  • @typespec/http-client-python
Show changes

@typespec/http-client-python - fix ✏️

Improve generated XML deserialization performance in Python by avoiding unnecessary parent traversal during field lookup.

Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/ce6fff89-aa07-4a38-881f-b8ac55b866c5

Co-authored-by: l0lawrence <100643745+l0lawrence@users.noreply.github.com>
l0lawrence and others added 2 commits May 15, 2026 14:36
…zer_name

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ted models

The XML deserializer fast-path emits `functools.partial(_xml_deser_enum_or_str, EnumName)`

in generated `_models.py`. That call is evaluated at class-body time, so `EnumName`

must be in the module's runtime globals. Previously the enum import was routed to the

`TYPE_CHECKING` block (see `EnumType.imports` for `NamespaceType.MODEL` +

`called_by_property`), causing `NameError` at import time.

Track each enum used as an XML deserializer and add a runtime `from ._enums import

EnumName` import alongside the existing `_xml_deser_enum_or_str` import.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ing _enums

Generated _models.py was emitting rom .._enums import Status because the
relative path was computed against the enum's client_namespace (e.g.
payload.xml) rather than the models subpackage where _enums.py actually
resides (payload.xml.models). Use get_imported_namespace_for_model to
target the sibling _enums module.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@msyyc
Copy link
Copy Markdown
Contributor

msyyc commented May 18, 2026

Copilot AI and others added 2 commits May 18, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:python Issue for the Python client emitter: @typespec/http-client-python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants