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

pip 20 breaks supported_wheels.py? #298

Closed
anthrotype opened this issue Jan 21, 2020 · 7 comments · Fixed by #299
Closed

pip 20 breaks supported_wheels.py? #298

anthrotype opened this issue Jan 21, 2020 · 7 comments · Fixed by #299

Comments

@anthrotype
Copy link
Contributor

After the recently updated pip 20.0.1, the multibuild's supported_wheels.py script (which filters wheel filenames not supported on the current platform) is no longer working.
It returns nothing, whereas if I downgrade to pip==19.3.1 it works as before.
I am not sure what exactly changed.

@anthrotype
Copy link
Contributor Author

it looks like the old pip's get_supported() would return list of tuples, now it returns a list of packaging.Tag objects. I got it working with this patch:

diff --git a/supported_wheels.py b/supported_wheels.py
index 41abc37..7d54ec4 100755
--- a/supported_wheels.py
+++ b/supported_wheels.py
@@ -28,7 +28,10 @@ def tags_for(fname):
 
 
 def main():
-    supported = set(get_supported())
+    supported = {
+        (tag.interpreter, tag.abi, tag.platform) if not isinstance(tag, tuple) else tag
+        for tag in get_supported()
+    }
     for fname in sys.argv[1:]:
         tags = set(tags_for(fname))
         if supported.intersection(tags):

alternatively we could check isinstance(tag, packaging.tags.Tag) but then we'd need to import packaging.

@hugovk
Copy link
Contributor

hugovk commented Jan 21, 2020

Here's where it was changed in pip:

@matthew-brett
Copy link
Collaborator

Ugh - dammit, how frustrating. They've changed their API again. @anthrotype - any chance of a PR?

@gaborbernat
Copy link

Ugh - dammit, how frustrating. They've changed their API again. @anthrotype - any chance of a PR?

They don't offer a programmatic API at all... so the fact they've changed their internal private implementation detail not sure if it warrants frustration.

@pfmoore
Copy link

pfmoore commented Jan 22, 2020

FWIW, we've switched to using packaging.tags (which we vendor, and wrap internally to provide a similar interface to the previous custom implementation). So a more robust, longer-term solution would be to use packaging.tags directly. (Not criticising your decision to make a fast fix by adapting your use of the pip function, just suggesting a future improvement you could make).

@matthew-brett
Copy link
Collaborator

@pfmoore - thanks - that's an excellent suggestion.

@matthew-brett
Copy link
Collaborator

packaging.tags solution added in #302

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 a pull request may close this issue.

5 participants