Skip to content

Remove bz/lzma/xz support from ZIP handling#18927

Open
woodruffw wants to merge 4 commits into
mainfrom
ww/rm-bz-lzma-in-zips
Open

Remove bz/lzma/xz support from ZIP handling#18927
woodruffw wants to merge 4 commits into
mainfrom
ww/rm-bz-lzma-in-zips

Conversation

@woodruffw

@woodruffw woodruffw commented Apr 8, 2026

Copy link
Copy Markdown
Member

Summary

WIP.

This removes the bzip2/lzma/xz features from our backing ZIP dependencies, per our long term plans to not support these compression schemes (as they're not standard parts of Python packaging). This doesn't remove the similar paths from tarball handling, yet.

This is a breaking change, so it probably shouldn't be merged until we're ready to cut 0.12.

See #16911 for context.

Test Plan

Will update the snapshot tests.

@woodruffw woodruffw added this to the v0.12.0 milestone Apr 8, 2026
@woodruffw woodruffw self-assigned this Apr 8, 2026
@woodruffw woodruffw added the breaking A breaking change label Apr 8, 2026
Comment thread crates/uv/tests/it/pip_install.rs Outdated
Comment on lines +14717 to +14720
× Failed to download `futzed-bz2 @ https://github.com/astral-sh/futzed-wheels/releases/download/v2026.02.09.2/futzed_bz2-0.1.0-py3-none-any.whl`
├─▶ Failed to read metadata: `https://github.com/astral-sh/futzed-wheels/releases/download/v2026.02.09.2/futzed_bz2-0.1.0-py3-none-any.whl`
├─▶ Failed to read from zip file
╰─▶ compression not supported: 12

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error is pretty bad, but I'm not sure how much to invest in making it better -- we'd need to partially specialize each underlying zip crate's error for this. Maybe that's worth it, though.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we downcast and match

https://github.com/astral-sh/rs-async-zip/blob/463b248f6a58df39f411b37aff5a8645c27bd789/src/error.rs#L33-L34

for this? I do think it's important to show that this format is intentionally unsupported, that this error not a bug.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Downcasting this was going to be a bit gnarly (since we have two separate error paths to unify, sync and async), so what I've done is switch from #[from] to #[source] and done an interposing From<...> for Error to perform the transformation on each error type as needed. Not sure if that passes our idiom smell test though 🙂

@woodruffw woodruffw force-pushed the ww/rm-bz-lzma-in-zips branch from 66df85e to 6437610 Compare April 8, 2026 18:33
@woodruffw woodruffw mentioned this pull request Apr 8, 2026
6 tasks
@woodruffw woodruffw marked this pull request as ready for review April 8, 2026 20:13
@woodruffw woodruffw force-pushed the ww/rm-bz-lzma-in-zips branch from 6437610 to 6a607c9 Compare April 9, 2026 18:20

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flagging: we effectively have (at least) four different zip pathways in uv at the moment: uv_extract with sync/async and uv_metadata with sync/async both have their own error variants, each of which captures the different Zip/AsyncZip member separately. Unifying them probably doesn't make sense with this PR in the interest of locality, but seems like a good long-term refactor (in the interests of single-sourcing the flow of archive handling through uv).

Comment thread crates/uv-extract/src/error.rs Outdated
@woodruffw woodruffw force-pushed the ww/rm-bz-lzma-in-zips branch 4 times, most recently from 979eb5b to 8e8cfc8 Compare April 20, 2026 16:52
@woodruffw woodruffw force-pushed the ww/rm-bz-lzma-in-zips branch 2 times, most recently from 84e19b8 to fec0ee5 Compare April 21, 2026 16:19
@woodruffw woodruffw force-pushed the ww/rm-bz-lzma-in-zips branch from fec0ee5 to a38cfe0 Compare April 24, 2026 16:47
@woodruffw woodruffw force-pushed the ww/rm-bz-lzma-in-zips branch 3 times, most recently from e85ba52 to b4db6f7 Compare June 1, 2026 15:09
@woodruffw

Copy link
Copy Markdown
Member Author

Tracking that CI flake with #19633

@woodruffw woodruffw force-pushed the ww/rm-bz-lzma-in-zips branch 2 times, most recently from eba669f to a7f61e1 Compare June 4, 2026 18:14
@astral-sh-bot

astral-sh-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown

uv test inventory changes

This PR changes the tests when compared with the latest main baseline.

  • Added tests: 6
  • Removed tests: 3
  • Changed suites: 1
uv::it: +6 / -3

Added:

  • uv::it::pip_install::fail_on_bz2_wheel
  • uv::it::pip_install::fail_on_lzma_wheel
  • uv::it::pip_sync::reject_sdist_archive_type_bz2
  • uv::it::sync::sync_non_pep625_sdist
  • uv::it::sync::sync_non_pep625_sdist_from_lockfile
  • uv::it::sync::sync_non_pep625_sdist_with_compatible_wheel

Removed:

  • uv::it::pip_install::warn_on_bz2_wheel
  • uv::it::pip_install::warn_on_lzma_wheel
  • uv::it::pip_sync::install_sdist_archive_type_bz2

@woodruffw woodruffw force-pushed the ww/rm-bz-lzma-in-zips branch from ec6ec71 to 1d61dda Compare June 12, 2026 14:27
woodruffw and others added 3 commits June 15, 2026 10:52
Signed-off-by: William Woodruff <william@astral.sh>

Remove CompressionMethod APIs entirely

Signed-off-by: William Woodruff <william@astral.sh>

Tear out the rest of the deprecation pathways

Signed-off-by: William Woodruff <william@astral.sh>

Fix `cargo shear`

Signed-off-by: William Woodruff <william@astral.sh>

Bump snapshots

Signed-off-by: William Woodruff <william@astral.sh>

`cargo fmt`

Signed-off-by: William Woodruff <william@astral.sh>

Specialize error messages for unsupported compression methods in zip files

Signed-off-by: William Woodruff <william@astral.sh>

Simplify matches

Signed-off-by: William Woodruff <william@astral.sh>
Signed-off-by: William Woodruff <william@astral.sh>
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
@woodruffw woodruffw force-pushed the ww/rm-bz-lzma-in-zips branch from 1d61dda to c05a300 Compare June 15, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking A breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants