Zthreading is a Python library offering a unified interface for managing both traditional Python threads and `asyncio` tasks. It provides wrapper classes for event broadcasting, task management, and decorators for common concurrency patterns. The library is actively maintained, with minor releases addressing bug fixes and new features every few months.
pip install zthreadingVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `ThreadManager` to add and manage tasks, both directly and using the `as_task` decorator. It shows how to retrieve results and properly wait for tasks to complete, then clean up the manager.
Update event handler signatures to accept an `Event` object, and access event details (name, sender, args, kwargs) via its attributes (e.g., `evnt.name`, `evnt.args`).
Adjust the `predict` method implementation to accept the `event` object directly, similar to the `on_event` changes. The `Event` object encapsulates all relevant event data.
Upgrade `zthreading` to version 0.1.18 or newer to ensure compatibility with Python 3.10+ environments. The library now uses `threading.current_thread`.
Always explicitly wait for tasks using `manager.wait_for_tasks()` (for results) and/or `manager.join_all()` (for full cleanup of threads/tasks) before your application exits or when you no longer need the manager.
No dependency data recorded yet.