-
Notifications
You must be signed in to change notification settings - Fork 37
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
Preload script wrappers at import time #215
Conversation
macos-latest 3.7 is failing because macos-latest has moved from macos-12 to macos-14, and macos-14 does not have Python 3.7 on it. Given macos-12 is x86 and macos-14 is ARM and distlib tests run so quickly, I would reccomend running against both and excluding Python 3.7 for macos-14/latest, a little like in https://github.com/pypa/pip/pull/12593/files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WRAPPERS
is only used when os.name == 'nt' or (os.name == 'java' and os._name == 'nt')
, so this computation suite could also be done only when the above condition is true, right?
Good catch - fixed. |
@pfmoore do you need an imminent release with this change? Otherwise I would normally do a release mid-year-ish (unless an urgent issue needs fixing). |
I don't think it's needed. The pip issue isn't urgent, and we can patch locally in the interim. It's not worth making you do the extra work IMO. |
This broke virtualenv Windows zipapps #235 |
Hmm, sorry about that. I thought that registered finders needed to be compatible with the Maybe we should say that all registered finders must implement the |
That seems reasonable to me, but what fix do you propose to the changes in this PR? I mean, it looks like Gabor's worked around it, but isn't it better to sort it at source? |
TBH, I'd assumed it wasn't (easily) fixable at source. Isn't the problem here that virtualenv loads distlib from a location that's registered with a finder that doesn't support iterating over resources? In this code, virtualenv registers a custom finder, but it's not clear that the registration satisfies the necessary contract, which says that the finder maker "must return a finder for that package". What constitutes a "finder" isn't clear (and the reference to PEP 302 in that section of the docs further muddies the water) but I'd assume it means a My proposal was simply to make that clearer. In theory, virtualenv is still incorrect, as it doesn't implement methods like If, on the other hand, you have a suggestion of how we can find the wrappers using a finder that only implements |
Yes, my primary complaint I made here is about the documentation not being clear what it actually required And I had to reverse engineer the interface I needed to implement. |
@gaborbernat @vsajip is #236 sufficient? |
Thank you, Paul, I've merged it. @gaborbernat let us know if you think more is needed. |
yeah, that sounds better |
Pip encountered an issue (pypa/pip#12666) where we can't find the script wrappers because we've uninstalled the running version of pip. Pre-loading the wrapper code into memory when importing
distlib.scripts
avoids this problem.We can patch this locally, but would it be acceptable as a change here instead?