@@ -331,7 +331,8 @@ def _add_whl_library(self, *, python_version, whl, repo):
331331 # in the hub context. If we have whl-only pipstar extraction, then we can reuse the
332332 # extracted sources.
333333 repos_dict = self ._whl_libraries
334- deps_args = repo .args
334+ deps_args = dict (repo .args )
335+ deps_args ["requirement" ] = requirement (deps_args ["requirement" ]).name
335336 else :
336337 extract_args = {
337338 k : v
@@ -348,12 +349,12 @@ def _add_whl_library(self, *, python_version, whl, repo):
348349 _add_library (
349350 self ,
350351 repos_dict = self ._whl_libraries ,
351- name = repo .whl_repo_name ,
352+ name = repo .base_repo_name ,
352353 args = extract_args ,
353354 )
354355
355356 deps_args = {
356- k : repo .args [ k ]
357+ k : repo .args . get ( k )
357358 for k in [
358359 "config_load" ,
359360 "dep_template" ,
@@ -363,7 +364,7 @@ def _add_whl_library(self, *, python_version, whl, repo):
363364 } | {
364365 # TODO @aignas 2026-07-04: add a test
365366 "extras" : req .extras ,
366- "whl_library" : "@{}//:BUILD.bazel" .format (repo .whl_repo_name ),
367+ "whl_library" : "@{}//:BUILD.bazel" .format (repo .base_repo_name ),
367368 }
368369 repos_dict = self ._whl_library_deps
369370
@@ -589,16 +590,6 @@ def _create_whl_repos(
589590 interpreter = _detect_interpreter (self , pip_attr , python_version )
590591
591592 for whl in requirements_by_platform :
592- # Check if all sources for this wheel have the same requirement line.
593- # If they do, we can reuse the same whl_library repository across platforms.
594- same_requirements = True
595- if whl .srcs :
596- first_req = whl .srcs [0 ].requirement_line
597- for src in whl .srcs [1 :]:
598- if src .requirement_line != first_req :
599- same_requirements = False
600- break
601-
602593 whl_library_args = common_args | _whl_library_args (
603594 self ,
604595 whl = whl ,
@@ -615,7 +606,6 @@ def _create_whl_repos(
615606 auth_patterns = self ._config .auth_patterns or pip_attr .auth_patterns ,
616607 python_version = _major_minor_version (python_version ),
617608 is_multiple_versions = whl .is_multiple_versions ,
618- same_requirements = same_requirements ,
619609 interpreter = interpreter ,
620610 enable_pipstar_extract = enable_pipstar_extract ,
621611 )
@@ -686,7 +676,6 @@ def _whl_repo(
686676 whl_library_args ,
687677 index_url ,
688678 is_multiple_versions ,
689- same_requirements ,
690679 download_only ,
691680 netrc ,
692681 auth_patterns ,
@@ -718,12 +707,15 @@ def _whl_repo(
718707 return None
719708 else :
720709 # Fallback to a pip-installed wheel
721- target_platforms = src .target_platforms if ( is_multiple_versions or not same_requirements ) else []
710+ target_platforms = src .target_platforms if is_multiple_versions else []
722711 return struct (
723712 repo_name = pypi_repo_name (
724713 normalize_name (src .distribution ),
725714 * target_platforms
726715 ),
716+ base_repo_name = pypi_repo_name (
717+ normalize_name (src .distribution ),
718+ ),
727719 args = args ,
728720 config_setting = whl_config_setting (
729721 version = python_version ,
@@ -748,11 +740,11 @@ def _whl_repo(
748740 # TODO @aignas 2025-11-02: once we have pipstar enabled we can add extra
749741 # targets to each hub for each extra combination and solve this more cleanly as opposed to
750742 # duplicating whl_library repositories.
751- target_platforms = src .target_platforms if ( is_multiple_versions or not same_requirements ) else []
743+ target_platforms = src .target_platforms if is_multiple_versions else []
752744
753745 return struct (
754746 repo_name = whl_repo_name (src .filename , src .sha256 , * target_platforms ),
755- whl_repo_name = whl_repo_name (src .filename , src .sha256 , * target_platforms ),
747+ base_repo_name = whl_repo_name (src .filename , src .sha256 ),
756748 args = args ,
757749 config_setting = whl_config_setting (
758750 version = python_version ,
0 commit comments