Add support for PEP-610 editable packages (#12313) #12315
Draft
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.
Description
Discover paths to editable packages by looking at direct_url.json files
-- installed by pip when the -e/--editable flag is used -- and add to
the package search paths.
Closes #12313
This PR adds paths defined in *.dist-info/direct_url.json files, where the appropriate keys exist (including editable set to true), to the list of paths discovered in .pth files.
Test Plan
Tests were added to ensure paths were found using the new functionality without breaking the old. The tests add two new test packages, one of them typed. The tests then ensure that the paths for the editable projects are found and that the typed package is detected as such, while the untyped package is rejected as untyped.
Another .dist-info directory was added for the foo package just to ensure that the new feature doesn't break with other direct reference packages.
I also tested this on the real-world package where I first discovered the issue.