diff --git a/setuptools/command/editable_wheel.py b/setuptools/command/editable_wheel.py index 1a544ec258..3a247ce4ff 100644 --- a/setuptools/command/editable_wheel.py +++ b/setuptools/command/editable_wheel.py @@ -836,6 +836,11 @@ def _find_spec(cls, fullname: str, candidate_path: Path) -> ModuleSpec | None: for candidate in chain([init], candidates): if candidate.exists(): return spec_from_file_location(fullname, candidate) + if candidate_path.is_dir(): + # treat it like a PEP 420 namespace package + spec = ModuleSpec(fullname, None, is_package=True) + spec.submodule_search_locations = [str(candidate_path)] + return spec return None