From 9f2e610540337bb6c1cdf42adfec217d5a37f6c8 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 20 Apr 2025 13:22:48 -0400 Subject: [PATCH] In _EditableFinder, allow (one) namespace package to be found in a simple package. --- setuptools/command/editable_wheel.py | 5 +++++ 1 file changed, 5 insertions(+) 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