# Managed Threads
A singleton-based thread management system with auto-registration, verbose logging, and dynamic mixin support.
## Quick Start
```python
from toomanythreads import ManagedThread, manager
import time
# Simple function to run in a thread
def worker_function(name, delay=1):
for i in range(5):
print(f"Worker {name}: iteration {i}")
time.sleep(delay)
# Create and start a managed thread
thread = ManagedThread(worker_function)
thread.start()
# Check registered threads
print(f"Active threads: {len(manager.threads)}")
# Wait for completion
thread.join()
```
### ManagedThread
A decorator/factory function that creates managed threads. Can be used as a decorator.
**Parameters:**
- `obj`: Callable to run in the thread
- `*args`: Arguments to pass to the callable
- `**kwargs`: Keyword arguments to pass to the callable
**Returns:** Thread instance with management capabilities
## Requirements
- Python 3.8+
- loguru >= 0.6.0
- singleton-decorator >= 1.0.0
## License
MIT License - see LICENSE file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "toomanythreads",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "threading, thread, management, singleton, decorator, async",
"author": "Miles Copeland Luce",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/31/7f/fd7acffec4a0f3db686111963bb5d1c873eb37c5f4ffadc40361c24a390f/toomanythreads-0.2.62.tar.gz",
"platform": null,
"description": "# Managed Threads\n\nA singleton-based thread management system with auto-registration, verbose logging, and dynamic mixin support.\n\n## Quick Start\n\n```python\nfrom toomanythreads import ManagedThread, manager\nimport time\n\n# Simple function to run in a thread\ndef worker_function(name, delay=1):\n for i in range(5):\n print(f\"Worker {name}: iteration {i}\")\n time.sleep(delay)\n\n# Create and start a managed thread\nthread = ManagedThread(worker_function)\nthread.start()\n\n# Check registered threads\nprint(f\"Active threads: {len(manager.threads)}\")\n\n# Wait for completion\nthread.join()\n```\n\n### ManagedThread\n\nA decorator/factory function that creates managed threads. Can be used as a decorator.\n\n**Parameters:**\n- `obj`: Callable to run in the thread\n- `*args`: Arguments to pass to the callable\n- `**kwargs`: Keyword arguments to pass to the callable\n\n**Returns:** Thread instance with management capabilities\n\n## Requirements\n\n- Python 3.8+\n- loguru >= 0.6.0\n- singleton-decorator >= 1.0.0\n\n## License\n\nMIT License - see LICENSE file for details.",
"bugtrack_url": null,
"license": "MIT",
"summary": "A singleton-based thread management system",
"version": "0.2.62",
"project_urls": null,
"split_keywords": [
"threading",
" thread",
" management",
" singleton",
" decorator",
" async"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "adfc84c0b0f79aba096ad3743db1671c2733ad2b4ba721ea0b42b1cbc93bd738",
"md5": "54b026b0e92b63d9d73529a27113e1a0",
"sha256": "39d48bf805472fbb0889f9c69e454786f6192a188a268be2741af6c549f4e0ef"
},
"downloads": -1,
"filename": "toomanythreads-0.2.62-py3-none-any.whl",
"has_sig": false,
"md5_digest": "54b026b0e92b63d9d73529a27113e1a0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 5883,
"upload_time": "2025-08-07T07:53:40",
"upload_time_iso_8601": "2025-08-07T07:53:40.035069Z",
"url": "https://files.pythonhosted.org/packages/ad/fc/84c0b0f79aba096ad3743db1671c2733ad2b4ba721ea0b42b1cbc93bd738/toomanythreads-0.2.62-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "317ffd7acffec4a0f3db686111963bb5d1c873eb37c5f4ffadc40361c24a390f",
"md5": "c629205290bd0aeac41905e2778b1263",
"sha256": "505884a106d10b73a161fe3916692b28fda8926231ef94688524abd4e121bb08"
},
"downloads": -1,
"filename": "toomanythreads-0.2.62.tar.gz",
"has_sig": false,
"md5_digest": "c629205290bd0aeac41905e2778b1263",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 6427,
"upload_time": "2025-08-07T07:53:41",
"upload_time_iso_8601": "2025-08-07T07:53:41.001383Z",
"url": "https://files.pythonhosted.org/packages/31/7f/fd7acffec4a0f3db686111963bb5d1c873eb37c5f4ffadc40361c24a390f/toomanythreads-0.2.62.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-07 07:53:41",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "toomanythreads"
}