Skip to main content

A signal based timeout context manager and decorator.

Since it is signal based this package can not work under Windows operating system.

Usage

As a context manager:

import sys
from time import sleep
rom timeoutcontext import timeout

try:
    with timeout(1):
        sleep(2)
except TimeoutError:
    print('timeout')

As a decorator:

import sys
from time import sleep
from timeoutcontext import timeout

@timeout(1)
def wait():
    sleep(2)

try:
    wait()
except TimeoutError:
    print('timeout')

License

  • Free software: BSD license

Metadata

Release files for timeoutcontext 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for timeoutcontext 2.0.0
File Size Uploaded
timeoutcontext-2.0.0.tar.gz 1.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for timeoutcontext 2.0.0
File Interpreter ABI Platform
timeoutcontext-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 4.7 kB

Release files / timeoutcontext-2.0.0.tar.gz

Download URL timeoutcontext-2.0.0.tar.gz
Size 1.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2fc76808bba0b1d51cb7ced0e6c961952b3f2fd343c9d73e2b3e8adbd382fbfc
BLAKE2b-256 checksum
How to use checksums
524ff5cce31dde27074684cb5b9c2dff1c15c1d75569fbac6077439f5cb419b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.7

Release files / timeoutcontext-2.0.0-py3-none-any.whl

Download URL timeoutcontext-2.0.0-py3-none-any.whl
Size 2.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d4d2b5be28560f9852df436e6ae111a2b726831eee28bb01d16e5a5256f2224
BLAKE2b-256 checksum
How to use checksums
08bc27dcde76e5f54bf0a71c16ebc7819e78fec45d8f19155e40f6ee891e3fb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.7

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.2.0

1 release file

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page