Skip to main content

A singleton-based thread management system

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.70.tar.gz (7.6 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.70-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: toomanythreads-0.2.70.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.2 Windows/11

File hashes

Hashes for toomanythreads-0.2.70.tar.gz
Algorithm Hash digest
SHA256 ca836dfd750e18d84a158b53784a975255c702352a3883c131da62e6fe1f51ca
MD5 1a220f8f1cb4a87df1773fe7272a5e1b
BLAKE2b-256 77e856edc4a581468e190b8454385b174a7d8cc7198248a20803b5ea60c9a13a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: toomanythreads-0.2.70-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.2 Windows/11

File hashes

Hashes for toomanythreads-0.2.70-py3-none-any.whl
Algorithm Hash digest
SHA256 53f655d37a2c1aaa446570962c3600b690d94fc37f5378dc66de5578cbcdc3d5
MD5 b6edd03ad8b3bcf69cd48a1ff9aa1267
BLAKE2b-256 870f2a4f993f6b39438b8b9b5898cf820b1b2ed27f013237dbfb613b53802b61

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