From 8ea7a7326f4c53724e869b5b0a2fc569df45873d Mon Sep 17 00:00:00 2001 From: Simone Mosciatti Date: Wed, 19 Nov 2025 11:16:06 -0800 Subject: [PATCH 1/2] add version to packages --- uv/private/extension.bzl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/uv/private/extension.bzl b/uv/private/extension.bzl index 730b5bc0..6a2c47ec 100644 --- a/uv/private/extension.bzl +++ b/uv/private/extension.bzl @@ -509,10 +509,11 @@ def _raw_whl_repos(_module_ctx, lock_specs, override_specs): def _sbuild_repo_name(hub, venv, package): """Get the repo name for a sdist build.""" - return "sbuild__{}__{}__{}".format( + return "sbuild__{}__{}__{}__{}".format( hub, venv, package["name"], + package["version"], ) def _venv_target(hub_name, venv, package_name): @@ -563,10 +564,11 @@ def _sbuild_repos(_module_ctx, lock_specs, annotation_specs, override_specs): def _whl_install_repo_name(hub, venv, package): """Get the whl install repo name for a given package.""" - return "whl_install__{}__{}__{}".format( + return "whl_install__{}__{}__{}__{}".format( hub, venv, package["name"], + package["version"], ) # TODO: Move this to a real library From e29eb9164b123312878cfecc8cc25deab8f0aeb2 Mon Sep 17 00:00:00 2001 From: Simone Mosciatti Date: Wed, 19 Nov 2025 11:41:23 -0800 Subject: [PATCH 2/2] better schema --- uv/private/extension.bzl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/uv/private/extension.bzl b/uv/private/extension.bzl index 6a2c47ec..45c376a7 100644 --- a/uv/private/extension.bzl +++ b/uv/private/extension.bzl @@ -513,7 +513,7 @@ def _sbuild_repo_name(hub, venv, package): hub, venv, package["name"], - package["version"], + package["sdist"]["hash"][len("sha256:"):][:8], ) def _venv_target(hub_name, venv, package_name): @@ -564,11 +564,20 @@ def _sbuild_repos(_module_ctx, lock_specs, annotation_specs, override_specs): def _whl_install_repo_name(hub, venv, package): """Get the whl install repo name for a given package.""" + # Prefer sdist hash for consistency, fall back to first wheel hash + if "sdist" in package: + hash_val = package["sdist"]["hash"][len("sha256:"):][:8] + elif "wheels" in package and package["wheels"]: + hash_val = package["wheels"][0]["hash"][len("sha256:"):][:8] + else: + # This should never happen based on lockfile validation, but be defensive + hash_val = sha1("{}__{}__{}".format(hub, venv, package["name"]))[:8] + return "whl_install__{}__{}__{}__{}".format( hub, venv, package["name"], - package["version"], + hash_val, ) # TODO: Move this to a real library