{ "info": { "author": "Hank Gay", "author_email": "hank.gay@gmail.com/", "bugtrack_url": null, "classifiers": [], "description": "===========\n PTO\n===========\n\n*Easy timeouts for Python*\n\n.. image:: https://travis-ci.org/gthank/pto.png?branch=master\n :alt: Status Image\n\nPTO is an MIT-licensed library to make it easy to impose time limits on\nthe runtime of a function that doesn't expose that functionality itself.\nI was inspired by a need to prevent a scheduled job from running too\nlong on a platform where I was paying by the hour. Maybe you just need\nto wrap a flaky network call. Either way, it's as simple as::\n\n >>> from pto import timeout\n >>> @timeout(5)\n ... def slow_func():\n ... while True:\n ... pass\n ...\n >>> slow_func()\n Traceback (most recent call last):\n File \"\", line 1, in \n File \"\", line 2, in slow_func\n File \"pto/__init__.py\", line 97, in _timeout\n result = f(*args, **kwargs)\n File \"\", line 3, in slow_func\n File \"pto/__init__.py\", line 89, in handle_timeout\n raise TimedOutException\n pto.TimedOutException: u'Timed Out'\n\nInspiration\n===========\n\nI was inspired to do this by `Chris Wright's recipe`_. I liked the\nrecipe, but I got tired of copying and pasting it, and I didn't like\nthat the decorator didn't preserve the signature, docstring, etc.\n\n.. _Chris Wright's recipe: http://code.activestate.com/recipes/307871-timing-out-function/\n\nCaveats\n=======\n\nThis only works on Unix-like platforms. Sorry, Windows users. I'd love\nto support Windows, but the secret sauce (``signal.alarm`` from the std\nlib) doesn't work on Windows.\n\nThis isn't really designed to play well with threads, because only the\nmain thread will receive signals in Python. Anyway, if you're using\nthreads, you probably have other ways to handle timeouts.\n\nIf you want to put timeouts on static methods or class methods, you need\nto put the timeout on the method first, and then decorate the wrapped\nmethod with ``@staticmethod`` or ``@classmethod``. There are examples in\n``test_pto.py``.\n\nI am pretty sure that the lib works in Python 2.4, but I don't have an\ninstall around to test that. If anybody wants to volunteer to verify the\nlib on 2.4, please contact me.\n\nInstallation\n============\n\nTo install PTO, simply::\n\n $ pip install pto\n\nOr, if you absolutely must::\n\n $ easy_install pto\n\nBut, you really shouldn't do that.\n\nHistory\n=======\n\n0.0.7 (2013-03-14)\n------------------\n* Enhanced ignores\n* Enable setup.py test\n* Customize dependencies for Python 3 vs. Python 2\n* Add Travis-CI status image to README.rst\n\n0.0.6 (2013-03-13)\n------------------\n\n* Add unit-testing\n* Enable Travis-CI\n* Add some more caveats/gotchas to README.rst\n* Update sample usage\n* Update trove classifiers\n\n0.0.5 (2013-03-13)\n------------------\n\n* Include proper path for license in MANIFEST.in\n\n0.0.4 (2013-03-13)\n------------------\n\n* Embed license on PyPI page.\n\n0.0.3 (2013-03-13)\n------------------\n\n* First version that pip can actually install.\n\n0.0.2 (2013-03-12)\n------------------\n\n* First draft\n\n0.0.1 (2013-03-11)\n------------------\n\n* Conception", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": null, "license": "Copyright (c) 2013 Hank Gay\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", "maintainer": null, "maintainer_email": null, "name": "pto", "package_url": "https://pypi.org/project/pto/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pto/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/pto/0.0.7/", "requires_dist": null, "requires_python": null, "summary": "Timeouts for arbitrary Python functions.", "version": "0.0.7" }, "last_serial": 796780, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "e4149500129bc3b41cfa37801dac2d84", "sha256": "e3b47f7f74f77d7ffa5b2320bc3a7592b2bb2fd64d391f66796e6c453b7e9eb5" }, "downloads": -1, "filename": "pto-0.0.1.tar.gz", "has_sig": false, "md5_digest": "e4149500129bc3b41cfa37801dac2d84", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3731, "upload_time": "2013-03-13T03:04:29", "url": "https://files.pythonhosted.org/packages/c5/17/e2d29c286b0b4c8e85bbd4a19e59e434cd83c09400f25081d02f06589b6f/pto-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "c346d4df1b77c50c2cbc01a18b215ea6", "sha256": "e4238ceab984295f971b63747fb78a5d22354491d9ac603d9c0b080fd01bb038" }, "downloads": -1, "filename": "pto-0.0.2.tar.gz", "has_sig": false, "md5_digest": "c346d4df1b77c50c2cbc01a18b215ea6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3139, "upload_time": "2013-03-13T03:11:27", "url": "https://files.pythonhosted.org/packages/db/47/38b8aaca1092b9ec53972835f11160c44dee657aa8b572beadce0e86d1fb/pto-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "773c255b73eaca890873c0cb65476260", "sha256": "df25718ef169b2b4e8704181dd2b4b8e8a21170f148efdb1c4c6133d23dd77fe" }, "downloads": -1, "filename": "pto-0.0.3.tar.gz", "has_sig": false, "md5_digest": "773c255b73eaca890873c0cb65476260", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3142, "upload_time": "2013-03-13T12:12:41", "url": "https://files.pythonhosted.org/packages/c9/a6/738b6cd4ad8603e258f13bf42d3feeecb2dc2e2df8de0f33333e6a6aa81a/pto-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "5509d73f526d0303ee39d6edb1c6884b", "sha256": "6d21c22155af0392bc4c2a6a4eb2e1a5661d35c567d3d58c0818f7b7be83dc5d" }, "downloads": -1, "filename": "pto-0.0.4.tar.gz", "has_sig": false, "md5_digest": "5509d73f526d0303ee39d6edb1c6884b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3826, "upload_time": "2013-03-13T12:21:36", "url": "https://files.pythonhosted.org/packages/f9/9e/d6ca9bd11095697d1a5842e8877c539e1b7ff9508dcaba6ac7e507d90c2e/pto-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "194689f44d51f9c7f5a59a1c528af15d", "sha256": "46493e5b60a735036bae5929bf2a950aff3c743169a672dcfe249ce51fc782b1" }, "downloads": -1, "filename": "pto-0.0.5.tar.gz", "has_sig": false, "md5_digest": "194689f44d51f9c7f5a59a1c528af15d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3955, "upload_time": "2013-03-13T12:37:12", "url": "https://files.pythonhosted.org/packages/bd/1a/fdb5b9b264dc525156f31a56417e2f834264397f72e29ea1ef12bc87f84a/pto-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "06618f37805fc15050144ef9a8dc906a", "sha256": "3af5cb48329e03487012015d716b97426504ddea1f77dddf16fbe348af45e73a" }, "downloads": -1, "filename": "pto-0.0.6.tar.gz", "has_sig": false, "md5_digest": "06618f37805fc15050144ef9a8dc906a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4403, "upload_time": "2013-03-14T03:27:20", "url": "https://files.pythonhosted.org/packages/8c/85/8dd79f11405325c66313290756e54fb8a061e640ebe74a8802e39ba2ff01/pto-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "72632f9bf9aadbfe80b26cbd139ba584", "sha256": "519ca8841ba3bb4888316207fd82ef89cd581b81d175415f821439c623ac4c5d" }, "downloads": -1, "filename": "pto-0.0.7.tar.gz", "has_sig": false, "md5_digest": "72632f9bf9aadbfe80b26cbd139ba584", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4600, "upload_time": "2013-03-15T03:13:13", "url": "https://files.pythonhosted.org/packages/69/a4/9a40da1c545e037c3a15d5537684b2a25c073d06b5298a017c677e9cb568/pto-0.0.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "72632f9bf9aadbfe80b26cbd139ba584", "sha256": "519ca8841ba3bb4888316207fd82ef89cd581b81d175415f821439c623ac4c5d" }, "downloads": -1, "filename": "pto-0.0.7.tar.gz", "has_sig": false, "md5_digest": "72632f9bf9aadbfe80b26cbd139ba584", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4600, "upload_time": "2013-03-15T03:13:13", "url": "https://files.pythonhosted.org/packages/69/a4/9a40da1c545e037c3a15d5537684b2a25c073d06b5298a017c677e9cb568/pto-0.0.7.tar.gz" } ] }