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.0.tar.gz (8.6 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.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: threaded_order-1.0.0.tar.gz
  • Upload date:
  • Size: 8.6 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.0.tar.gz
Algorithm Hash digest
SHA256 85c32d924a0e934f28c296d6e7aef6b72bc7d84eee4b3cd32dcfd90ff7d5c026
MD5 4c1e6602a5e33332d087d1c999a2ec5a
BLAKE2b-256 52b3201722a4f7260252daff8e2ae736b5dc02b0686749cc20046f5b2b1fc3bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: threaded_order-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a9d3d37d577d6f62315f66332fcf57f05061cce62ce09b113435a4b1047fa935
MD5 1fda3332c5ec67cb7eb57d0e546916e8
BLAKE2b-256 36cf30da790845458fc9b979e5169f6c57fdad06bbf6bf4dc7b9ca52d28dab93

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