Metadata-Version: 2.0
Name: timeoutcontext
Version: 1.1.1
Summary: A signal based timeout context manager
Home-page: https://github.com/AntoineCezar/timeoutcontext
Author: Antoine Cezar
Author-email: antoine@cezar.fr
License: BSD
Keywords: timeoutcontext
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3

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

.. image:: https://img.shields.io/travis/AntoineCezar/timeoutcontext.svg
        :target: https://travis-ci.org/AntoineCezar/timeoutcontext

.. image:: https://img.shields.io/badge/docs-latest-brightgreen.svg
        :target: http://timeoutcontext.readthedocs.org/

.. image:: https://img.shields.io/coveralls/AntoineCezar/timeoutcontext.svg
        :target: https://coveralls.io/github/AntoineCezar/timeoutcontext

.. image:: https://img.shields.io/pypi/v/timeoutcontext.svg
        :target: https://pypi.python.org/pypi/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
    from timeoutcontext import timeout
    if sys.version_info < (3, 3):
        from timeoutcontext._timeout import TimeoutError

    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
    if sys.version_info < (3, 3):
        from timeoutcontext._timeout import TimeoutError

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

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

License
-------

* Free software: BSD license




History
-------

1.1.1 (2016-09-05)
------------------

* Fix README code exemples

1.1.0 (2016-09-05)
------------------

*  Add the "Not working on Windows operating system" notice
*  Rename TimeoutException to TimeoutError

1.0.0 (2016-01-23)
------------------

* First release on PyPI.


