Skip to content

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

Merged
woodruffw merged 3 commits into
release/0.12.0from
ww/rm-bz-lzma-in-zips
Jul 27, 2026
Merged

Remove bz/lzma/xz support from ZIP handling#18927
woodruffw merged 3 commits into
release/0.12.0from
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 release/0.12.0 base revision.

  • Added tests: 55
  • Removed tests: 5
  • Changed suites: 9
uv-dev: +2 / -0

Added:

  • uv-dev::generate_preview_features_reference::tests::generates_preview_feature_reference
  • uv-dev::generate_preview_features_reference::tests::preserves_multiline_preview_feature_documentation

Removed: none

uv-preview: +0 / -1

Added: none

Removed:

  • uv-preview::tests::test_preview_feature_as_str
uv::lock: +4 / -0

Added:

  • uv::lock::lock::lock_explicit_prerelease_mode
  • uv::lock::lock::lock_upgrade_group_frozen
  • uv::lock::lock::lock_upgrade_group_legacy_dev_dependencies
  • uv::lock::lock::lock_upgrade_group_missing

Removed: none

uv::lock_scenarios: +5 / -0

Added:

  • uv::lock_scenarios::lock_scenarios::prerelease_base_marker_stable_preference_explicit_first
  • uv::lock_scenarios::lock_scenarios::prerelease_base_marker_stable_preference_plain_first
  • uv::lock_scenarios::lock_scenarios::prerelease_marker_equivalent_stable_preference
  • uv::lock_scenarios::lock_scenarios::prerelease_marker_stable_preference_backtracks
  • uv::lock_scenarios::lock_scenarios::transitive_prerelease_forks

Removed: none

uv::pip: +24 / -1

Added:

  • uv::pip::pip_install_scenarios::package_stable_prerelease_candidates
  • uv::pip::pip_install_scenarios::prerelease_base_extra_stable_preference_after_backtrack
  • uv::pip::pip_install_scenarios::prerelease_base_extra_stable_preference_explicit_first
  • uv::pip::pip_install_scenarios::prerelease_base_extra_stable_preference_plain_first
  • uv::pip::pip_install_scenarios::prerelease_capped_union_alternate_parent
  • uv::pip::pip_install_scenarios::prerelease_capped_union_backtrack
  • uv::pip::pip_install_scenarios::prerelease_equivalent_stable_preference_explicit_first
  • uv::pip::pip_install_scenarios::prerelease_equivalent_stable_preference_plain_first
  • uv::pip::pip_install_scenarios::prerelease_extra_stable_preference
  • uv::pip::pip_install_scenarios::prerelease_extra_stable_preference_backtracks
  • uv::pip::pip_install_scenarios::prerelease_fallback_after_stable_rejected
  • uv::pip::pip_install_scenarios::prerelease_multiple_redundant_stable_preference
  • uv::pip::pip_install_scenarios::prerelease_multiple_redundant_stable_preference_explicit_first
  • uv::pip::pip_install_scenarios::prerelease_redundant_stable_preference_explicit_first
  • uv::pip::pip_install_scenarios::prerelease_redundant_stable_preference_plain_first
  • uv::pip::pip_install_scenarios::transitive_prerelease_after_decision
  • uv::pip::pip_install_scenarios::transitive_prerelease_backtracks
  • uv::pip::pip_install_scenarios::transitive_prerelease_equivalent_stable_preference_explicit_first
  • uv::pip::pip_install_scenarios::transitive_prerelease_equivalent_stable_preference_plain_first
  • uv::pip::pip_install_scenarios::transitive_prerelease_prefers_stable
  • uv::pip::pip_install_scenarios::transitive_prerelease_redundant_stable_preference_parent_first
  • uv::pip::pip_install_scenarios::transitive_prerelease_redundant_stable_preference_plain_first
  • uv::pip::pip_sync::reject_sdist_archive_type_bz2
  • uv::pip::pip_sync::require_hashes_in_requirements_txt

Removed:

  • uv::pip::pip_sync::install_sdist_archive_type_bz2
uv::pip_compile: +4 / -0

Added:

  • uv::pip_compile::pip_compile::compile_lowest_prereleases
  • uv::pip_compile::pip_compile::inactive_scoped_override_does_not_enable_prerelease
  • uv::pip_compile::pip_compile::offline_registry_prerelease
  • uv::pip_compile::pip_compile::unsafe_package_no_annotate

Removed: none

uv::pip_install: +11 / -3

