Metadata-Version: 1.0
Name: pto
Version: 0.0.4
Summary: Timeouts for arbitrary Python functions.
Home-page: UNKNOWN
Author: Hank Gay
Author-email: hank.gay@gmail.com/
License: Copyright (c) 2013 Hank Gay

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Description: ===========
            PTO
        ===========
        
        *Easy timeouts for Python*
        
        PTO is an MIT-licensed library to make it easy to impose time limits on
        the runtime of a function that doesn't expose that functionality itself.
        I was inspired by a need to prevent a scheduled job from running too
        long on a platform where I was paying by the hour. Maybe you just need
        to wrap a flaky network call. Either way, it's as simple as::
        
            >>> from pto import timeout
            >>> @timeout(30)
            >>> def slow_func():
            ...     while True:
            ...         pass
            ...
            >>> slow_func()
            Traceback (most recent call last):
              File "<stdin>", line 1, in <module>
              File "<string>", line 2, in foo
              File "pto.py", line 65, in _timeout
                result = f(*args, **kwargs)
              File "<stdin>", line 3, in slow_func
              File "pto.py", line 57, in handle_timeout
                raise TimedOutException
            pto.TimedOutException: u'Timed Out'
        
        Inspiration
        ===========
        
        I was inspired to do this by `Chris Wright's recipe`_. I liked the
        recipe, but I got tired of copying and pasting it, and I didn't like
        that the decorator didn't preserve the signature, docstring, etc.
        
        .. _Chris Wright's recipe: http://code.activestate.com/recipes/307871-timing-out-function/
        
        Caveats
        =======
        
        This only works on Unix-like platforms. Sorry, Windows users. I'd love
        to support Windows, but the secret sauce (``signal.alarm`` from the std
        lib) doesn't work on Windows.
        
        Installation
        ============
        
        To install PTO, simply::
        
            $ pip install pto
        
        Or, if you absolutely must::
        
            $ easy_install pto
        
        But, you really shouldn't do that.
        
        History
        =======
        
        0.0.4 (2013-03-13)
        ------------------
        
        * Embed license on PyPI page.
        
        0.0.3 (2013-03-13)
        ------------------
        
        * First version that pip can actually install.
        
        0.0.2 (2013-03-12)
        ------------------
        
        * First draft
        
        0.0.1 (2013-03-11)
        ------------------
        
        * Conception
        
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: POSIX :: BSD
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.4
Classifier: Programming Language :: Python :: 2.5
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Topic :: Software Development :: Libraries
