--- id: stopit version: "1.1.2" license: GPLv3 license_treatment: permissive maintenance: abandoned --- # stopit — Timeout control decorator and context managers, raise any exception in another thread License: permissive · Maintenance: abandoned · Downloads: 233.1K/mo ## What it is and what it does stopit provides two main mechanisms for controlling execution time in Python: context managers and decorators that enforce timeouts on code blocks and function calls. The core capability is raising asynchronous exceptions in other threads, including the main thread, to interrupt long-running operations. It offers ThreadingTimeout (a context manager) and threading_timeoutable (a decorator) for timeout control, plus async_raise for direct thread interruption. The package also provides a TimeoutException that signals when a timeout has occurred. The package is tightly coupled to CPython's threading implementation and uses low-level APIs that are not available on alternative Python implementations. It has important limitations: it cannot interrupt blocking Python atomic instructions that hold the GIL (such as time.sleep), and signal-based timeout controls do not work on Windows. The package is no longer maintained, with its last release in 2018-02-09. Use it for: - Enforce maximum execution time on web request handlers or API calls that might hang indefinitely. - Interrupt long-running computations or data processing tasks if they exceed a time budget. - Implement watchdog timers for background worker threads that may become stuck. - Decorate functions to return a default value if they do not complete within a specified timeout. - Control timeout behavior in test suites to fail tests that run longer than expected. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides context managers and decorators to enforce timeouts on code blocks and function calls, and raise exceptions asynchronously in other threads. No. The package is abandoned (last release 2018-02-09) with no maintenance signal. It relies on CPython-specific internals, does not work on alternative implementations, and has known limitations with GIL-blocking operations and Windows compatibility. For modern Python projects, consider maintained alternatives or the standard library's asyncio timeout mechanisms. ## Install pip install stopit uv add stopit poetry add stopit ## Installing stopit Before you install: High install friction: the package is abandoned (last release 2018-02-09, 3108 days ago) and has no runtime dependencies. Threading-based timeout control relies on CPython-specific low-level APIs and will not work on alternative Python implementations (Jython, PyPy, IronPython). Signal-based timeouts do not work on Windows. License in practice: Licensed under GPLv3 (permissive treatment noted), which permits use but requires derivative works to be distributed under the same license if distributed at all. Quickstart: import stopit with stopit.ThreadingTimeout(10) as to_ctx_mgr: # code that may take too long pass if to_ctx_mgr.state == to_ctx_mgr.EXECUTED: print('Completed within timeout') Requires CPython; will not work on Jython, PyPy, or IronPython. Signal-based timeout control unavailable on Windows. Verify before relying: - Whether the package works reliably on Python versions beyond 3.6 despite classifiers listing only up to 3.6. - Current status of any known issues with GIL-blocking operations beyond the documented time.sleep() limitation. - Whether the abandoned status poses compatibility or security risks for new projects. ## Package facts - License: GPLv3 (permissive) - Python support: unspecified - Install friction: high - Maintenance: abandoned - Downloads: 233.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags timeout context manager, thread timeout control, async exception in thread, function timeout decorator, stop long-running code, threading timeout, interrupt thread execution, threading, timeout-control, abandoned [View on SkillFed](https://skillfed.io/packages/stopit) · [View on PyPI](https://pypi.org/project/stopit/)