=================
**multithreader**
=================
Overview
--------
Execute Python functions with multithreading.
Usage
-----
Installation:
.. code-block:: BASH
pip3 install multithreader
# or
python3 -m pip install multithreader
Example:
.. code-block:: PYTHON
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
------------
- `List AWS Hosted Zones in an organization <https://gitlab.com/fer1035_python/modules/pypi-multithreader/-/blob/main/examples/org_hosted_zones.py>`_
Raw data
{
"_id": null,
"home_page": "https://gitlab.com/fer1035_python/modules/pypi-multithreader",
"name": "multithreader",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<4.0",
"maintainer_email": "",
"keywords": "multithreading,functions,threading,parallel,concurrent",
"author": "Ahmad Ferdaus Abd Razak",
"author_email": "ahmad.ferdaus.abd.razak@ni.com",
"download_url": "https://files.pythonhosted.org/packages/ae/8a/049595cf327cdfdefc99a869b31fac9eb6b2fa7f4e99aa35fd855ead6df0/multithreader-1.0.4.tar.gz",
"platform": null,
"description": "=================\n**multithreader**\n=================\n\nOverview\n--------\n\nExecute Python functions with multithreading.\n\nUsage\n-----\n\nInstallation:\n\n.. code-block:: BASH\n\n pip3 install multithreader\n # or\n python3 -m pip install multithreader\n\nExample:\n\n.. code-block:: PYTHON\n\n def test_function(\n iterator,\n items\n ) -> int:\n \"\"\"Sum two numbers.\"\"\"\n print(iterator)\n sleep(1)\n return items['a'] + items['b']\n\n # Import multithreader.\n from multithreader import threads\n\n # Define arguments.\n items = {\n 'a': 1,\n 'b': 2\n }\n\n # Define iterators.\n iterators = [1, 2, 3, 4, 5]\n\n # Execute function with multithreading.\n results = threads(\n test_function,\n iterators,\n items,\n thread_num=int(sys.argv[1])\n )\n\n # Print results.\n print(results)\n\nFull Example\n------------\n\n- `List AWS Hosted Zones in an organization <https://gitlab.com/fer1035_python/modules/pypi-multithreader/-/blob/main/examples/org_hosted_zones.py>`_\n",
"bugtrack_url": null,
"license": "GPL-2.0-only",
"summary": "Execute Python functions with multithreading.",
"version": "1.0.4",
"project_urls": {
"Homepage": "https://gitlab.com/fer1035_python/modules/pypi-multithreader",
"Repository": "https://gitlab.com/fer1035_python/modules/pypi-multithreader"
},
"split_keywords": [
"multithreading",
"functions",
"threading",
"parallel",
"concurrent"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "12465c5a03d789402bfea3ee488f692f1259fce3538b901285303805687e39c3",
"md5": "c40c4df74bc6388f6e0fc7909cf81e78",
"sha256": "9ddc4b52794898fccad8c59b9912b3fe365d6b139f57a22d5fd0836264e3bdd2"
},
"downloads": -1,
"filename": "multithreader-1.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c40c4df74bc6388f6e0fc7909cf81e78",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4.0",
"size": 2829,
"upload_time": "2024-02-02T12:44:28",
"upload_time_iso_8601": "2024-02-02T12:44:28.576007Z",
"url": "https://files.pythonhosted.org/packages/12/46/5c5a03d789402bfea3ee488f692f1259fce3538b901285303805687e39c3/multithreader-1.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ae8a049595cf327cdfdefc99a869b31fac9eb6b2fa7f4e99aa35fd855ead6df0",
"md5": "c2503c84109cbb512e8f42173c8b1e19",
"sha256": "7ef6d55976405e22cd60d1506095997962a2d23aebce35720150961079002c12"
},
"downloads": -1,
"filename": "multithreader-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "c2503c84109cbb512e8f42173c8b1e19",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4.0",
"size": 1954,
"upload_time": "2024-02-02T12:44:30",
"upload_time_iso_8601": "2024-02-02T12:44:30.177262Z",
"url": "https://files.pythonhosted.org/packages/ae/8a/049595cf327cdfdefc99a869b31fac9eb6b2fa7f4e99aa35fd855ead6df0/multithreader-1.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-02 12:44:30",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "fer1035_python",
"gitlab_project": "modules",
"lcname": "multithreader"
}