Skip to content

Conversation

@connernilsen
Copy link
Contributor

Summary:
Pyrefly has some logic to add all site-package-path entries to project-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 src as the project directory, lib is used.

This diff instead uses all search-path entries, 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 in search-path will always be able to be included in project-includes.

Fixes #1498

Reviewed By: kinto0

Differential Revision: D86682740

…xclude search path

Summary:
Pyrefly has some logic to add all `site-package-path` entries to `project-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 `src` as the project directory, `lib` is used.

This diff instead uses all `search-path` entries, 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 in `search-path` will always be able to be included in `project-includes`.

Fixes facebook#1498

Reviewed By: kinto0

Differential Revision: D86682740
@meta-cla meta-cla bot added the cla signed label Nov 10, 2025
@meta-codesync
Copy link

meta-codesync bot commented Nov 10, 2025

@connernilsen has exported this pull request. If you are a Meta employee, you can view the originating Diff in D86682740.

Copy link
Contributor

@kinto0 kinto0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Import root is wrongly inferred, no way to override?

2 participants