Registry / http-networking / timeoutcontext

timeoutcontext

JSON →
library2.0.0pypypi✓ verified 34d ago

A signal-based timeout context manager for Python. Current version 2.0.0. Uses OS signals to interrupt long-running operations. Updated to require Python >=3.10. Release cadence is low (major versions separated by years).

http-networkingworkflow
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

from timeoutcontext import timeout

Basic usage: wrap long-running operations in a `with timeout(seconds)` block. Raises TimeoutError if time exceeded.

from timeoutcontext import timeout import time try: with timeout(2): time.sleep(5) print('Completed') except TimeoutError: print('Operation timed out')
Debug
Known footguns
breakingVersion 2.0.0 dropped support for Python <3.10. The exception changed from `Timeout` (custom) to the built-in `TimeoutError`.
gotchaThe context manager uses SIGALRM on Unix. On Windows, signal-based timeouts are not supported; it will gracefully fall back to no timeout. Do not rely on timeout behavior on Windows.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources