[BUG] PEP-660 editable installs import issue based on package name and CWD · Issue #3592 · pypa/setuptools · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I install a package with a PEP 660 editable install using a pyproject.toml file and no setup.py file, and the package's parent directory has the same name as the package directory itself, Python fails to fully import the package specifically when my CWD is the grandparent of the package directory. That is, I can import the package, but I can't access its non-built-in attributes, and its __spec__ attribute includes loader=<_frozen_importlib_external._NamespaceLoader even though there are no namespace packages involved here. If my CWD is any other directory, I don't encounter this issue, and if I ensure that the package directory has a different name than its parent, I don't encounter this issue. This also isn't an issue when using setup.py instead of pyproject.toml.
Expected behavior
I expect to be able to import from an editable install with a venv activated regardless of my CWD and regardless of whether or not the package's name is the same as its parent directory.
setuptools version
setuptools==65.3.0
Python version
Python 3.10 or Python 3.8
OS
Ubuntu 22.04
Additional environment information
pip==22.2.2
Description
If I install a package with a PEP 660 editable install using a
pyproject.toml
file and nosetup.py
file, and the package's parent directory has the same name as the package directory itself, Python fails to fully import the package specifically when my CWD is the grandparent of the package directory. That is, I can import the package, but I can't access its non-built-in attributes, and its__spec__
attribute includesloader=<_frozen_importlib_external._NamespaceLoader
even though there are no namespace packages involved here. If my CWD is any other directory, I don't encounter this issue, and if I ensure that the package directory has a different name than its parent, I don't encounter this issue. This also isn't an issue when usingsetup.py
instead ofpyproject.toml
.Expected behavior
I expect to be able to import from an editable install with a venv activated regardless of my CWD and regardless of whether or not the package's name is the same as its parent directory.
How to Reproduce
I made a minimal reproducible example here: https://github.com/noah-weingarden/setuptools-mre
This is the directory structure:
Output
(I think any other directory would also work.)
The text was updated successfully, but these errors were encountered: