-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: python recipe render improvements for version bumper bot (#57)
- Loading branch information
Showing
20 changed files
with
9,000 additions
and
13,909 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ jobs: | |
- py311 | ||
- py310 | ||
- py39 | ||
- py38 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: prefix-dev/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ build-backend = "hatchling.build" | |
[project] | ||
name = "rattler-build-conda-compat" | ||
description = "A package for exposing rattler-build API for conda-smithy" | ||
version = "1.2.2" | ||
version = "1.3.0" | ||
readme = "README.md" | ||
authors = [{ name = "Nichita Morcotilo", email = "[email protected]" }] | ||
license = { file = "LICENSE.txt" } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from __future__ import annotations | ||
|
||
from itertools import product | ||
|
||
|
||
def variant_combinations(data: dict[str, list[str]]) -> list[dict[str, str]]: | ||
""" | ||
This function takes a "variant" configuration dictionary that gets expanded into multiple build matrices. | ||
Arguments: | ||
---------- | ||
* `data` - A dictionary with keys as the variant names and values as the possible values. | ||
* `zip_keys` - A list of lists of keys that should be zipped together. | ||
Returns: | ||
-------- | ||
A list of dictionaries that represent the different combinations of the variant configuration | ||
""" | ||
zip_keys = data.pop("zip_keys", []) | ||
# Separate the keys that need to be zipped from the rest | ||
zip_keys_flat = [item for sublist in zip_keys for item in sublist] | ||
other_keys = [key for key in data if key not in zip_keys_flat] | ||
|
||
# Create combinations for non-zipped keys | ||
other_combinations = list(product(*[data[key] for key in other_keys])) | ||
|
||
# Create zipped combinations | ||
zipped_combinations = [list(zip(*[data[key] for key in zip_group])) for zip_group in zip_keys] | ||
|
||
# Combine zipped combinations | ||
zipped_product = list(product(*zipped_combinations)) | ||
|
||
# Combine all results into dictionaries | ||
final_combinations = [] | ||
for other_combo in other_combinations: | ||
for zipped_combo in zipped_product: | ||
combined = {} | ||
# Add non-zipped items | ||
for key, value in zip(other_keys, other_combo): | ||
combined[key] = str(value) | ||
# Add zipped items | ||
for zip_group, zip_values in zip(zip_keys, zipped_combo): | ||
for key, value in zip(zip_group, zip_values): | ||
combined[key] = str(value) | ||
final_combinations.append(combined) | ||
|
||
return final_combinations |
Oops, something went wrong.