Skip to main content

Native threading for Python using C++ and pybind11

Project description

Smuxent

v0.0.2a1 Smuxent is a lightweight native threading module for Python, backed by C++ and pybind11.
It allows you to easily launch background threads in Python using true native threads — with cooperative control and ID tracking.

This project was built for fun, learning, and utility. If you're using this, thanks! Feedback and suggestions are welcome though not sure where that'd be.

Currently supports: Python 3.11.x–3.12.x on Windows (x64 and x86)


What It Does

  • Run Python functions in detached threads
  • Track threads by ID
  • Kill individual threads or all running threads
  • Track thread IDs and check if they are alive
  • Automatically loads the correct native extension based on system architecture

Example

from Smuxent import hello_thread, basic_thread

hello_thread(3)  # prints "Hello, Thread!" three times on another thread

def my_func():
    print("Running on another thread")

thread_id = basic_thread(my_func)  # runs my_func() on another thread, returning the thread ID

All Existing Functions

def basic_thread(func: Callable, *args: Any) -> int: ...
def hello_thread(loop_count: int = 1) -> int: ...

def is_alive(id: int) -> bool: ...
def kill_thread(id: int) -> None: ...
def kill_all_threads() -> None: ...
def get_all_thread_ids() -> List[int]: ...

# === Deprecated / Legacy Functions ===

def __basic_threadOld(func: Callable, *args: Any) -> None:
    """[Deprecated] Use basic_thread instead. This version does not return a thread ID."""

def __hello_threadOld(loop_count: int = 1) -> None:
    """[Deprecated] Use hello_thread instead. This version does not support thread tracking."""

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

smuxent-0.0.2a1.tar.gz (295.0 kB view details)

Uploaded Source

Built Distribution

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

smuxent-0.0.2a1-py3-none-any.whl (294.1 kB view details)

Uploaded Python 3

File details

Details for the file smuxent-0.0.2a1.tar.gz.

File metadata

  • Download URL: smuxent-0.0.2a1.tar.gz
  • Upload date:
  • Size: 295.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for smuxent-0.0.2a1.tar.gz
Algorithm Hash digest
SHA256 bbe0eb56f1fc28936ec11063311457f4456739ad1c87636dc00883d331b18789
MD5 ddc56dc60193ae5952a662a5144b6b36
BLAKE2b-256 6ce09343118e3db3388a26bcffbfd9d7a29597a0fa387ff232cc8639dad6b1d0

See more details on using hashes here.

File details

Details for the file smuxent-0.0.2a1-py3-none-any.whl.

File metadata

  • Download URL: smuxent-0.0.2a1-py3-none-any.whl
  • Upload date:
  • Size: 294.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for smuxent-0.0.2a1-py3-none-any.whl
Algorithm Hash digest
SHA256 02de624c93313bc80072f72b1f3b29ac3e5c2286793b7776851442b071bac2d8
MD5 b72acd9f85fd71f3530751d7914b4894
BLAKE2b-256 03f610f9bad86ffe0cb3099277ab6c578866286819ca5044f1312d117be48ad6

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