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/
├── pyproject.toml
└── company_namespace/
└── project_dep/
└── __init__.py
project-main/
├── pyproject.toml # dependencies: ["project-dep"]
├── meson.build
└── company_namespace/
└── project_main/
├── __init__.py
└── native.c
# 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
>>> 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.
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-depandproject-main, which both live in thecompany_namespaceimplicit namespace.project-maindepends onproject-dep.project-dep:project-dep/ ├── pyproject.toml └── company_namespace/ └── project_dep/ └── __init__.pyproject-main:project-main/ ├── pyproject.toml # dependencies: ["project-dep"] ├── meson.build └── company_namespace/ └── project_main/ ├── __init__.py └── native.cExample
A ready-to-use example is set up here: https://github.com/bastiensoucasse/mesonpy-namespace-editable.