Skip to content

Commit

Permalink
Use structured types for parsing and formatting language and ABI tags (
Browse files Browse the repository at this point in the history
…#10525)

## Summary

I need to be able to do non-lexicographic comparisons between tags
(e.g., so I can sort `cp313` as greater than `cp39`). It ended up being
easiest to just create structured types for all the tags we support,
with `FromStr` and `Display` implementations.

We don't currently store these in `Tags` or in `WheelFilename`. We may
want to, since they're really small (and `Copy`), but I need to
benchmark to determine whether parsing these in `WheelFilename` is
prohibitively slow.
  • Loading branch information
charliermarsh authored Jan 14, 2025
1 parent 73f60bb commit e0e8ba5
Show file tree
Hide file tree
Showing 5 changed files with 877 additions and 61 deletions.
2 changes: 2 additions & 0 deletions crates/uv-distribution-filename/src/wheel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ impl WheelFilename {
name,
version,
build_tag,
// TODO(charlie): Consider storing structured tags here. We need to benchmark to
// understand whether it's impactful.
python_tag: python_tag.split('.').map(String::from).collect(),
abi_tag: abi_tag.split('.').map(String::from).collect(),
platform_tag: platform_tag.split('.').map(String::from).collect(),
Expand Down
Loading

0 comments on commit e0e8ba5

Please sign in to comment.