Skip to content

Commit

Permalink
Check -cu* suffixed packages
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleFromNVIDIA committed May 17, 2024
1 parent 7c1647e commit adc54a7
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
33 changes: 32 additions & 1 deletion src/rapids_pre_commit_hooks/alpha_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,29 @@
"distributed-ucxx",
}

RAPIDS_CUDA_VERSIONED_PACKAGES = {
"rmm",
"pylibcugraphops",
"pylibcugraph",
"nx-cugraph",
"dask-cudf",
"cuspatial",
"cuproj",
"cuml",
"cugraph",
"cudf",
"ptxcompiler",
"cubinlinker",
"cugraph-dgl",
"cugraph-pyg",
"cugraph-equivariant",
"raft-dask",
"pylibwholegraph",
"pylibraft",
"cuxfilter",
"cucim",
}

ALPHA_SPECIFIER = ">=0.0.0a0"

ALPHA_SPEC_OUTPUT_TYPES = {
Expand All @@ -55,10 +78,18 @@
}


def is_rapids_cuda_versioned_package(name):
return any(
name.startswith(f"{package}-cu") for package in RAPIDS_CUDA_VERSIONED_PACKAGES
)


def check_package_spec(linter, args, node):
if node.tag == "tag:yaml.org,2002:str":
req = Requirement(node.value)
if req.name in RAPIDS_VERSIONED_PACKAGES:
if req.name in RAPIDS_VERSIONED_PACKAGES or is_rapids_cuda_versioned_package(
req.name
):
has_alpha_spec = any(
filter(lambda s: str(s) == ALPHA_SPECIFIER, req.specifier)
)
Expand Down
21 changes: 21 additions & 0 deletions test/rapids_pre_commit_hooks/test_alpha_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,27 @@
for p in alpha_spec.RAPIDS_VERSIONED_PACKAGES
)
),
*chain(
*(
[
(f"{p}-cu12", f"{p}-cu12", "development", f"{p}-cu12>=0.0.0a0"),
(f"{p}-cu12", f"{p}-cu12", "release", None),
(f"{p}-cu12", f"{p}-cu12>=0.0.0a0", "development", None),
(f"{p}-cu12", f"{p}-cu12>=0.0.0a0", "release", f"{p}-cu12"),
]
for p in alpha_spec.RAPIDS_CUDA_VERSIONED_PACKAGES
)
),
*chain(
*(
[
(f"{p}-cu12", f"{p}-cu12", "development", None),
(f"{p}-cu12", f"{p}-cu12>=0.0.0a0", "release", None),
]
for p in alpha_spec.RAPIDS_VERSIONED_PACKAGES
- alpha_spec.RAPIDS_CUDA_VERSIONED_PACKAGES
)
),
("cuml", "cuml>=24.04,<=24.06", "development", "cuml<=24.06,>=0.0.0a0,>=24.04"),
("cuml", "cuml>=24.04,<=24.06,>=0.0.0a0", "release", "cuml<=24.06,>=24.04"),
("packaging", "packaging", "development", None),
Expand Down

0 comments on commit adc54a7

Please sign in to comment.