diff --git a/docs/changes.rst b/docs/changes.rst index 7c79b26e..5a0a3659 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -15,6 +15,7 @@ all releases are available on `PyPI `_ and system. This facilitates cross-platform builds of projects. Deactivate the check by setting ``check_casing_of_paths = false`` in the configuration file. - :gh:`84` fixes an error in the path normalization introduced by :gh:`81`. +- :gh:`85` sorts collected tasks, dependencies, and products by name. 0.0.14 - 2021-03-23 diff --git a/src/_pytask/collect_command.py b/src/_pytask/collect_command.py index 72255511..d2bb1e63 100644 --- a/src/_pytask/collect_command.py +++ b/src/_pytask/collect_command.py @@ -109,19 +109,25 @@ def _organize_tasks(tasks, common_ancestor): task_dict = { reduced_task_name: { - "depends_on": [ - relative_to(node.path, common_ancestor) - for node in task.depends_on.values() - ], - "produces": [ - relative_to(node.path, common_ancestor) - for node in task.produces.values() - ], + "depends_on": sorted( + [ + relative_to(node.path, common_ancestor) + for node in task.depends_on.values() + ] + ), + "produces": sorted( + [ + relative_to(node.path, common_ancestor) + for node in task.produces.values() + ] + ), } } dictionary[reduced_task_path].update(task_dict) + dictionary = {key: dictionary[key] for key in sorted(dictionary)} + return dictionary