skillfed

interruptingcow

A watchdog that interrupts long running code.

interruptingcow v0.8 169.3K downloads/30d#10,422 on PyPI
Permissive license MIT Abandoned released

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 interruptingcow

uv

uv add interruptingcow

poetry

poetry add interruptingcow

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: System AdministratorsLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 2.7Programming Language :: Python :: 3.5Topic :: Software Development :: DebuggersTopic :: System :: BenchmarkTopic :: System :: MonitoringTopic :: Utilities

Tags

timeout decorator pythoninterrupt long running codesignal-based timeoutpython code execution timeoutwatchdog timernested timeoutstime quota allocation
signal-basedabandoned

More Utilities packages