Skip to content

Commit

Permalink
prevent dependency reordering when rendering final environment
Browse files Browse the repository at this point in the history
  • Loading branch information
wolny committed Feb 19, 2024
1 parent 966cc29 commit 5816fc4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/conda_devenv/devenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,15 +403,15 @@ def merge_dependencies_version_specifications(
else:
raise UsageError(f"Only strings and dicts are supported, got: {dep!r}")

result = set()
# keep the order of dependencies
result = collections.OrderedDict()
for dep_name, dep_version_matchers in new_dependencies.items():
if len(dep_version_matchers) > 0:
result.add(dep_name + " " + ",".join(dep_version_matchers))
result[dep_name + " " + ",".join(dep_version_matchers)] = None
else:
result.add(dep_name)
result[dep_name] = None

new_dict_dependencies = sorted(new_dict_dependencies, key=lambda x: list(x.keys()))
yaml_dict[key_to_merge] = sorted(result) + new_dict_dependencies
yaml_dict[key_to_merge] = list(result.keys()) + new_dict_dependencies


@dataclass(frozen=True)
Expand Down

0 comments on commit 5816fc4

Please sign in to comment.