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)
| File | Size | Uploaded | |
|---|---|---|---|
| multithreader-1.0.5.tar.gz | 2.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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+
|