Open this example in the interactive library
Source code
from graphlib import TopologicalSorter
tasks = {'publish': {'build'}, 'build': {'fetch'}, 'fetch': set()}
print(list(TopologicalSorter(tasks).static_order()))Sample output
['fetch', 'build', 'publish']
