toposort
Implements a topological sort algorithm.
Decision gist · record as of 2026-08-14
Yes, if you need a simple, dependency-free topological sort. The algorithm is stable and well-tested (Production/Stable status), and the abandoned maintenance status poses minimal risk for a mature, narrow-scope library. Use it for straightforward dependency ordering; if you need advanced graph algorithms or active support, consider alternatives.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low install friction with no runtime dependencies.
- Package is marked abandoned (last release 2023-02-25, 1266 days ago), so expect no active maintenance or bug fixes.
License · maintenance · safety
Apache License Version 2.0 (permissive) — Apache License 2.0 (permissive) allows use in most projects without significant restrictions.
last release 2023-02-25 (1266 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 13,017,745 downloads/mo, #1,297 on PyPI
Alternatives
Verify before relying
from toposort import toposort, toposort_flatten
data = {2: {11}, 9: {11, 8, 10}, 10: {11, 3}, 11: {7, 5}, 8: {7, 3}}
result = list(toposort(data))
flat = toposort_flatten(data)- Whether the abandoned status affects reliability for stable, well-tested algorithms like topological sort.
- Performance characteristics on large graphs or whether there are known limitations in the implementation.
What it is and what it does
toposort is a pure Python implementation of the topological sorting algorithm. It takes a dictionary where each key is a node and its value is a set of nodes it depends on, then returns an iterator of sets representing valid processing orders—nodes with no remaining dependencies come first. If a circular dependency exists, it raises CyclicDependencyError with details about the cycle.
The package is straightforward and self-contained, with no external runtime dependencies. It supports both granular iteration (toposort) and flattened output (toposort_flatten), making it suitable for build systems, task scheduling, and any workflow requiring dependency resolution. The implementation handles arbitrary hashable node types, not just integers.
Use it for
- Determine build order for interdependent software modules or packages.
- Schedule task execution respecting prerequisite constraints in workflow systems.
- Resolve import or initialization order in complex codebases with circular-dependency detection.
- Order database migrations or schema changes based on foreign-key dependencies.
- Compute execution order for computation graphs in data pipelines.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need a simple, dependency-free topological sort.
The algorithm is stable and well-tested (Production/Stable status), and the abandoned maintenance status poses minimal risk for a mature, narrow-scope library. Use it for straightforward dependency ordering; if you need advanced graph algorithms or active support, consider alternatives.
Install
toposort on PyPI
Before you install
Low install friction with no runtime dependencies. Package is marked abandoned (last release 2023-02-25, 1266 days ago), so expect no active maintenance or bug fixes.
License in practice
Apache License 2.0 (permissive) allows use in most projects without significant restrictions.
Quickstart
from toposort import toposort, toposort_flatten
data = {2: {11}, 9: {11, 8, 10}, 10: {11, 3}, 11: {7, 5}, 8: {7, 3}}
result = list(toposort(data))
flat = toposort_flatten(data)
Verify before relying
- Whether the abandoned status affects reliability for stable, well-tested algorithms like topological sort.
- Performance characteristics on large graphs or whether there are known limitations in the implementation.
Package facts
| License | Apache License Version 2.0 permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Abandoned 1,266 days since the last release |
| First released | |
| Downloads | 13,017,745 / month, #1,297 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules |
Evidence: toposort-1.10-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “dependency ordering”
- toposortImplements topological sorting of directed acyclic graphs, ordering…
- colcon-corecolcon-core is a command-line tool that orchestrates building,…
- importlabImportlab infers Python import dependencies and builds a dependency…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also bigtree · cyclic · types-toposort · altgraph · Dijkstar · objectgraph · asciidag · anastruct · grandalf · natsort