Skip to content

Refactor Python projection around semantic type identity - #111

Merged
leileizhang (lei9444) merged 1 commit into
mainfrom
lei9444-python-semantic-identity
Sep 1, 2026
Merged

leileizhang (lei9444) merged 1 commit into
mainfrom
lei9444-python-semantic-identity

Conversation

@lei9444

Copy link
Copy Markdown
Contributor

Summary

  • introduce a canonical namespace-, kind-, and recursively generic-aware type identity for Python projection naming, paths, aliases, inventory, and collision diagnostics
  • replace thread-local module-layout state with an explicit immutable PythonProjectionContext threaded through runtime and stub generation
  • allow same-short-name interfaces and delegates to coexist through deterministic implementation modules and consumer aliases, while keeping namespace facade names and omitting ambiguous root exports
  • preserve exact IID/PIID-based ABI construction separately from projected display names and fail closed on conflicting ABI identities
  • keep JavaScript dependency resolution on its existing short-name behavior

This PR is stacked on #108 and should target fix/python-long-path-static-projection until that PR merges.

Validation

  • cargo test -p dynwinrt-codegen --quiet
  • cargo test -p dynwinrt --quiet (247 passed, 1 ignored, plus doc tests)
  • Python binding suite: 129 tests passed
  • mypy.stubtest dynwinrt: 2 modules passed
  • Python E2E: strict mypy clean; 42/42 scenarios passed
  • representative generated graph: 1,123 .py/.pyi sources compiled, repeated generation byte-stable, module basenames capped at 120 characters
  • generated Uri wheel: 35 files verified and 17 modules imported

eng/release/python/test_generated_python_long_paths.ps1 passes generation, hashing, incremental preservation, and cache-rotation checks, then the setuptools wheel phase hits legacy MAX_PATH because this machine has LongPathsEnabled=0. The exact #108 baseline fails at the same wheel step.

@lei9444
leileizhang (lei9444) force-pushed the lei9444-python-semantic-identity branch from 244aa37 to d5c377c Compare September 1, 2026 01:59
@lei9444
leileizhang (lei9444) changed the base branch from fix/python-long-path-static-projection to main September 1, 2026 02:32
Use canonical namespace- and kind-aware identities for Python names, modules, imports, delegates, and closed generics. Replace thread-local layout state with an explicit projection context and preserve ambiguous types through namespace facades.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@lei9444
leileizhang (lei9444) force-pushed the lei9444-python-semantic-identity branch from d5c377c to e4c9a0e Compare September 1, 2026 03:12
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Mixed-language test coverage

Workflow status: ✅ Passed

Layer Lines Functions Branches/regions
Rust, including native .pyd/.node 82.56% 78.87% 82.48% regions
Generated Python projections 70.48% n/a 21.71% branches
JavaScript aggregate 21.24% 20.56% 53.98% branches
JavaScript runtime 19.91% 14.28% 7.14% branches
Generated WinRT projections 25.74% 19.25% 54.66% branches
Generated Classic COM projections 14.65% 24.46% 53.75% branches

View workflow run and download full HTML/LCOV/XML reports

@lei9444
leileizhang (lei9444) merged commit 3dbf651 into main Sep 1, 2026
26 checks passed
@lei9444
leileizhang (lei9444) deleted the lei9444-python-semantic-identity branch September 1, 2026 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants