Filter project excludes for site package path entries if they would exclude search path #1533
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:
Pyrefly has some logic to add all
site-package-pathentries toproject-excludes, but sometimes the Python interpreter includes the root of the project. Historically, we've filtered this out by using the project root, but if the actual project root differs from what Pyrefly thinks it is, we might end up excluding the project by default.This happens in legacy projects, where instead of using
srcas the project directory,libis used.This diff instead uses all
search-pathentries, not just Pyrefly's heuristic project root, to determine if a site package path should be added. This way, anything that might be considered "project code" because it's insearch-pathwill always be able to be included inproject-includes.Fixes #1498
Reviewed By: kinto0
Differential Revision: D86682740