Skip to main content

PyThreadKiller

A utility to manage and kill threads in Python applications.


GitHub Repo GitHub License GitHub Forks GitHub Stars GitHub Contributors

Build Status codecov PyPI Version Test 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
    │   ├── UnittestPyThreadKiller.py
    ├── CHANGELOG.md
    ├── README.md
    ├── .github/
    │   └── workflows/
    │       └── python-app.yml
    └── 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 True

# 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

This file: tests/UnittestPyThreadKiller.py is integral to our CI/CD pipeline for automated testing.

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.

[3.0.4] - 2024-07-20

Fix

  • Test file for PyThreadKiller to test the package itself.

[3.0.6] - 2024-08-04

Documentation and CI/CD

  • Documentation update and CI/CD pipeline for automated testing

[3.0.7] - 2025-12-21

Maintenance

  • Removed unused requests dependency from the project.
  • Cleaned up packaging metadata to reflect zero runtime dependencies.
  • Ensured setup.py and CI configuration install the package directly.
  • Minor project hygiene improvements (no functional code changes).

[3.0.8] - 2025-12-21

Added / Fixed

  • Prepare package for next release.
  • Ensure MANIFEST.in includes correct files.
  • Update version to 3.0.8 for publishing.

Metadata

Release files for pythreadkiller 3.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pythreadkiller 3.0.8
File Size Uploaded Provenance
pythreadkiller-3.0.8.tar.gz 4.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pythreadkiller 3.0.8
File Interpreter ABI Platform
pythreadkiller-3.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 9.7 kB

Release files / pythreadkiller-3.0.8.tar.gz

Download URL pythreadkiller-3.0.8.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
cfb20aa841f18a9a83bbc34ec7894c2c84226e69ba04eed31068813f6a01fdd2
BLAKE2b-256 checksum
How to use checksums
e3de65a619970cff1e2dca2b13eaa9b674a420e997e2441a6e26faf4ed5938eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / pythreadkiller-3.0.8-py3-none-any.whl

Download URL pythreadkiller-3.0.8-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47c7d621ff21bde83527cc79466ba24026cd8dba3fc2e9405483589c1416e938
BLAKE2b-256 checksum
How to use checksums
20d298f6229787b7a30271a3b961b61ac5fa65e49d5a8f23ca2bb78d35df0199
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for pythreadkiller 3.0.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page