Skip to content

Commit 8edd55c

Browse files
committed
format
1 parent 116be20 commit 8edd55c

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

unidep/_pixi.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,14 @@ def _initialize_pixi_data(
6060
return pixi_data
6161

6262

63-
def group_by_origin(
63+
def _format_pin(pin: str) -> Any:
64+
parts = pin.split()
65+
if len(parts) == 2: # noqa: PLR2004
66+
return {"version": parts[0], "build": parts[1]}
67+
return pin
68+
69+
70+
def _group_by_origin(
6471
resolved_deps: dict[str, dict[Platform | None, dict[CondaPip, Spec]]],
6572
) -> dict[Path, dict[str, dict[Platform | None, dict[CondaPip, Spec]]]]:
6673
groups: dict[Path, dict[str, dict[Platform | None, dict[CondaPip, Spec]]]] = {}
@@ -84,7 +91,7 @@ def _process_dependencies( # noqa: PLR0912
8491
"""Process the resolved dependencies and update the pixi manifest data.
8592
8693
This function first groups the resolved dependencies by origin (using
87-
group_by_origin) and then creates a separate feature (under the "feature"
94+
_group_by_origin) and then creates a separate feature (under the "feature"
8895
key in pixi_data) for each origin. The feature name is derived using the
8996
parent directory's stem of the origin file.
9097
@@ -94,7 +101,7 @@ def _process_dependencies( # noqa: PLR0912
94101
- one environment per feature (with the feature name as the sole member).
95102
"""
96103
# --- Step 1: Group by origin and create per-origin features ---
97-
origin_groups = group_by_origin(resolved_dependencies)
104+
origin_groups = _group_by_origin(resolved_dependencies)
98105
features = pixi_data.setdefault("feature", {})
99106

100107
for origin_path, group_deps in origin_groups.items():
@@ -115,6 +122,7 @@ def _process_dependencies( # noqa: PLR0912
115122
for pkg_name, platform_to_spec in group_conda.items():
116123
for _platform, spec in platform_to_spec.items():
117124
pin = spec.pin or "*"
125+
pin = _format_pin(pin)
118126
if _platform is None:
119127
feature_entry["dependencies"][pkg_name] = pin
120128
else:

unidep/_pixi_lock.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ def _generate_sub_lock_file(
218218
return output_file
219219

220220

221-
# Updated pixi_lock_command
222221
def pixi_lock_command(
223222
*,
224223
depth: int,

0 commit comments

Comments
 (0)