Open
Description
When a Python package using a PEP 420 implicit namespace is installed in editable mode, it shadows/hides other packages installed in the same namespace. This makes the other packages in the shared namespace un-importable, leading to ModuleNotFoundError
.
Note: It's the same for both src and flat layouts.
Steps to reproduce:
Here is a minimal example with two packages, project-dep
and project-main
, which both live in the company_namespace
implicit namespace. project-main
depends on project-dep
.
project-dep
:
project-dep/
├── pyproject.toml
└── company_namespace/
└── project_dep/
└── __init__.py
project-main
:
project-main/
├── pyproject.toml # dependencies: ["project-dep"]
├── meson.build
└── company_namespace/
└── project_main/
├── __init__.py
└── native.c
- Setup:
# Install build requirements
pip install meson-python
# Install project-dep
pip install ./project-dep
# Install project-main as editable
pip install --no-build-isolation -e ./project-main
- Test:
python
>>> import company_namespace.project_main # This works fine
>>> import company_namespace.project_dep # ModuleNotFoundError
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
import platform
ModuleNotFoundError: No module named 'company_namespace.project_dep'
Example
A ready-to-use example is set up here: https://github.com/bastiensoucasse/mesonpy-namespace-editable.