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

Exclude should not exclude search_path

Open nasyxx opened this issue 4 years ago • 1 comments

I use pdm to manage my local packages. It supports PEP582. Thus, my directory tree is like this:

.
├── __pypackages__
│  └── 3.8
│     ├── lib
│     │   ├── package1
│     │   ├── packages
...
├── xxxx.py
├── pdm.lock
└── pyproject.toml

When we use pyre, we want to ignore the __pypackages__ folder.

PEP582 uses __pypackages__ as the local packages directory. When we use pyre, we should add a path like __pypackages__/3.8/lib to search_path.

So one example config file here:

{
  "binary": "/Users/Nasy/Library/Python/3.8/bin/pyre.bin",
  "source_directories": [
    "."
  ],
  "taint_models_path": "/Users/Nasy/Library/Python/3.8/lib/pyre_check/taint/",
  "typeshed": "/Users/Nasy/Library/Python/3.8/lib/pyre_check/typeshed/",
  "exclude": [".*/__pypackages__/.*"],
  "search_path": ["./__pypackages__/3.8/lib/"]
}

Now if we use pyre check, it will tell you that

xxxx.py:4:0 Undefined import [21]: Could not find a module corresponding to import `package1`.

I guess this is incorrect behaviour. pyre should not ignore the search path when the search path is one of the excluded folders.

nasyxx avatar Jun 22 '20 05:06 nasyxx

cc: @shannonzhu @grievejia this might be relevant for the config changes that have been discussed.

MaggieMoss avatar Mar 19 '21 18:03 MaggieMoss