Skip to content

Commit d3d4e85

Browse files
committed
Sort collected tasks, dependencies, and products.
1 parent 7e5b66a commit d3d4e85

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

docs/changes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ all releases are available on `PyPI <https://pypi.org/project/pytask>`_ and
1515
system. This facilitates cross-platform builds of projects. Deactivate the check by
1616
setting ``check_casing_of_paths = false`` in the configuration file.
1717
- :gh:`84` fixes an error in the path normalization introduced by :gh:`81`.
18+
- :gh:`85` sorts collected tasks, dependencies, and products by name.
1819

1920

2021
0.0.14 - 2021-03-23

src/_pytask/collect_command.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,25 @@ def _organize_tasks(tasks, common_ancestor):
109109

110110
task_dict = {
111111
reduced_task_name: {
112-
"depends_on": [
113-
relative_to(node.path, common_ancestor)
114-
for node in task.depends_on.values()
115-
],
116-
"produces": [
117-
relative_to(node.path, common_ancestor)
118-
for node in task.produces.values()
119-
],
112+
"depends_on": sorted(
113+
[
114+
relative_to(node.path, common_ancestor)
115+
for node in task.depends_on.values()
116+
]
117+
),
118+
"produces": sorted(
119+
[
120+
relative_to(node.path, common_ancestor)
121+
for node in task.produces.values()
122+
]
123+
),
120124
}
121125
}
122126

123127
dictionary[reduced_task_path].update(task_dict)
124128

129+
dictionary = {key: dictionary[key] for key in sorted(dictionary)}
130+
125131
return dictionary
126132

127133

0 commit comments

Comments
 (0)