No project description provided
Project description
pyrunnable
Lightweight convenience wrapper around threading.Thread with lifecycle hooks.
Features
- Simple subclass of
threading.Thread - Lifecycle hooks you can override:
on_start()— called right afterstart()work()— called repeatedly while runningon_stop()— called once after stopping
- Convenient
stop(join: bool = True)helper
Installation
- With pip:
pip install pyrunnable
- With uv (recommended):
uv add pyrunnable
Quick start
from time import sleep
from pyrunnable import Runnable
class Worker(Runnable):
def on_start(self):
print("starting")
def work(self):
print("working")
sleep(0.2)
def on_stop(self):
print("stopping")
if __name__ == "__main__":
w = Worker()
try:
w.start()
w.join() # Runnable inherits from threading.Thread
except KeyboardInterrupt:
w.stop()
Compatibility
- Python: >= 3.6
- OS: Any platform supporting Python threads
Development
This project uses uv for building and packaging.
- Build distributions:
uv build
Links
- Homepage/Repo: https://github.com/nbdy/pyrunnable
- Issues: https://github.com/nbdy/pyrunnable/issues
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyrunnable-1.0.1.tar.gz.
File metadata
- Download URL: pyrunnable-1.0.1.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0345aaf1bd22ccda7db6e5863026ffff4dd727d9caea9462530ddc29d3683825
|
|
| MD5 |
b59b53c4c860df1942575a7f6199b0f8
|
|
| BLAKE2b-256 |
709cdc8e1f8545ebfabdb8fec38adb2d74838df7d13962b73d8216c4ce203aef
|
Provenance
The following attestation bundles were made for pyrunnable-1.0.1.tar.gz:
Publisher:
publish.yml on nbdy/pyrunnable
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyrunnable-1.0.1.tar.gz -
Subject digest:
0345aaf1bd22ccda7db6e5863026ffff4dd727d9caea9462530ddc29d3683825 - Sigstore transparency entry: 628802084
- Sigstore integration time:
-
Permalink:
nbdy/pyrunnable@fafc0e4d12d5ff3c43f088f2ffe35be0f8325fb4 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/nbdy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fafc0e4d12d5ff3c43f088f2ffe35be0f8325fb4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyrunnable-1.0.1-py3-none-any.whl.
File metadata
- Download URL: pyrunnable-1.0.1-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9e86937562ba0ed1eb9d7f034703f1164252574d448a70693682e78a8a25ace
|
|
| MD5 |
09719d66312214c984893e0fe232691e
|
|
| BLAKE2b-256 |
1d3d5166b6970a11ee710e8c66f06be5be5eb086cf4a2048baeb033833a86348
|
Provenance
The following attestation bundles were made for pyrunnable-1.0.1-py3-none-any.whl:
Publisher:
publish.yml on nbdy/pyrunnable
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyrunnable-1.0.1-py3-none-any.whl -
Subject digest:
f9e86937562ba0ed1eb9d7f034703f1164252574d448a70693682e78a8a25ace - Sigstore transparency entry: 628802087
- Sigstore integration time:
-
Permalink:
nbdy/pyrunnable@fafc0e4d12d5ff3c43f088f2ffe35be0f8325fb4 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/nbdy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fafc0e4d12d5ff3c43f088f2ffe35be0f8325fb4 -
Trigger Event:
push
-
Statement type: