Backport of the Python 3.9 `graphlib` module for Python 3.6+. It provides the `TopologicalSorter` class for performing topological sorting on directed acyclic graphs (DAGs). The library is currently at version 1.1.0 and is actively maintained, with releases tied to updates on its GitHub repository.
pip install graphlib-backportVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates the core functionality of `TopologicalSorter` to process a graph. It shows both obtaining a full static order and processing nodes dynamically, which is useful for parallel execution patterns. Nodes are represented as hashable objects (e.g., strings), and dependencies are defined by providing a set of predecessors for each node.
For Python 3.9+, prefer `from graphlib import TopologicalSorter`. If you must use the backport on 3.9+, ensure your imports are explicitly `from graphlib_backport import TopologicalSorter`. Utilize environment markers or poetry's `python` dependency specifier to conditionally install the backport only on older Python versions.
Migrate your project to Python 3.8 or newer. For Python 3.9+, use the standard library's `graphlib` module.
Use `pip install graphlib-backport` for installation and `from graphlib_backport import TopologicalSorter` (or `import graphlib_backport`) for importing in your Python code.
No dependency data recorded yet.