Skip to main content

TSorted lets you sort your data topologically, such as for dependency resolution or task management.

Project description

TSorted

Test status Code coverage PyPI releases Supported Python versions Recent downloads

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 bash outputs 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tsorted-0.1.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

tsorted-0.1.0-py2.py3-none-any.whl (6.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file tsorted-0.1.0.tar.gz.

File metadata

  • Download URL: tsorted-0.1.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for tsorted-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1081b5248ef2da6b265696376313e864e905b78dbee27c2ac20297581d94c109
MD5 56f984f1b576596421fc486efea567a3
BLAKE2b-256 7ed185d9b41b7b912f4b1211fbdf40305f06d65f61b7cbb5b37c5b816539c2c1

See more details on using hashes here.

File details

Details for the file tsorted-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: tsorted-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using 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

File hashes

Hashes for tsorted-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 77bc60757de16f89f46eba08f6ec701cd90d281f0ef1ac93fcacf98c08943256
MD5 654ba154c8898b2ec755a6d05cee2596
BLAKE2b-256 212da272dc0fbd5138b18d98289b1a4780c82d85294a272e0fc2fc3558d5e832

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page