Skip to content

Commit

Permalink
Allow null matrix entries.
Browse files Browse the repository at this point in the history
  • Loading branch information
bdice committed Dec 8, 2024
1 parent 4e7c612 commit f3d982a
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def get_filename(file_type: _config.Output, file_key: str, matrix_combo: dict[st
file_type_prefix = ""
file_ext = ""
file_name_prefix = file_key
suffix = "_".join([f"{k}-{v}" for k, v in matrix_combo.items()])
suffix = "_".join([f"{k}-{v}" for k, v in matrix_combo.items() if v])
if file_type == _config.Output.CONDA:
file_ext = ".yaml"
elif file_type == _config.Output.REQUIREMENTS:
Expand Down Expand Up @@ -322,7 +322,7 @@ def should_use_specific_entry(matrix_combo: dict[str, str], specific_entry_matri
`matrix_combo` and False otherwise.
"""
return all(
specific_key in matrix_combo and fnmatch.fnmatch(matrix_combo[specific_key], specific_value)
matrix_combo.get(specific_key) and fnmatch.fnmatch(matrix_combo[specific_key], specific_value)
for specific_key, specific_value in specific_entry_matrix.items()
)

Expand Down
5 changes: 4 additions & 1 deletion src/rapids_dependency_file_generator/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@
"patternProperties": {
".*": {
"type": "array",
"items": {"type": "string"}
"items": {"oneOf": [
{"type": "string"},
{"type": "null"}
]}
}
}
},
Expand Down
59 changes: 59 additions & 0 deletions tests/examples/matrix-null-item/dependencies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
files:
dev:
output: conda
conda_dir: output/actual
matrix:
cuda: ["11.5"]
arch: [x86_64, arm64]
py: ["3.8", null]
includes:
- build
channels:
- rapidsai
- conda-forge
dependencies:
build:
common:
- output_types: [conda]
packages:
- clang-tools=11.1.0
- spdlog>=1.8.5,<1.9
specific:
- output_types: [conda]
matrices:
- matrix:
cuda: "11.5"
packages:
- cudatoolkit=11.5
- matrix:
cuda: "11.6"
packages:
- cudatoolkit=11.6
- output_types: [conda]
matrices:
- matrix:
arch: x86_64
py: "3.9"
packages:
- some_amd64_39_build_dep
- matrix:
packages:
- output_types: [conda]
matrices:
- matrix:
arch: arm64
cuda: "11.5"
py: "3.8"
packages:
- super_specific_dep
- matrix:
packages:
- output_types: [conda]
matrices:
- matrix:
cuda: "11.5"
py: "3.8"
packages:
- some_115_38_build_dep
- matrix:
packages:
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file is generated by `rapids-dependency-file-generator`.
# To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`.
channels:
- rapidsai
- conda-forge
dependencies:
- clang-tools=11.1.0
- cudatoolkit=11.5
- spdlog>=1.8.5,<1.9
name: dev_cuda-115_arch-arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is generated by `rapids-dependency-file-generator`.
# To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`.
channels:
- rapidsai
- conda-forge
dependencies:
- clang-tools=11.1.0
- cudatoolkit=11.5
- some_115_38_build_dep
- spdlog>=1.8.5,<1.9
- super_specific_dep
name: dev_cuda-115_arch-arm64_py-38
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file is generated by `rapids-dependency-file-generator`.
# To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`.
channels:
- rapidsai
- conda-forge
dependencies:
- clang-tools=11.1.0
- cudatoolkit=11.5
- spdlog>=1.8.5,<1.9
name: dev_cuda-115_arch-x86_64
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This file is generated by `rapids-dependency-file-generator`.
# To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`.
channels:
- rapidsai
- conda-forge
dependencies:
- clang-tools=11.1.0
- cudatoolkit=11.5
- some_115_38_build_dep
- spdlog>=1.8.5,<1.9
name: dev_cuda-115_arch-x86_64_py-38

0 comments on commit f3d982a

Please sign in to comment.