Skip to main content

Overview

Execute Python functions with multithreading.

Usage

Installation:

pip3 install multithreader
# or
python3 -m pip install multithreader

Example:

def test_function(
    iterator,
    items
) -> int:
    """Sum two numbers."""
    print(iterator)
    sleep(1)
    return items['a'] + items['b']

# Import multithreader.
from multithreader import threads

# Define arguments.
items = {
    'a': 1,
    'b': 2
}

# Define iterators.
iterators = [1, 2, 3, 4, 5]

# Execute function with multithreading.
results = threads(
    test_function,
    iterators,
    items,
    thread_num=int(sys.argv[1])
)

# Print results.
print(results)

Full Example

Release files for multithreader 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for multithreader 1.0.5
File Size Uploaded
multithreader-1.0.5.tar.gz 2.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for multithreader 1.0.5
File Interpreter ABI Platform
multithreader-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 5.5 kB

Release files / multithreader-1.0.5.tar.gz

Download URL multithreader-1.0.5.tar.gz
Size 2.1 kB
Tags Source
SHA-256 checksum
How to use checksums
83868fff44776c5f072821f49405ef405ccb2c7dc674c71cd6ee380f11e6dde8
BLAKE2b-256 checksum
How to use checksums
d697120f4541a90c81dc1c07cb1b08171f2dcd64b85efe3e12b52145da9e4e58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.3 Linux/5.15.154+

Release files / multithreader-1.0.5-py3-none-any.whl

Download URL multithreader-1.0.5-py3-none-any.whl
Size 3.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
067cd38d1ef38755a483b61809c088a56e6805a444802fee97acff0d19beb4f4
BLAKE2b-256 checksum
How to use checksums
d0f1977eb6a3a16a98ece214415db987d3cf19cd9b5277aaaa041dccdec5ddde
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.12.3 Linux/5.15.154+

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page