Add utility to select things with compatible tags#1110
Add utility to select things with compatible tags#1110
Conversation
|
@brettcannon how do you like this one? |
08ce96f to
8a3a7ec
Compare
8a3a7ec to
2cf7143
Compare
|
I made it return an iterator to allow for possible future optimizations. So obtaining the best compatible wheel looks like this: >>> filenames = ["foo-1.0-py3-none-any.whl", "foo-1.0-py2-none-any.whl"]
>>> selector = create_compatible_tags_selector(tags.sys_tags())
>>> next(selector([
... (filename, parse_wheel_filename(filename)[-1]) for filename in filenames
... ]), None)
"foo-1.0-py3-none-any.whl" |
|
The first question here is if this seems worthwhile as a public API. If yes, we can refine it. If not, or if in doubt for now, I'll include this as a private API in #1092. |
|
I think it makes sent to make this public! I had one small improvement, otherwise LGTM! |
|
Does this work with manylinux / linux correctly? In the past, manylinx/musllinux was placed at the wrong place in tags, causing the general manylinux to come before the specific linux tag, which means this would pick a generic manylinux wheel over a local compile. If so, it should probably come with a warning in the docs at least? |
brettcannon
left a comment
There was a problem hiding this comment.
I think this is just missing docs.
|
I think you'll automatically get docs if you add it to |
It indeed seems
So in the docs of |
@henryiii |
That's #160 so I think it's a separate issue from this PR. |
@sbidoul did you want to wait for something like that or do a quick doc change by copying the docstring? |
|
I did some of them, I can see about that one. |
a275ca9 to
9da74b3
Compare
Co-authored-by: Brett Cannon <brett@python.org>
9da74b3 to
f96c179
Compare
|
I updated tags.rst and fixed the doctest. |
|
Made #1130. |
Coming from #1092 (comment), this PR proposes a utility to select things that best match an ordered list of tags.
It works like this, for instance, to select compatible wheel filenames: