-
Notifications
You must be signed in to change notification settings - Fork 19
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
editable installs treated as untyped #868
Comments
I am getting the correct error message on a new virtual env. This the output i get from the mypy check
|
thanks @saeubank! by any chance could you also try running i hadn't noticed before but apparently it does catch the error for me when i'm checking everything at once, but not if i'm just checking |
Weird I also get the check passing if I run that
|
ok this seems to be a known issue - see updated description in #715 |
fixes: #868 this appears to be a known issue stemming from the use of import hooks to comply with pep 660 - see for example python/mypy#13392 and pypa/setuptools#3518. What's happening is that for editable installs `setuptools` creates files like `.../site-packages/__editable__.general_superstaq-0.5.5.pth` which are supposed to point python to the source directory. Previously these would just be text files containing a single path, e.g. ``` /<...>/client-superstaq/general-superstaq ``` but after switching to pyproject.toml it becomes an executable hook, e.g. ```python import __editable___general_superstaq_0_5_5_finder; __editable___general_superstaq_0_5_5_finder.install() ``` where `__editable___general_superstaq_0_5_5_finder.py` is another file saved in the site-packages directory. this breaks static analysis tools because they won't execute the required code afaict this pr seems to be the cleanest workaround - after these changes setuptools seems to generate the old-style `.pth` files (i.e. text files containing paths to the source directories), and `mypy` behaves as expected (at least for me)
What is happening?
when i use an editable install of any of the client-superstaq packages (e.g.
pip install -e ./general-superstaq
), mypy treats it as untyped when type-checking other packages (see example below). Non-editable installs work correctlythis has been happening to me since ~the transition to pyproject.toml, and seems to be fixed by the change in #715. However i don't fully understand what's going on so before making any changes i'd love to know if it's an issue on other systems or just a me issue
How can we reproduce the issue?
in the repo root directory, create & activate a new virtual environment, and then run
What should happen?
it should raise a type error along the lines of
but for me locally the check passes unless i remove the first
-e
Environment
Any additional context?
No response
The text was updated successfully, but these errors were encountered: