Skip to content

Commit 22b8f69

Browse files
authored
s3_management: source PyPI-hosted NVIDIA packages from pypi.org (#8473)
get_package_source_url() routed any package whose name starts with "nvidia-" or "cuda-" to pypi.nvidia.com. A handful of NVIDIA-named packages are not published there -- cuda-bindings, cuda-pathfinder, cuda-python and nvidia-ml-py live on PyPI proper -- so fetching their simple index 404s. The failure is quiet: upload_package_using_simple_index() catches the fetch error and returns, leaving the mirrored index frozen at whatever was last seeded. The prefix predicate carries two meanings that had to be separated before the exception could be expressed. is_nvidia_package() also gates which packages are initialized for CUDA targets only (get_packages_for_target), so excluding these four inside it would have leaked them into cpu and rocm targets. It keeps the plain prefix heuristic; the new uses_nvidia_index() layers the exception on top and is what the URL builder and the "NVIDIA"/"PyPI" source label now consult, so the printed label always matches the index actually fetched. Test Plan: The four listed packages resolve to pypi.org/simple/, nvidia-cublas-cu12 and cuda-runtime-cu13 still resolve to pypi.nvidia.com, numpy to pypi.org and pytorch-triton-rocm to repo.amd.com. is_nvidia_package() returns True for all six NVIDIA names, confirming the CUDA-target gate is unchanged. cc @atalman
1 parent 27bde84 commit 22b8f69

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

s3_management/update_dependencies.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -882,11 +882,27 @@
882882
PREVIEW_NUMPY_VERSION = "2.6.0"
883883

884884

885+
# NVIDIA packages that are published to PyPI rather than pypi.nvidia.com. The
886+
# nvidia-/cuda- prefix heuristic would send these to a 404 and silently freeze
887+
# their mirrored index at whatever was last seeded.
888+
PYPI_HOSTED_NVIDIA_PACKAGES = {
889+
"cuda-bindings",
890+
"cuda-pathfinder",
891+
"cuda-python",
892+
"nvidia-ml-py",
893+
}
894+
895+
885896
def is_nvidia_package(pkg_name: str) -> bool:
886-
"""Check if a package is from NVIDIA and should use pypi.nvidia.com"""
897+
"""Check if a package is from NVIDIA and is therefore CUDA-target only"""
887898
return pkg_name.startswith("nvidia-") or pkg_name.startswith("cuda-")
888899

889900

901+
def uses_nvidia_index(pkg_name: str) -> bool:
902+
"""Check if a package is mirrored from pypi.nvidia.com rather than PyPI"""
903+
return is_nvidia_package(pkg_name) and pkg_name not in PYPI_HOSTED_NVIDIA_PACKAGES
904+
905+
890906
def is_amd_package(pkg_name: str) -> bool:
891907
"""Check if a package is from AMD and should use repo.amd.com"""
892908
name = pkg_name.lower()
@@ -895,7 +911,7 @@ def is_amd_package(pkg_name: str) -> bool:
895911

896912
def get_package_source_url(pkg_name: str) -> str:
897913
"""Get the source URL for a package based on its type"""
898-
if is_nvidia_package(pkg_name):
914+
if uses_nvidia_index(pkg_name):
899915
return f"https://pypi.nvidia.com/{pkg_name}/"
900916
if is_amd_package(pkg_name):
901917
return f"https://repo.amd.com/rocm/whl-multi-arch/{pkg_name}/"
@@ -1106,7 +1122,7 @@ def upload_package_using_simple_index(
11061122
Works for both NVIDIA and non-NVIDIA packages.
11071123
"""
11081124
source_url = get_package_source_url(pkg_name)
1109-
if is_nvidia_package(pkg_name):
1125+
if uses_nvidia_index(pkg_name):
11101126
source_label = "NVIDIA"
11111127
elif is_amd_package(pkg_name):
11121128
source_label = "AMD"

0 commit comments

Comments
 (0)