py-timeout
py-timeout - pure Python process based decorator that provides execution timeout for Python functions and methods. Since it is not based on signals, py-timeout works fine outside the main thread.
Prerequisites
py-timeout requires python 3.6 or newer versions to run.
Installing
Cloning project from git repository
git clone https://github.com/YADRO-KNS/py-timeout.git
Installing from PyPi
pip3 install py-timeout
Examples
import timeout
@timeout.timeout(duration=0.5)
def foo(value: int) -> None:
...
...
@timeout.timeout(duration=0.5)
def bar(self, value: str) -> str:
...
Decorated function or method will be executed as a sub-process with expected life-time of passed duration value.
import timeout
import time
@timeout.timeout(duration=5)
def foo() -> None:
while True:
time.sleep(1)
try:
foo()
except timeout.TimeoutException:
pass
In case if for some reason execution will take longer than expected the process will be terminated and TimeoutException will be raised.
Versioning
We use SemVer for versioning.
Authors
See also the list of contributors who participated in this project.
License
The code is available as open source under the terms of the MIT License.
Metadata
Release files for py-timeout 0.0.1
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 |
|---|---|---|---|---|
| py-timeout-0.0.1.tar.gz | 4.3 kB | Without provenance | Details for py-timeout-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_timeout-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for py_timeout-0.0.1-py3-none-any.whl |
Total release size: 10.8 kB
Release files / py-timeout-0.0.1.tar.gz
| Download URL | py-timeout-0.0.1.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
819f5d5ed1b320dd2f5cb5f01a623b8bead9231be9aa16aad193fcb4ca27bc27
|
|
BLAKE2b-256 checksum How to use checksums |
1cbed6f0886519d05256668b9c1971509996700543857e0334f5dcbd39c2c92b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.6.8
|
Release files / py_timeout-0.0.1-py3-none-any.whl
| Download URL | py_timeout-0.0.1-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c3c14b81d242e8d5ac8e8cb945c349ef2b26b4586e9f132cb744eec9ad04f521
|
|
BLAKE2b-256 checksum How to use checksums |
60263ec50d61f9b84105279cdbc80a20bfb94d566362f60c0dac5921cd396448
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.6.8
|
Security for py-timeout 0.0.1
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.