Skip to content

Quickly sandbox your AI agent.

Python

fix: retag image wheels via `wheel tags` so PyPI accepts every variant

Tyler Payne9c8afb178f44
diff --git a/pyproject.toml b/pyproject.toml
index fb5f72b..72b546b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -72,6 +72,7 @@ dev = [
# macOS-only runtime dep of quicksand-core; installed here so `ty` can
# resolve it when type-checking on Linux/Windows CI runners.
"dnslib>=0.9.24",
+ "wheel>=0.47.0",
]
[tool.poe.tasks]
diff --git a/uv.lock b/uv.lock
index d896ae3..03bebe0 100644
--- a/uv.lock
+++ b/uv.lock
@@ -35,6 +35,7 @@ dev = [
{ name = "ruff" },
{ name = "ty" },
{ name = "uv-release", specifier = ">=0.40.0" },
+ { name = "wheel", specifier = ">=0.47.0" },
]
[[package]]
@@ -1363,3 +1364,15 @@ sdist = { url = "https://files.pythonhosted.org/packages/15/ba/1f6e8c957e4932be0
wheels = [
{ url = "https://files.pythonhosted.org/packages/f4/34/a9dbe051de88a63eb7408ea66630bac38e72f7f6077d4be58737106860d9/virtualenv-21.3.3-py3-none-any.whl", hash = "sha256:7d5987d8369e098e41406efb780a3d4ca79280097293899e351a6407ee153ab3", size = 7594554, upload-time = "2026-05-13T18:01:27.815Z" },
]
+
+[[package]]
+name = "wheel"
+version = "0.47.0"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "packaging" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/39/62/75f18a0f03b4219c456652c7780e4d749b929eb605c098ce3a5b6b6bc081/wheel-0.47.0.tar.gz", hash = "sha256:cc72bd1009ba0cf63922e28f94d9d83b920aa2bb28f798a31d0691b02fa3c9b3", size = 63854, upload-time = "2026-04-22T15:51:27.727Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/87/1b/9e33c09813d65e248f7f773119148a612516a4bea93e9c6f545f78455b7c/wheel-0.47.0-py3-none-any.whl", hash = "sha256:212281cab4dff978f6cedd499cd893e1f620791ca6ff7107cf270781e587eced", size = 32218, upload-time = "2026-04-22T15:51:26.296Z" },
+]
diff --git a/uvr_hooks.py b/uvr_hooks.py
index 0b94c07..b325e60 100644
--- a/uvr_hooks.py
+++ b/uvr_hooks.py
@@ -38,7 +38,15 @@ _SKIP = {"quicksand_qemu"}
def _retag_wheels(dist: Path) -> None:
- """Copy each image wheel into variants for every supported host platform."""
+ """Rebuild each image wheel under every supported host platform tag.
+
+ Uses ``wheel tags`` rather than copying the file byte-for-byte. PyPI
+ rejects any upload whose content digest matches an already-published
+ file, so identical copies under different filenames can never all be
+ published — rewriting the WHEEL tag gives each variant a unique digest.
+ """
+ import sys
+
for whl in sorted(dist.glob("*.whl")):
m = _WHEEL_RE.match(whl.name)
if not m:
@@ -51,11 +59,26 @@ def _retag_wheels(dist: Path) -> None:
continue
for target in _ARCH_TARGETS[arch_m.group()]:
+ if target == parts["platform"]:
+ continue
new_name = f"{parts['name']}-{parts['version']}-py3-none-{target}.whl"
dest = dist / new_name
- if dest.resolve() != whl.resolve() and not dest.exists():
- shutil.copy2(whl, dest)
- print(f" {whl.name} -> {new_name}")
+ if dest.exists():
+ continue
+ subprocess.run(
+ [
+ sys.executable,
+ "-m",
+ "wheel",
+ "tags",
+ "--platform-tag",
+ target,
+ str(whl),
+ ],
+ check=True,
+ capture_output=True,
+ )
+ print(f" {whl.name} -> {new_name}")
# Runner used to build pure (py3-none-any) wheels for PyPI.