Added:

  • uv::pip_install::pip_install::build_transitive_prerelease
  • uv::pip_install::pip_install::disallow_transitive_prerelease
  • uv::pip_install::pip_install::explicit_prerelease_allows_direct_marker
  • uv::pip_install::pip_install::explicit_prerelease_disallows_transitive_marker
  • uv::pip_install::pip_install::explicit_prerelease_does_not_fall_back_if_necessary
  • uv::pip_install::pip_install::explicit_prerelease_prefers_stable_for_direct_marker
  • uv::pip_install::pip_install::fail_on_bz2_wheel
  • uv::pip_install::pip_install::fail_on_lzma_wheel
  • uv::pip_install::pip_install::if_necessary_or_explicit_is_deprecated_alias
  • uv::pip_install::pip_install::install_require_hashes_in_requirements_txt
  • uv::pip_install::pip_install::prerelease_index_strategy_ordering

Removed:

  • uv::pip_install::pip_install::build_prerelease_hint
  • uv::pip_install::pip_install::warn_on_bz2_wheel
  • uv::pip_install::pip_install::warn_on_lzma_wheel
uv::project: +2 / -0

Added:

  • uv::project::check::check_locked_tool_rejects_malware_from_warm_cache
  • uv::project::edit::add_relative_and_absolute_archives

Removed: none

uv::sync: +3 / -0

Added:

  • uv::sync::sync::sync_non_pep625_sdist
  • uv::sync::sync::sync_non_pep625_sdist_from_lockfile
  • uv::sync::sync::sync_non_pep625_sdist_with_compatible_wheel

Removed: none

@woodruffw
woodruffw force-pushed the ww/rm-bz-lzma-in-zips branch 3 times, most recently from c05a300 to 21456a4 Compare June 16, 2026 17:40
@konstin konstin mentioned this pull request Jun 26, 2026
konstin added a commit that referenced this pull request Jun 26, 2026
Remove bz/lzma/xz support from ZIP handling
konstin added a commit that referenced this pull request Jun 26, 2026
Remove bz/lzma/xz support from ZIP handling
@woodruffw
woodruffw force-pushed the ww/rm-bz-lzma-in-zips branch from 21456a4 to 838d75b Compare June 28, 2026 15:22
Comment thread crates/uv-pep508/src/lib.rs Outdated
(pre_extension, extension),
(_, "whl" | "tbz" | "txz" | "tlz" | "zip" | "tgz" | "tar")
| (Some("tar"), "bz2" | "xz" | "lz" | "lzma" | "gz")
(_, "whl" | "tbz" | "tlz" | "zip" | "tgz" | "tar") | (Some("tar"), "bz2" | "gz")

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.

Noting: I don't actually remember if we wanted to remove bz/lzma/xz from the tar pathway in this PR as well. If so, it'd be pretty easy to remove the last few variants here.

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.

To me the goal is to remove the dependency on those compression algorithm implementations, so that's imho in scope.

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.

SG, I'll tweak this in a bit to complete the removal then.

@woodruffw
woodruffw force-pushed the ww/rm-bz-lzma-in-zips branch from 386511a to a253e75 Compare July 6, 2026 13:44
@woodruffw
woodruffw force-pushed the ww/rm-bz-lzma-in-zips branch 2 times, most recently from 2cd8782 to edb6167 Compare July 17, 2026 13:55
@woodruffw
woodruffw changed the base branch from main to release/0.12.0 July 27, 2026 13:09
woodruffw and others added 2 commits July 27, 2026 09:15
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>

Remove xz support entirely (#19143)

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

Deconflict

Signed-off-by: William Woodruff <william@yossarian.net>

Remove WARN chaff

Signed-off-by: William Woodruff <william@yossarian.net>

Remove lingering bz2 pathway

Signed-off-by: William Woodruff <william@yossarian.net>

Fix some CI errors

Signed-off-by: William Woodruff <william@yossarian.net>

Revert "Remove lingering bz2 pathway"

This reverts commit 92ae6d2.

Reapply "Remove lingering bz2 pathway"

This reverts commit ca35499.

Remove lingering `.tlz` match

Signed-off-by: William Woodruff <william@yossarian.net>

Comment

Signed-off-by: William Woodruff <william@yossarian.net>

Remove untar_bz2

Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
@woodruffw
woodruffw merged commit d7c59aa into release/0.12.0 Jul 27, 2026
168 of 204 checks passed
@woodruffw
woodruffw deleted the ww/rm-bz-lzma-in-zips branch July 27, 2026 14:35
@woodruffw woodruffw mentioned this pull request Jul 27, 2026
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