This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: importlib.metadata does not honor .egg-link files
Type: behavior Stage: resolved
Components: Distutils, Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9, Python 3.8, Python 3.7
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: dstufft, eric.araujo, onlinespending
Priority: normal Keywords:

Created on 2022-01-22 15:51 by onlinespending, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (5)
msg411262 - (view) Author: Ben (onlinespending) Date: 2022-01-22 15:51
When installing a package using --editable, pip creates a .egg-link file in your site-packages dir that points to the .egg-info metadata that by default exists along side the source that it was installed from. This worked just fine with the older pkg_resources package. However, the newer importlib.metadata does not seem to be aware of .egg-link files at all. The only solution is to include the source dir that contains the .egg-info metadata into your PYTHONPATH, which sort of defeats the purpose of having the .egg-link pointer in the first place.
msg411269 - (view) Author: Ben (onlinespending) Date: 2022-01-22 17:36
I should also add that the easy-install.pth file, which similarly contains a link to the source dir containing the .egg-info metadata, is also not processed to locate the necessary metadata.
msg411270 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2022-01-22 17:42
It would make sense if importlib only supported official specs.
For editable/develop installs, it is https://www.python.org/dev/peps/pep-0660/ which does not mention egg (not egg-link nor egg-info, long since replaced by dist-info).

Are you using latest pip, and pyproject.toml?  I would expect pip to follow the PEP too.
msg411277 - (view) Author: Ben (onlinespending) Date: 2022-01-22 18:34
yes, the latest version of pip creates an .egg-info metadata dir at the level of the package src dir and .egg-link and easy-install.pth stubs in the site-packages dir (the contents of which are paths to the package src dir). The intent is that these links would be followed to find the necessary metadata for the package. However, importlib.metadata does not follow either one of these links. These links are what makes editable installs possible, so I'm not sure how they can be ignored all together, unless there's some different facility that provides this functionality.
msg411383 - (view) Author: Ben (onlinespending) Date: 2022-01-23 17:01
https://github.com/python/importlib_metadata/issues/364
History
Date User Action Args
2022-04-11 14:59:55adminsetgithub: 90631
2022-01-23 17:01:08onlinespendingsetstatus: open -> closed
resolution: works for me
messages: + msg411383

stage: resolved
2022-01-22 18:34:58onlinespendingsetmessages: + msg411277
2022-01-22 17:42:11eric.araujosetmessages: + msg411270
2022-01-22 17:36:39onlinespendingsetmessages: + msg411269
2022-01-22 15:51:35onlinespendingcreate