-
Notifications
You must be signed in to change notification settings - Fork 433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve site package pathing #781
base: main
Are you sure you want to change the base?
Improve site package pathing #781
Conversation
de998fd
to
a1ddd8f
Compare
25b3ba8
to
eb713ca
Compare
3515d36
to
66edd67
Compare
bb2e017
to
660ac4c
Compare
512b3da
to
93863db
Compare
@inseokhwang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Hi! It seems like your issue is site packages are not being detected? Is this on windows? Would you be able to try on WSL since we currently do not support windows? |
If the `excepted_path` is not None, it will must be a exists path
e03afd8
to
7e6afcb
Compare
pyre-check/client/configuration/search_path.py Lines 76 to 77 in baad875
Pyre only treat a .py file as a site-package, and this PR improved the pathing of site-package. |
1ae4897
to
98dd4f7
Compare
98dd4f7
to
1608b6a
Compare
…wlist with set-comprehension
I'm not convinced yet that this is the right approach. I left some comments but I'll also bring it up with the team. General feedback:
|
@@ -35,11 +44,11 @@ def _expand_relative_root(path: str, relative_root: str) -> str: | |||
|
|||
class Element(abc.ABC): | |||
@abc.abstractmethod | |||
def path(self) -> str: | |||
def path(self) -> Union[str, None]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Optional[str]
could you explain the reasoning and semantic differences for making this optional in the summary?
dbb289a
to
6bedb96
Compare
Here is a tasklist for this PR:
|
@kinto0 For the second task, I guess this may because a |
Pre-submission checklist
pip install -r requirements-dev.txt && pre-commit install
pre-commit run
Summary
A top-level package could implement by many ways, like
.so
,.pyd
file, etc.However,
pyre
only treat a.py
file as a top-level package:pyre-check/client/configuration/search_path.py
Lines 76 to 77 in 689a8be
This PR improved the pathing by seeing the
RECORD
file in the package'sdist-info
e.g.This is the
RECORD
file in thedist-info
of theujson
(ujson-5.8.0.dist-info):As you see, We only need
ujson.cpython-310-x86_64-linux-gnu.so
but there are a lot of other unnessarry files in theRECORD
.For this, I filterd them out by matching if the file is inXXX-XXX.dist-info
or__pycache__
.Also see #773 (comment).
Issue fixed: #773
Test Plan
Before this PR:
![image](https://private-user-images.githubusercontent.com/120731947/268479472-ec4b1154-ab76-4321-9114-8475c6b9434e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU1OTg2OTMsIm5iZiI6MTcyNTU5ODM5MywicGF0aCI6Ii8xMjA3MzE5NDcvMjY4NDc5NDcyLWVjNGIxMTU0LWFiNzYtNDMyMS05MTE0LTg0NzVjNmI5NDM0ZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTA2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkwNlQwNDUzMTNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00MzUxMDFjMjM4MjFmMmYyMzI5OWVkMTJmYjhlZjZkYTY0OTU5NDkzNzVlZDI4OGE5MmQ4NzAxMTA2NDE3Zjk3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.9wdP--GrLdNR_noH0-nDxjEiTybWxGvXwJrPJxKcndY)
After this PR: