interruptingcow
A watchdog that interrupts long running code.
What it is and what it does
Interruptingcow provides a context manager and decorator to enforce execution timeouts in Python by raising an exception when code runs longer than a specified duration. It uses the operating system's SIGALRM signal to interrupt execution, allowing you to gracefully handle slow operations or infinite loops.
The package supports nested timeouts (where inner timeouts can be smaller than outer ones) and quota-based time allocation, letting you share a fixed time budget across multiple invocations. However, it only works on the main thread and cannot coexist with other code that uses SIGALRM signals, making it unsuitable for multi-threaded applications or certain profiling scenarios.
Use it for:
- Enforce maximum execution time for web request handlers or API endpoints that might hang.
- Implement a time budget across multiple loop iterations, falling back to cheaper operations when time runs out.
- Wrap potentially infinite or very slow operations in a decorator to prevent them from blocking the entire program.
- Create nested timeout scopes where an outer timeout bounds the total runtime of multiple inner operations.
- Debug or test code that may hang by catching timeout exceptions and logging diagnostic information.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Interrupts long-running Python code by raising an exception after a specified timeout, using signal-based interruption on the main thread.
No. The package is abandoned (last release 2018, no maintenance for 3090 days) with no active support. While it has no known vulnerabilities and the MIT license is permissive, the signal-based approach is fundamentally limited to the main thread and incompatible with modern async patterns. For new projects, use a maintained alternative like `timeout-decorator`, `signal-timeout`, or language-native async timeout mechanisms.
Install
interruptingcow on PyPI
pip
pip install interruptingcowuv
uv add interruptingcowpoetry
poetry add interruptingcowInstalling interruptingcow
Before you install
High install friction: the package is abandoned (last release 2018-02-27, 3090 days ago) with no recent maintenance signal. No runtime dependencies, but the stale codebase and lack of active support are significant concerns for new projects.
License in practice
MIT license (permissive) means you can use, modify, and distribute this package freely with minimal restrictions, though you must include the license notice.
Quickstart
from interruptingcow import timeout
try:
with timeout(5):
# slow operation
pass
except RuntimeError:
print('operation timed out')
Only works on the main thread; uses SIGALRM signal, so incompatible with code that also uses SIGALRM (including certain profilers).
Verify before relying
- Whether the package works reliably on modern Python versions (classifiers list 2.7 and 3.5, but no recent testing reported).
- Whether nested timeouts and quota sharing work as documented on current Python releases.
- Compatibility with async/await and modern concurrency patterns.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 3,090 days since the last release |
| First released | |
| Downloads | 169,283/month — #10,422 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: interruptingcow-0.8.tar.gz
Keywords: debug, watchdog, timer, interrupt
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
async-interruptProvides an asyncio context manager that…
permissive · top 5,000 on PyPI
cysignalsProvides interrupt and signal handling…
copyleft · top 15,000 on PyPI
stopitProvides context managers and decorators to…
permissive · top 15,000 on PyPI
pytest-timeoutAborts pytest tests that exceed a specified…
permissive · top 1,000 on PyPI
wrapt-timeout-decoratorApplies timeout limits to Python functions and…
permissive · top 5,000 on PyPI
async-timeoutProvides an asyncio-compatible timeout context…
permissive · top 1,000 on PyPI
codetimingMeasures elapsed time in Python code using a…
permissive · top 5,000 on PyPI
jaraco.contextProvides decorators and context managers for…
permissive · top 1,000 on PyPI
wait-for2Provides an alternate implementation of…
permissive · top 15,000 on PyPI
pytest-timeoutsA pytest plugin that enforces separate timeout…
permissive · top 5,000 on PyPI