Skip to content
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

use empty package-dir in pyproject.toml #715

Merged
merged 4 commits into from
Jan 9, 2024
Merged

Conversation

richrines1
Copy link
Contributor

@richrines1 richrines1 commented Aug 24, 2023

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.

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)

@richrines1 richrines1 changed the title [testing] empty package-dir in pyproject.toml use empty package-dir in pyproject.toml Jan 9, 2024
@richrines1 richrines1 marked this pull request as ready for review January 9, 2024 04:40
@saeubank saeubank merged commit accfd82 into main Jan 9, 2024
16 checks passed
@saeubank saeubank deleted the setuptools-package-dir branch January 9, 2024 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

editable installs treated as untyped
2 participants