{"categories":[{"label":"Python Modules","url":"https://skillfed.io/packages/category/software-development-libraries-python-modules/4"}],"enrichment":{"capability":"Runs any Python function with a specified timeout limit, raising an exception if execution exceeds the time window; also provides a stoppable thread class for controlled thread termination.","skillfed_tags":["thread-control","execution-limits"],"use_cases":["Wrap external API calls or network requests to prevent indefinite blocking when servers hang or are unresponsive.","Enforce maximum execution time on user-submitted or untrusted code in a sandbox or job queue.","Decorate long-running data processing functions to fail fast if they exceed expected runtime.","Implement graceful shutdown of worker threads in an event loop or thread pool by stopping them with a custom exception.","Protect against infinite loops or deadlocks in third-party library code by terminating after a timeout."],"what_it_does":"func_timeout wraps function calls in a timeout mechanism by running them in a separate thread and raising FunctionTimedOut if execution exceeds a specified duration. It returns the function's result or re-raises any exception it would normally throw. The package also includes a decorator form (@func_set_timeout) for cleaner syntax and a StoppableThread class that extends threading.Thread to support forceful termination via exception injection into the thread context.\n\nThe core use case is protecting against indefinite hangs in code you call but cannot control\u2014network requests, file I/O, or third-party library calls that may block. Timeouts can be fixed values or computed dynamically based on function arguments. The FunctionTimedOut exception includes a retry() method to re-attempt the call with different timeout settings.","worth_installing":"Yes, with conditions. Install if you need timeout protection for function calls and can accept dormant maintenance (last release 2019). The package is stable, has no known vulnerabilities, and solves a real problem with minimal dependencies. Avoid if you require active support or need guaranteed compatibility with Python versions beyond 3.7, or if you prefer a maintained alternative. High install friction (source-only) is a minor friction point."},"id":"func-timeout","links":{"html":"https://skillfed.io/packages/func-timeout","md":"https://skillfed.io/packages/func-timeout.md","pypi":"https://pypi.org/project/func-timeout/"},"maintenance":{"status":"dormant"},"meta":{"latest_release":"2019-08-19","license_spdx":null,"license_treatment":"copyleft","name":"func-timeout","python_support":"unspecified","summary":"Python module which allows you to specify timeouts when calling any existing function. Also provides support for stoppable-threads"},"popularity":{"monthly_downloads":7584368,"position":1719,"tier":"top_5000"},"security":{"n_vulnerabilities":0},"version":"4.3.5"}
