-
Notifications
You must be signed in to change notification settings - Fork 2
Support custom variant labels #108
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
Conversation
Add initial support for using wheels with non-variant hash labels. This mostly means replacing "variant hash" with "variant label" in a bunch of places, updating the regex and removing validation where we permit a different label.
Rename the `get_variant_hashes_by_priority()` function to `get_variants_by_priority()`, and update them to return variant labels rather than hashes. For the time being, we just use a reverse map from hashes to labels -- but it may be cleaner to start storing labels in `VariantDescription`.
Looking at the resulting filenames - it's really weird:
I wonder if @konstin doesn't make a really good point about "separators". Maybe one of these (or something else) is "safer":
The current "filename" allows VERY weird stuff (it's not weird because
Now that these strings "(can) have a meaning" I find it very disturbing that the separator is a normal The Sorry to not have made this comment earlier - it really just "stroke me now" |
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.
Aside of my comment on filename
- I really like this PR. Well made I like the approach and really doesn't change much of the internal mechanic.
Good job - let's wrap up the discussion the filename and we can merge this
I don't think "people using weird names" is a valid argument. Mind you, the following is also a valid wheel:
Going out of our way to prevent people from doing confusing things is not a good design goal. Changing the separator means that variant wheels will be wrongly taken by older |
Would it ? It wouldn't fail the regex ? Because that's how I implemented Variants a while back. |
Yes, the regex is literally |
Also note that Poetry's regexp is even terser — it's In the end, we are supposed to provide tools and guidance. We are not supposed to force people to use these tools "our way". |
Alright well once you're done removing Do you mind adding a test that verify that:
"Trust but verify" |
That's going to be messy, since the tools aren't supposed to permit you to create such an artifact. I'd rather not add a backdoor to facilitate tests, or provide artifacts that can't be regenerated trivially. |
Done for |
Add support for a more generic concept of "variant labels" in filenames, to replace narrower "variant hashes". The label is still the hash by default, but the wheel builder can override it to any alphanumeric string up to 8 characters and underscores, providing a more readable description of the specific variant.
Variant label is the last component of the variant wheel filename, in place of the variant hash. It is also used as the key in
variants.json
files.VariantDistInfo
now permits modifyingvariant_label
property (formerlyvariant_hash
) to change the label.make-variant
command accepts a new--variant-label=
option.get_variant_hashes_by_priority()
is renamed toget_variants_by_priority()
, and now returns variant labels rather than hashes.make_variant_dist_info()
accepts an optionalvariant_label
that can be used to override the label.