Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider removing hook from CPython PathFinder #88

Closed
jaraco opened this issue Oct 22, 2020 · 6 comments
Closed

Consider removing hook from CPython PathFinder #88

jaraco opened this issue Oct 22, 2020 · 6 comments

Comments

@jaraco
Copy link
Member

jaraco commented Oct 22, 2020

In GitLab by @jaraco on Sep 11, 2019, 06:26

Given the complicated interactions between importlib_metadata and importlib.PathFinder, revealed by #86 and also by the recent complications I discovered today where cherry-picked changes to importlib.PathFinder from CPython master no longer apply cleanly to the 3.8 branch (due to the generated C header file from make regen-importlib), I'd like to consider:

  • The least invasive approach would be to replace the code in PathFinder.find_distributions with a small, unchanging hook that calls into importlib.metadata. This change would address the latter issue (with cherry picks) but not the interaction issue.
  • A more invasive approach would be to strip the importlib.PathFinder functionality out altogether and install a MetaPathFinder to sys.meta_path just as importlib_metadata does. This approach would substantially reduce the interactions between importlib_metadata and importlib.metadata, although the two would still interact (as both would install DistributionFinders into sys.meta_path).
  • Even more aggressive might be to simply disallow the interaction of importlib_metadata and importlib.metadata, either by only letting one import in a given session, or by discouraging install of importlib_metadata on Python 3.8+, or perhaps another way.
  • The most aggressive approach could be to remove importlib.metadata altogether and rely on pip-installed importlib_metadata.

I'm not fond of any of these approaches, except maybe the first.

@warsaw Do you have any thoughts on it?

@jaraco
Copy link
Member Author

jaraco commented Oct 22, 2020

In GitLab by @jaraco on Sep 11, 2019, 06:35

mentioned in commit 83b48ec

@jaraco
Copy link
Member Author

jaraco commented Oct 22, 2020

In GitLab by @jaraco on Sep 11, 2019, 06:41

mentioned in merge request !92

@jaraco
Copy link
Member Author

jaraco commented Oct 22, 2020

In GitLab by @jaraco on Sep 11, 2019, 06:43

changed the description

@jaraco
Copy link
Member Author

jaraco commented Oct 22, 2020

In GitLab by @jaraco on Sep 11, 2019, 10:50

In !92, I've enacted option one. Additionally, I've updated the wiki accordingly.

@jaraco
Copy link
Member Author

jaraco commented Oct 22, 2020

In GitLab by @jaraco on Oct 26, 2019, 18:36

As this issue is partially addressed and as #91 captures the remaining interaction issue, I'm closing this issue.

@jaraco
Copy link
Member Author

jaraco commented Oct 22, 2020

In GitLab by @jaraco on Oct 26, 2019, 18:36

closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant