This release is a pre-release and may not be stable for production use.
minimal-thread-pool
A minimal Python 2+ thread pool designed for clarity, without reliance on concurrent.futures.
Features
- Explicit: If any submitted job raises an exception, the corresponding worker thread terminates loudly.
- Easy lifecycle: Add tasks, then call
.join()to wait for completion. Pull results as soon as they are ready.
Installation
pip install minimal-thread-pool
Usage
from __future__ import print_function
import time
import random
from minimal_thread_pool import MinimalThreadPool
def slow_square(x):
time.sleep(random.randint(1, 10))
return x * x
pool = MinimalThreadPool(num_threads=2)
for i in range(10):
# def add_task(self, func, *args, **kwargs)
pool.add_task(slow_square, i)
# Retrieve results (order not guaranteed)
for thread_index, result in pool.results():
print('Worker %d returned %s' % (thread_index, result))
# Wait for all tasks
pool.join()
Contributing
Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.
License
This project is licensed under the MIT License.
Metadata
Release files for minimal-thread-pool 0.1.0a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| minimal_thread_pool-0.1.0a0.tar.gz | 3.3 kB | Without provenance | Details for minimal_thread_pool-0.1.0a0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| minimal_thread_pool-0.1.0a0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for minimal_thread_pool-0.1.0a0-py2.py3-none-any.whl |
Total release size: 7.1 kB
Release files / minimal_thread_pool-0.1.0a0.tar.gz
| Download URL | minimal_thread_pool-0.1.0a0.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee86008cce1d9c01a09c7f47c829cab1849600d8fd14da095c0ece15da729c96
|
|
BLAKE2b-256 checksum How to use checksums |
522174c8d193699f6c6d8317d78c7018f17b633cea74ae70c234ce3622df5e36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / minimal_thread_pool-0.1.0a0-py2.py3-none-any.whl
| Download URL | minimal_thread_pool-0.1.0a0-py2.py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
dbd16608caf93d4a742b94c2080895848fda7bad144da5a11f4223311bdbcf55
|
|
BLAKE2b-256 checksum How to use checksums |
31d12bc9e8a9d0f0502b3df41e4596387ceaf94614df8392a6770717d1ede4c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Security for minimal-thread-pool 0.1.0a0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.