Skip to content

Commit 5335312

Browse files
committed
Add comments about accidental virtual namespaces
1 parent 60c822e commit 5335312

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

setuptools/command/editable_wheel.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,14 @@ def _absolute_root(path: _Path) -> str:
585585
def _find_virtual_namespaces(pkg_roots: Dict[str, str]) -> Iterator[str]:
586586
"""By carefully designing ``package_dir``, it is possible to implement the logical
587587
structure of PEP 420 in a package without the corresponding directories.
588-
This function will try to find this kind of namespaces.
588+
589+
Moreover a parent package can be purposefully/accidentally skipped in the discovery
590+
phase (e.g. ``find_packages(include=["mypkg.*"])``, when ``mypkg.foo`` is included
591+
by ``mypkg`` itself is not).
592+
We consider this case to also be a virtual namespace (ignoring the original
593+
directory) to emulate a non-editable installation.
594+
595+
This function will try to find these kinds of namespaces.
589596
"""
590597
for pkg in pkg_roots:
591598
if "." not in pkg:
@@ -595,6 +602,7 @@ def _find_virtual_namespaces(pkg_roots: Dict[str, str]) -> Iterator[str]:
595602
partial_name = ".".join(parts[:i])
596603
path = Path(find_package_path(partial_name, pkg_roots, ""))
597604
if not path.exists() or partial_name not in pkg_roots:
605+
# partial_name not in pkg_roots ==> purposefully/accidentally skipped
598606
yield partial_name
599607

600608

0 commit comments

Comments
 (0)