Overdue
Conveniently stop Python code from running when it is taking too long on Python 3.10+. Ships with type annotations and depends at runtime on nothing but Python itself.
For older Pythons, consider stopit.
Installation
$ pip install overdue or whatever is the equivalent in your favorite package manager.
Using a context manager
Without exceptions:
from overdue import timeout_set_to
with timeout_set_to(0.25) as timeout:
# Slow code
if timeout.triggered:
# Handle timeout
With an exception:
from datetime import timedelta
from overdue import timeout_set_to, TaskAbortedError
try:
with timeout_set_to(timedelta(milliseconds=250), raise_exception=True):
# Slow code
except TaskAbortedError:
# Handle timeout
Using a decorator
With an exception:
from overdue import timecapped_to, TaskAbortedError
@timecapped_to(0.25)
def my_slow_function() -> None:
# Slow code
try:
my_slow_function()
except TaskAbortedError:
# Handle timeout
Without exceptions:
from overdue import in_time_or_none
@in_time_or_none(0.25)
def my_slow_function() -> int:
# Slow code
return 7
if (result := my_slow_function()) is None:
# Handle timeout
Metadata
Release files for overdue 0.1.5
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 |
|---|---|---|---|---|
| overdue-0.1.5.tar.gz | 13.2 kB | Without provenance | Details for overdue-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| overdue-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for overdue-0.1.5-py3-none-any.whl |
Total release size: 16.8 kB
Release files / overdue-0.1.5.tar.gz
| Download URL | overdue-0.1.5.tar.gz |
|---|---|
| Size | 13.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6781da739f802d904f4a0d404824f315c5cb1911b309f7a6d4b5f465374cd2da
|
|
BLAKE2b-256 checksum How to use checksums |
0f287a099f4f699c23b0b7701a9901325b4fd1c3812bb45be9438f97a16d25ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.9
|
Release files / overdue-0.1.5-py3-none-any.whl
| Download URL | overdue-0.1.5-py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3ece13e9f7ef8636b9c906143b9573a333ef81953e38d870b4e0732c0d7ce063
|
|
BLAKE2b-256 checksum How to use checksums |
53012a14f0d4e9777452f444fbb96dabc8abedf482ae140a1e22a05baab05813
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.9
|
Security for overdue 0.1.5
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.