Repository navigation
Use src layout for generated Python packages - #228
Merged
Merged
Conversation
Keep project manifests and resource ownership at the output root, relocate package sources and build-only hooks, and validate packaging, editable imports and upgrade protection. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Mixed-language test coverageWorkflow status: ✅ Passed
|
Point both standard and implementation consumers at each generated project's src root. Verify orchestrator error propagation and MYPYPATH restoration, and exercise src paths in coverage fixtures. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Kai Tao (vanzue)
approved these changes
Oct 30, 2026
shisan (qiutongMS)
approved these changes
Oct 30, 2026
Preserve AsyncEventScope and its cancellation regressions alongside generated src package installation and editable checks. Adapt the new async event runner and sample to the project/source layout. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
shisan (qiutongMS)
approved these changes
Oct 30, 2026
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.
Summary
Fix static analysis of generated Python packages installed with default
pip install -e. Previously, Python could import the package through setuptools' dynamic editable finder, but mypy and Pyright could report missing imports. Generate a standardsrclayout so default editable installs expose an ordinary source-path.pththat both checkers understand.Bootstrap runtime resources move with the import package. Its build-only hook stays outside that package and is excluded from installed wheels. Generation remains transactional, including package renames, ownership checks and rollback.
Reproduction and expected behavior
Generate and install into a dedicated consumer environment with matching runtime/codegen versions:
Check this consumer using that environment with mypy and Pyright:
Before: the editable package could be imported at runtime while static analysis failed to resolve it. After: the valid call passes, and the invalid call is rejected as an argument-type error. The negative diagnostic is the expected successful validation, not a generator failure.
Compatibility and upgrade
--outputremains the installable project root. Installation commands, normalized import/distribution names, public imports, the exact runtime dependency pin, and runtime API/ABI are unchanged. JS output layout is unchanged; this does not change async callback behavior.Breaking source-layout change: clean old generated output, regenerate the complete selection, and reinstall. Old-layout output is rejected rather than partially migrated. Code that deliberately imports uninstalled sources must use
<output>/srcinstead ofoutput.parent. Same-path editable regeneration exposes added types to new Python/checker processes without reinstalling; it is not module hot reload.Validation
All checks used the actual modified codegen, not relocated prototype output.
eng/release/python/test_generated_python_layout.pySource-level typing regressions used the repository's mypy
<2constraint (1.20.2); installed consumers passed 2.4.0.cargo fmt --all -- --checkandgit diff --checkpassed.Local execution was CPython 3.12 x64; other Python versions and native ARM64 CI have not been run locally. Actual Pylance host startup was attempted twice but blocked before extension startup by the existing VS Code update mutex, so Pylance is not marked passed. No GUI or native Windows App Runtime initialization was exercised. The unrelated E2E runner count assertion (
20 != 19) was reproduced with the same selector/interpreter on both main and this branch and is not changed here.