-
Couldn't load subscription status.
- Fork 3.2k
Description
Description
In the company I work at, I ran into the following issue:
I have a library A, which uses hatchling and an internal versioning plugin for it as build dependencies. This internal plugin C uses the following namespace layout "COMPANY.hatch.version"
I have an app B, which uses other internal libraries which also use "COMPANY. ..." namespace. Package A is not a dependency of app B.
What I have ran into is that the following sequence of commands results in a failure:
- create & activate a venv
pip install -e Bpip install -e A----> this fails withModuleNotFoundError: No module named 'COMPANY.hatch' anderror: metadata-generation-failed`
The following works:
- create & activate a venv
pip install -e Apip install -e B
Using PIP_NO_CLEAN=1 I have verified that /tmp/pip-build-env-xxxx/overlay contains package C and "COMPANY.hatch.version" module is present there. However it seems that metadata generation is not correctly isolated, and the process detects "COMPANY" top-level namespace in the current venv, and proceeds to import from there, and therefore fails to use the same namespace from the overlay.
It's a little troublesome for me to provide all the artifacts for a reproduction but I hope the problem is clear enough and whoever is interested in improving pip can create 3 small packages to imitate this situation.
Expected behavior
pip install -e B does not break consequent pip install -e A
pip version
25.2
Python version
3.12
OS
Linux
How to Reproduce
- create a sample hatchling version plugin library, call it C, and make its code have namespace "somename.C.*"
- create library A which uses hatchling and "C" as build dependency
- create library B which uses "somename.B.*" as namespace
- create a new venv and activate it
- pip install -e B
- pip install -e A ---> will fail due to import error of "somename.C"
Output
No response
Code of Conduct
- I agree to follow the PSF Code of Conduct.