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

Adjust precedence in editable installs. #3829

Closed
wants to merge 3 commits into from

Conversation

abravalheri
Copy link
Contributor

@abravalheri abravalheri commented Feb 15, 2023

Summary of changes

  • Change order of import hooks.

Closes (potentially) #3806 and #3828 (still under investigation)

Pull Request Checklist

@abravalheri
Copy link
Contributor Author

So changing the precedence of the MetaPathFinder to win over standard path imports has some nasty consequences...

There some specs and applications that expect the order of sys.path entries to be respected over anything else...

This means that this PR is not applicable.

I suspect that the best way forward with editable installs is to use PathEntryFinders instead and mimic the way zipimporter works... This is discussed in pfmoore/editables#21, however it is something complex and require some time to implement (so postponed until I or other member of the community has the time to investigate).

@Jorricks
Copy link

Jorricks commented Jun 17, 2024

Sorry for posting on such an old topic. This seems to be the only topic that really applies.

Here you tried to put the editable installations first, but what if we just move it to the before-last one and make sure the local importer is last, as such?
astral-sh/uv#1708 (comment)

Wouldn't that work?
The current precedency is not particularly kind for monorepos. I wonder if any of them use the non-legacy version

@abravalheri
Copy link
Contributor Author

abravalheri commented Jun 18, 2024

what if we just move it to the before-last on

Isn't that exactly the same thing as inserting before PathFinder (with the difference that using PathFinder as a reference is better than relying on arbitrary indexes, like -1 or -2, that can change in runtime).

In this PR we tried inserting before PathFinder, but as the comments above says it doesn't work (not because it is conceptually wrong, but because some tools are not prepared to deal with it).

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

Successfully merging this pull request may close these issues.

2 participants