timeout-decorator
Timeout decorator
Decision gist · record as of 2026-08-14
Yes, with conditions. The package is simple, permissive, and solves a real problem with minimal overhead. However, it is dormant (last release 2020-11-15) and carries platform and threading constraints: signal-based timeouts are Unix-only and main-thread-only, and multiprocessing timeouts require picklable return values. Install it if you need a lightweight timeout decorator for main-thread code or if you are willing to work around the multiprocessing limitations; avoid it if you need active maintenance or cross-platform signal handling.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Signal-based timeouts (default) only work in the main thread; use use_signals=False for worker threads, but then your function must return picklable objects.
- High install friction: the package is dormant (last release 2020-11-15, no commits since 2024-01-12) and depends on platform-specific signal handling or multiprocessing, which may require system-level setup or compatibility considerations.
License · maintenance · safety
permissive license (permissive) — MIT license (permissive) means you can use, modify, and distribute this package freely with minimal restrictions, though you must include the license notice.
last release 2020-11-15 (2098 days) · last repo commit 2024-01-12 · 638 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 4,404,256 downloads/mo, #2,311 on PyPI
Alternatives
Verify before relying
pip install timeout-decorator
import time
import timeout_decorator
@timeout_decorator.timeout(5)
def mytest():
print("Start")
for i in range(1, 10):
time.sleep(1)
print("{} seconds have passed".format(i))
mytest()- Whether the package works reliably with modern Python versions (python_support is unspecified in metadata)
- Current state of known issues or edge cases beyond the PicklingError fix in 0.3.1
- Whether signal-based timeouts are reliable across different operating systems
What it is and what it does
timeout-decorator is a Python decorator that enforces execution time limits on functions by raising an exception when a function runs longer than a specified duration. It offers two strategies: signal-based timeouts (the default, which works only in the main thread) and multiprocessing-based timeouts (for worker threads and background tasks). The decorator is straightforward to use—you simply annotate a function with @timeout_decorator.timeout(seconds)—and you can customize the exception raised on timeout or switch timeout strategies with a parameter.
The package has been dormant since late 2020, with no active maintenance. It carries no known vulnerabilities and uses a permissive MIT license. The main trade-off is that signal-based timeouts are Unix-specific and thread-constrained, while multiprocessing timeouts require all return values to be picklable, which can be a significant limitation in some applications.
Use it for
- Wrap long-running API calls or database queries to prevent indefinite hangs in web applications.
- Enforce time limits on worker thread tasks in background job systems or thread pools.
- Prevent runaway computations or infinite loops in untrusted or user-provided code.
- Add timeout protection to legacy functions without refactoring their internals.
- Limit execution time in test suites to catch performance regressions or deadlocks.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, with conditions.
The package is simple, permissive, and solves a real problem with minimal overhead. However, it is dormant (last release 2020-11-15) and carries platform and threading constraints: signal-based timeouts are Unix-only and main-thread-only, and multiprocessing timeouts require picklable return values. Install it if you need a lightweight timeout decorator for main-thread code or if you are willing to work around the multiprocessing limitations; avoid it if you need active maintenance or cross-platform signal handling.
Install
timeout-decorator on PyPI
Before you install
High install friction: the package is dormant (last release 2020-11-15, no commits since 2024-01-12) and depends on platform-specific signal handling or multiprocessing, which may require system-level setup or compatibility considerations.
Signal-based timeouts (default) only work in the main thread; use use_signals=False for worker threads, but then your function must return picklable objects.
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
pip install timeout-decorator
import time
import timeout_decorator
@timeout_decorator.timeout(5)
def mytest():
print("Start")
for i in range(1, 10):
time.sleep(1)
print("{} seconds have passed".format(i))
mytest()
Verify before relying
- Whether the package works reliably with modern Python versions (python_support is unspecified in metadata)
- Current state of known issues or edge cases beyond the PicklingError fix in 0.3.1
- Whether signal-based timeouts are reliable across different operating systems
Package facts
| License | permissive license permissive |
| Python support | Not specified |
| Install friction | High. Source build required |
| Runtime dependencies | None |
| Maintenance | Dormant 2,098 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,404,256 / month, #2,311 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonTopic :: Software Development :: Libraries :: Python Modules |
Evidence: timeout-decorator-0.5.0.tar.gz
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “function timeout decorator”
- timeout-decoratorA decorator that enforces time limits on function execution, raising…
- wrapt-timeout-decoratorApplies timeout limits to Python functions and methods via decorator,…
- func-timeoutRuns any Python function with a specified timeout limit, raising an…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also iterators · retry-decorator · stopit · wrapt-timeout-decorator · func-timeout · inputimeout · retry2 · reretry · pytest-timeout · appnope