Timekiller
It lets call any function with a timeout!
Install
pip install timekiller
Link pypi: https://pypi.python.org/pypi/timekiller
Example
Call function
import timekiller
import time
def long_function(foo, bar):
while True:
time.sleep(10)
print(foo, bar)
# call(func, max_time, *args, **kwargs)
timekiller.call(long_function, 5, "woo", bar="Uhmm")
@timekiller.timeout(5)
def long_function_with_decorator(foo, bar)
while True:
time.sleep(10)
print(foo, bar)
long_function_with_decorator("woo", "Uhmm")
Capture exception
import timekiller
import time
@timeout(1)
def long_function():
try:
time.sleep(10)
except timekiller.TimeoutException:
print("capture exception")
long_function()
TODO: - It works in main thread and processes (not work in threads)
CHANGELOG
0.0.3 (2016-06-15)
Fix manifest.in
Fix pip install version
0.0.2 (2016-06-15)
Fix raise exception
0.0.1 (2016-06-14)
Initial version
Metadata
Release files for timekiller 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| timekiller-0.0.3.tar.gz | 2.5 kB | Without provenance | Details for timekiller-0.0.3.tar.gz |
Release files / timekiller-0.0.3.tar.gz
| Download URL | timekiller-0.0.3.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e00c4664979637a75bc5a6cbc4ab9ed0b9116c68fa3b386d9d397b8bcd32882
|
|
BLAKE2b-256 checksum How to use checksums |
6b69c7358534a058fce60ba583c150671faee428603685a0a8978397b9d6abf9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for timekiller 0.0.3
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.