pyre-check icon indicating copy to clipboard operation
pyre-check copied to clipboard

How to support env['PYTHONPATH']

Open kylinlingh opened this issue 1 year ago • 1 comments

Hi, After setting the environment variable as:

export PYTHONPATH='/absolute/path/to/my/project' 

I used absolute imports in different packages of my Python project. However, when I use pyre_dump(), I notice that the call graph construction fails and it cannot find the actually called functions. code directory:

. |── app │   |── api │   │   |── risk.py │   |── model │   │   |── request.py

code of file app/api/risk.py:

from model.risk_request import RiskRequest

when I change the import as below, pyre will work fine

from ..model.risk_request import RiskRequest

How can I resolve this issue?

kylinlingh avatar May 22 '24 10:05 kylinlingh

If you expect to be able to import model.risk_request directly, then the search path you need is probably '/absolute/path/to/my/project/app' rather than '/absolute/path/to/my/project'

stroxler avatar May 29 '24 17:05 stroxler