Skip to main content

A singleton-based thread management system with auto-registration and verbose logging

Project description

Managed Threads

A singleton-based thread management system with auto-registration, verbose logging, and dynamic mixin support.

Quick Start

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

toomanythreads-0.2.0.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

toomanythreads-0.2.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file toomanythreads-0.2.0.tar.gz.

File metadata

  • Download URL: toomanythreads-0.2.0.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for toomanythreads-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0886a0dccd44f2406b8dedb4056a97a901c528763f906d572a59a4ed45769baa
MD5 ab6c821c0c666a73a658f80c7e07d86d
BLAKE2b-256 e30d32d8b45af4cb604713a9e0554842cfe84a2e1bca33c2746b41a1811f28dc

See more details on using hashes here.

File details

Details for the file toomanythreads-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: toomanythreads-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for toomanythreads-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ecb764ab9f244abbb26ff60cc85d9ff2548f50bfed3f6051fb52674ad4da461a
MD5 96dbe6a52fd4965d845c64c990a4208c
BLAKE2b-256 e0631b8a947aae021584b10cb2ab13b7af387058441505afee4a667621439dfb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page