Open luizribeiro opened 3 years ago
Ironically, this is hitting us as well when running Pyre on Pyre. cc @grievejia
Thanks for the report! Yeah I think the issue here is actually more general: currently Pyre interprets elements in search_path
to be all directories. This fundamentally limits its capability to handle single-file Python modules. Both the OCaml side and the Python side have to be updated to address the issue.
As a temporary workaround, @dkgi recently added a feature where if search_path
is not specified in the configuration and if a venv
is detected, Pyre would automatically include every site package in the venv. And that would work with single-file packages. The feature is currently only available in pyre-check-nightly
but let me cut a new pyre-check
release this afternoon to make it more accessible.
One of my projects that uses
pyre
depends onpypng
, which is a Python module that consists of a single.py
file (i.e. its path is<venv>/lib/python3.9/site-packages/png.py
).I tried adding it to the search path by doing this:
But then
pyre rage
shows me that that path was just ignored since it's non-existent:This makes sense, since the real path is
.../png.py
, so I tried{ "site-package": "png.py" }
instead, but thenpyre
just fatals with this message:It seemed to me like the problem was on the OCaml side, so I found this:
https://github.com/facebook/pyre-check/blob/c1d0995b111f352c6abc69725b51c906b0199393/source/service/infer.ml#L68-L73
Do we really need to make the assumption that all search paths are directories?