Duplicate, conflicting imports due to changes with editable installs (Migrating from setup.py to pyproject.toml may subtly require enabling namespace support) #13324
Labels
topic: collection
related to the collection phase
We've converted an older setuptools/
setup.py
based project touv
andpyproject.toml
. The editable installation (usinguv sync
) uses this requirements.txt snippet:This ends up with the following
sys.path
when starting the venv's interpreter:Now, in the actual application this works fine. Howevever, our tests fail because modules are imported twice and I can see that within the pytest environment the path for the namespace package appears a second time
The first dependency is added using a finder hook (something setuptools introduced a while ago it appears).
The second interestingly uses a plain .pth file and ends up working fine.
Here's the path from the pytest session:
pip list
from the virtual environment you are usingSorry, no idea. I'm still trying to find a workaround for me ATM. Here's a number of issues I've been stumbling into and they seem to be pointing towards "client code needs to follow" as the answer ...
uv pip install -e
and its PEP-660-style editable installs break vscode import resolution (and probably static type checkers) astral-sh/uv#3898__editable__
and__path_hook__
changes pypa/setuptools#3548The text was updated successfully, but these errors were encountered: