Skip to main content

A lightweight framework for running functions concurrently across multiple threads while maintaining a defined execution order.

Project description

ci PyPI version

threaded-order

A lightweight Python framework for running functions concurrently across multiple threads while maintaining a defined execution order. It lets you declare relationships between tasks—so some run only after others complete—without building complex orchestration logic. Perfect for dependency-aware test execution, build pipelines, or automation flows that benefit from controlled concurrency.

Key features:

  • Executes functions concurrently with Python threads
  • Dependency graph determines execution order
  • Simple base class for registering and managing tasks
  • Thread-safe logging and status tracking

Installation

pip install threaded-order

Usage

See examples in examples folder. To run examples, follow instructions below to build and run the Docker container then execute:

python -m pip install -e .[dev]
python examples/example1.py
2025-11-10 00:08:31 [thread_M]: starting thread pool with 5 threads
2025-11-10 00:08:37 [thread_1]: i02 completed
2025-11-10 00:08:39 [thread_0]: i01 completed
2025-11-10 00:08:40 [thread_2]: i03 completed
2025-11-10 00:08:40 [thread_3]: i04 completed
2025-11-10 00:08:44 [thread_3]: i07 completed
2025-11-10 00:08:47 [thread_0]: i05 completed
2025-11-10 00:08:48 [thread_1]: i06 completed
2025-11-10 00:08:52 [thread_1]: i10 completed
2025-11-10 00:08:53 [thread_0]: i09 completed
2025-11-10 00:08:56 [thread_3]: i08 completed
2025-11-10 00:08:59 [thread_1]: i11 completed
2025-11-10 00:09:00 [thread_0]: i12 completed
2025-11-10 00:09:01 [thread_3]: i13 completed
2025-11-10 00:09:03 [thread_1]: i14 completed
2025-11-10 00:09:07 [thread_0]: i15 completed
2025-11-10 00:09:09 [thread_3]: i16 completed
2025-11-10 00:09:20 [thread_3]: i17 completed
2025-11-10 00:09:20 [thread_M]: all work completed
2025-11-10 00:09:20 [thread_M]: duration: 48.89s

Development

Clone the repository and ensure the latest version of Docker is installed on your development server.

Build the Docker image:

docker image build \
-t threaded-order:latest .

Run the Docker container:

docker container run \
--rm \
-it \
-v $PWD:/code \
threaded-order:latest \
bash

Execute the dev pipeline:

make dev

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

threaded_order-1.0.1.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

threaded_order-1.0.1-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file threaded_order-1.0.1.tar.gz.

File metadata

  • Download URL: threaded_order-1.0.1.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for threaded_order-1.0.1.tar.gz
Algorithm Hash digest
SHA256 f07eb129cc6f834958c87207f3aa0149a7ed20a4e78ca94199c56a7084112d70
MD5 273177f55f945e18c63937aa56938a6c
BLAKE2b-256 a953d8fc6f8819e7ea09e313930cabfe13a6fb98dc36b1d6b173b67c7894b977

See more details on using hashes here.

File details

Details for the file threaded_order-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: threaded_order-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for threaded_order-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1795920fced96104872c66aa41bfca8224be2aa668505cebea7136746031cf28
MD5 1cbbd08d4b523cc597b051224f126324
BLAKE2b-256 d8f0d430c33b1b15680056fb81723dc77416a38ef859fdef7447c16e9c42f497

See more details on using hashes here.

Supported by

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