Support collecting editable distributions#117
Conversation
ilan-gold
left a comment
There was a problem hiding this comment.
I don't really understand what the code does beyond loosely "gets the packages that are editable-y installed by inspecting some python file path names available in some metadata" but the code itself looks clean
| from __future__ import annotations | ||
|
|
||
| import re | ||
| from importlib.metadata import Distribution, distributions |
There was a problem hiding this comment.
Are there docs for this distributions function https://docs.python.org/3/library/importlib.metadata.html? Presumably it gets all packages in the current env or?
There was a problem hiding this comment.
Huh, right. I’m pretty sure it’s safe given that it’s in __all__ and therefore meant to be exported: python/cpython#110937
There was a problem hiding this comment.
Yup, @jaraco said so: python/importlib_metadata#494 (comment)
|
|
||
| def _top_level_editable(dist: Distribution) -> Generator[str, None, None]: | ||
| """Find top-level packages in an editable distribution.""" | ||
| for pth_file in dist.files or (): |
There was a problem hiding this comment.
Not sure I follow what is in files given https://docs.python.org/3/library/importlib.metadata.html#importlib.metadata.Distribution. It's just all the files in the package or?
There was a problem hiding this comment.

Fixes #63
I just tested it on my scanpy dev environment, and it works!
>>> import scanpy, anndata; scanpy.logging.print_header() scanpy 1.12.0.dev128+g6bfc3323.d20250616 (1.12.0.dev93+gaef3e9e1.d20250724) anndata 0.11.4 ---- ---- asttokens 3.0.0 matplotlib 3.10.3 scikit-learn 1.7.0 …