Repository navigation
Resolve generated stubs alongside editable packages - #4535
Open
ting-hong-shieh wants to merge 1 commit into
Open
ting-hong-shieh wants to merge 1 commit into
ting-hong-shieh wants to merge 1 commit into
Conversation
Contributor
|
This pull request has been imported. If you are a Meta employee, you can view this in D115850824. (Because this pull request was imported automatically, there will not be any future comments.) |
Contributor
Author
|
The Meta Linter check is currently reporting Action Required, but the internal details are not accessible to external contributors. Could someone with access share the failing diagnostic so I can address it? Thanks! |
This comment has been minimized.
This comment has been minimized.
ting-hong-shieh
force-pushed
the
fix/2859-generated-stubs
branch
from
September 4, 2026 05:03
3000f2c to
8173d2e
Compare
This comment has been minimized.
This comment has been minimized.
Keep generated stubs from typed namespace roots available when a later editable source directory provides the regular package initializer.
ting-hong-shieh
force-pushed
the
fix/2859-generated-stubs
branch
from
September 10, 2026 23:38
8173d2e to
2022beb
Compare
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Contributor
|
@connernilsen would you be able to take a look at this one? At a glance, the code looks reasonable to me, but I think you have more context on what the intended/correct behavior should be. |
rchen152
requested review from
connernilsen
and removed request for
NathanTempest and
maggiemoss
November 3, 2026 00:15
This branch has not been deployed
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
__init__.pyas the package moduleRoot cause
Generated stubs installed next to an extension module form an implicit namespace package. When an editable source directory later supplied the package's
__init__.py, normal regular-package precedence discarded the earlier namespace root, so submodules such as_core.pyiwere no longer visible.The overlay is limited to namespace roots containing
py.typed, preserving existing behavior for ordinary implicit namespace packages.User impact
Editable installs can expose their source package and generated extension stubs at the same time, so imported native APIs retain their declared types.
Testing
cargo test module::finder::tests(71 tests)cargo test test_editable_install_generated_stub_overlaytest.pyFixes #2859