TSorted
TSorted lets you sort your data topologically, such as for dependency resolution or task management.
Usage
Before sorting your data, transform it into a Directed Acyclic Graph (DAG). Graph dictionary keys are the (hashable) starting vertices, and their values are sets of destination vertices, defining unidirectional edges.
A standard topological sort:
from tsorted import tsorted
graph = {
1: {2, 3},
2: {4},
4: {3},
}
tsorted(graph)
# >>> OrderedSet([1, 2, 4, 3])
A grouped topological sort:
from tsorted import tsorted_grouped
graph = {
1: {2, 3},
2: {4},
3: {4},
}
tsorted_grouped(graph)
# >>> OrderedSet([frozenset({1}), frozenset({2, 3}), frozenset({4})])
Development
First, fork and clone the repository, and navigate to its root directory.
Requirements
- Bash (you're all good if
which bashoutputs a path in your terminal)
Installation
If you have tox installed on your machine, tox --develop will create the necessary
virtual environments and install all development dependencies.
Alternatively, in any existing Python environment, run ./bin/build-dev.
Testing
In any existing Python environment, run ./bin/test.
Fixing problems automatically
In any existing Python environment, run ./bin/fix.
Contributions 🥳
TSorted is Free and Open Source Software. As such you are welcome to report bugs or submit improvements.
Copyright & license
TSorted is copyright Bart Feenstra and contributors, and released under the MIT License. In short, that means you are free to use TSorted, but if you distribute TSorted yourself, you must do so under the exact same license and provide that license.
Metadata
Release files for tsorted 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tsorted-0.1.0.tar.gz | 4.6 kB | Without provenance | Details for tsorted-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tsorted-0.1.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for tsorted-0.1.0-py2.py3-none-any.whl |
Total release size: 11.2 kB
Release files / tsorted-0.1.0.tar.gz
| Download URL | tsorted-0.1.0.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1081b5248ef2da6b265696376313e864e905b78dbee27c2ac20297581d94c109
|
|
BLAKE2b-256 checksum How to use checksums |
7ed185d9b41b7b912f4b1211fbdf40305f06d65f61b7cbb5b37c5b816539c2c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6
|
Release files / tsorted-0.1.0-py2.py3-none-any.whl
| Download URL | tsorted-0.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
77bc60757de16f89f46eba08f6ec701cd90d281f0ef1ac93fcacf98c08943256
|
|
BLAKE2b-256 checksum How to use checksums |
212da272dc0fbd5138b18d98289b1a4780c82d85294a272e0fc2fc3558d5e832
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6
|
Security for tsorted 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.