Skip to main content

A utility to manage and kill threads in Python applications

Project description

PyThreadKiller

A utility to manage and kill threads in Python applications.


GitHub Repo GitHub License GitHub Forks GitHub Stars GitHub Contributors

Build Status Coverage Status PyPI version

GitHub Image


Overview

PyThreadKiller is a utility designed to manage and kill threads in Python applications. This package provides a simple and effective way to terminate threads safely and retrieve return values from target functions.

Directory Structure

PyThreadKiller/
    ├── PyThreadKiller/
    │   ├── __init__.py
    │   ├── main.py
    ├── tests/
    │   ├── TestPyThreadKiller.py
    ├── CHANGELOG.md
    ├── README.md
    ├── requirements.txt
    └── setup.py

Installation

You can install the package using pip:

pip install PyThreadKiller

Usage

  • Here is an example of how to use PyThreadKiller:
import time
from PyThreadKiller import PyThreadKiller

def example_target():
    for i in range(5):
        print(f"Thread is running... {i}")
        time.sleep(1)
    return 5

# Create an instance of PyThreadKiller
thread = PyThreadKiller(target=example_target)
thread.start()

# Allow the thread to run for 3 seconds
time.sleep(3)

# Kill the thread
result = thread.kill()
print(f"Return value after killing the thread: {result}")

# Output:
# Thread is running... 0
# Thread is running... 1
# Thread is running... 2
# Thread killed successfully
# Return value after killing the thread: None

License:

  • This project is licensed under the MIT License - see the LICENSE file for details.

  • This updated README.md includes the new project name, badges, a brief overview, the directory structure, installation instructions, usage example, changelog, and the main code for the PyThreadKiller class. Make sure to adjust any URLs and links to point to the correct resources for your project.

Changelog

[0.1] - 2024-05-19

Added

  • Initial draft of PyThreadKiller with basic thread management and killing functionality.

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

pythreadkiller-3.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

PyThreadKiller-3.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file pythreadkiller-3.0.tar.gz.

File metadata

  • Download URL: pythreadkiller-3.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for pythreadkiller-3.0.tar.gz
Algorithm Hash digest
SHA256 525934e2ce0d3ab376935e8f2049a55b62b9464b7b87ec42f2e6f63cb0799b93
MD5 5aaca1a90a694d91c9b9c7e86ade7a47
BLAKE2b-256 03db18a5565ac66255d5e2695b52e595075bd42b13ca28d5341ec2afdf07a171

See more details on using hashes here.

File details

Details for the file PyThreadKiller-3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for PyThreadKiller-3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 70ea652b3d3a6e4dbf806b6dbce675c1c09c8fa87cd03579749467e154cc0e00
MD5 f37a40f97cf9e38a3361b964a477252e
BLAKE2b-256 23331ed70f5aa19e1593508311f7db1ccac6f88617c55ed74e6330f29af10ee9

See more details on using hashes here.

Supported by

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