Metadata-Version: 2.4
Name: timeoutcontext
Version: 2.0.0
Summary: A signal based timeout context manager
Author: Antoine Cezar
Author-email: Antoine Cezar <AntoineCezar@users.noreply.github.com>
License-Expression: BSD-2-Clause
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.10
Requires-Python: >=3.10
Project-URL: Changelog, https://github.com/me/spam/blob/master/CHANGELOG.md
Project-URL: Documentation, http://timeoutcontext.readthedocs.org/
Project-URL: Homepage, https://github.com/AntoineCezar/timeoutcontext
Project-URL: Issues, https://github.com/AntoineCezar/timeoutcontext/issues
Project-URL: Repository, http://timeoutcontext.readthedocs.org/
Description-Content-Type: text/x-rst

==============
Timeoutcontext
==============

A `signal <https://docs.python.org/library/signal.html#>`_ 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:

.. code:: python

    import sys
    from time import sleep
    rom timeoutcontext import timeout

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

As a decorator:

.. code:: python

    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
