{ "info": { "author": "Patrick Ng", "author_email": "pn.appdev@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Timeout decorator\n=================\n\n|Build Status| |Pypi Status| |Coveralls Status|\n\nInstallation\n------------\n\nFrom source code:\n\n::\n\n python setup.py install\n\nFrom pypi:\n\n::\n\n pip install timeout-decorator\n\nUsage\n-----\n\n::\n\n import time\n import timeout_decorator\n\n @timeout_decorator.timeout(5)\n def mytest():\n print(\"Start\")\n for i in range(1,10):\n time.sleep(1)\n print(\"{} seconds have passed\".format(i))\n\n if __name__ == '__main__':\n mytest()\n\nSpecify an alternate exception to raise on timeout:\n\n::\n\n import time\n import timeout_decorator\n\n @timeout_decorator.timeout(5, timeout_exception=StopIteration)\n def mytest():\n print(\"Start\")\n for i in range(1,10):\n time.sleep(1)\n print(\"{} seconds have passed\".format(i))\n\n if __name__ == '__main__':\n mytest()\n\nMultithreading\n--------------\n\nBy default, timeout-decorator uses signals to limit the execution time\nof the given function. This appoach does not work if your function is\nexecuted not in a main thread (for example if it's a worker thread of\nthe web application). There is alternative timeout strategy for this\ncase - by using multiprocessing. To use it, just pass\n``use_signals=False`` to the timeout decorator function:\n\n::\n\n import time\n import timeout_decorator\n\n @timeout_decorator.timeout(5, use_signals=False)\n def mytest():\n print \"Start\"\n for i in range(1,10):\n time.sleep(1)\n print(\"{} seconds have passed\".format(i))\n\n if __name__ == '__main__':\n mytest()\n\n.. warning::\n Make sure that in case of multiprocessing strategy for timeout, your function does not return objects which cannot\n be pickled, otherwise it will fail at marshalling it between master and child processes.\n\n\nAcknowledgement\n---------------\n\nDerived from\nhttp://www.saltycrane.com/blog/2010/04/using-python-timeout-decorator-uploading-s3/\nand https://code.google.com/p/verse-quiz/source/browse/trunk/timeout.py\n\nContribute\n----------\n\nI would love for you to fork and send me pull request for this project.\nPlease contribute.\n\nLicense\n-------\n\nThis software is licensed under the `MIT license `_\n\nSee `License file `_\n\n.. |Build Status| image:: https://travis-ci.org/pnpnpn/timeout-decorator.svg?branch=master\n :target: https://travis-ci.org/pnpnpn/timeout-decorator\n.. |Pypi Status| image:: https://badge.fury.io/py/timeout-decorator.svg\n :target: https://badge.fury.io/py/timeout-decorator\n.. |Coveralls Status| image:: https://coveralls.io/repos/pnpnpn/timeout-decorator/badge.png?branch=master\n :target: https://coveralls.io/r/pnpnpn/timeout-decorator\n\nChangelog\n=========\n\n0.3.1\n-----\n- Fixed issue with PicklingError causes the timeout to never be reached.\n\n0.3.0\n-----\n\n- Added optional threading support via python multiprocessing (bubenkoff)\n- Switched to pytest test runner (bubenkoff)\n\n\n0.2.1\n-----\n\n- Initial public release", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/pnpnpn/timeout-decorator", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "timeout-decorator", "package_url": "https://pypi.org/project/timeout-decorator/", "platform": "", "project_url": "https://pypi.org/project/timeout-decorator/", "project_urls": { "Homepage": "https://github.com/pnpnpn/timeout-decorator" }, "release_url": "https://pypi.org/project/timeout-decorator/0.4.1/", "requires_dist": null, "requires_python": "", "summary": "Timeout decorator", "version": "0.4.1" }, "last_serial": 4564981, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "a799b5f007e683e8644f9ac40116433f", "sha256": "2805d8a786947161e4b53c2f7d5d55a21c95e5e6f93416017800b4b482ce0ea6" }, "downloads": -1, "filename": "timeout-decorator-0.1.0.tar.gz", "has_sig": false, "md5_digest": "a799b5f007e683e8644f9ac40116433f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2531, "upload_time": "2013-01-04T17:28:07", "url": "https://files.pythonhosted.org/packages/fb/3f/b2900f34d84b65cb21e141f93c2cfc62226131c2a871beb0c05d418ed28a/timeout-decorator-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "692cdd7d09c6b30605fcb86f670e1f14", "sha256": "5db5419b6a959f693c5179755784fa5fedbea50bb11a7cc26e6cb180281dcf81" }, "downloads": -1, "filename": "timeout-decorator-0.2.0.tar.gz", "has_sig": false, "md5_digest": "692cdd7d09c6b30605fcb86f670e1f14", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2947, "upload_time": "2015-01-04T22:23:15", "url": "https://files.pythonhosted.org/packages/6b/ee/6349efae55cc6f233b393b0581b7cc63f15c12d6392cebd4865d72094e38/timeout-decorator-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "f765552c50653ebcd34b00935d387b2c", "sha256": "2e7465e812d8c614fd613b106ac299eaa2485f33154af1bad7514929a57cb757" }, "downloads": -1, "filename": "timeout-decorator-0.2.1.tar.gz", "has_sig": false, "md5_digest": "f765552c50653ebcd34b00935d387b2c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3123, "upload_time": "2015-01-05T23:01:42", "url": "https://files.pythonhosted.org/packages/b9/ca/7eeda72c6bd9aad9d83d72d42b7c9f4737ddd02e4b143e2b4bc7c6603ebe/timeout-decorator-0.2.1.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "92a2e5ed0b1f651f28d10523d1d5809a", "sha256": "934a7ad55baa774ca5c49dd5980c952e73850ce0d4748f9b43995ea44f388b81" }, "downloads": -1, "filename": "timeout-decorator-0.3.0.tar.gz", "has_sig": false, "md5_digest": "92a2e5ed0b1f651f28d10523d1d5809a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4338, "upload_time": "2015-03-18T00:35:23", "url": "https://files.pythonhosted.org/packages/e9/ac/6c797d08f16d682e73b0d60ed23bd059fc5ac73210599a37d8eb0b1be29e/timeout-decorator-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "38f6049f02e8475796958ecd5e397a95", "sha256": "9b770a837c6e82dc3505975b7ba6c96680e63ff548eb2f0057a4cfa869180b9c" }, "downloads": -1, "filename": "timeout-decorator-0.3.1.tar.gz", "has_sig": false, "md5_digest": "38f6049f02e8475796958ecd5e397a95", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4420, "upload_time": "2015-03-24T18:53:26", "url": "https://files.pythonhosted.org/packages/98/63/c15065947edf09a61e30c8dc18cadb3c45a327c1de1134106be2519eed4b/timeout-decorator-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "6f20bcc0c91e60bda4f1bd9fb4845fb8", "sha256": "4ee19ecbff3948ef1d2321fc08a0af7ab5a81825b116589a70519cd9f84234f5" }, "downloads": -1, "filename": "timeout-decorator-0.3.2.tar.gz", "has_sig": false, "md5_digest": "6f20bcc0c91e60bda4f1bd9fb4845fb8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4481, "upload_time": "2015-03-31T17:17:24", "url": "https://files.pythonhosted.org/packages/5c/df/dd12f1f1669571e5f0c63b577a46f4d28f7893c386a486ca2a14470746dc/timeout-decorator-0.3.2.tar.gz" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "e62ec46f8e35e75e5eb7b9efdeed8130", "sha256": "f46fa1b7ab0dc1183c0a93679aafa1e71a139d79e297a40aced32443825e62b1" }, "downloads": -1, "filename": "timeout-decorator-0.3.3.tar.gz", "has_sig": false, "md5_digest": "e62ec46f8e35e75e5eb7b9efdeed8130", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4590, "upload_time": "2017-02-08T08:33:14", "url": "https://files.pythonhosted.org/packages/eb/ca/93fe59a419f98e1ee9655f761c7b264708c59c9d1ac3a4853b227ef44288/timeout-decorator-0.3.3.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "6ef20407e517a80055844e68dfe34af6", "sha256": "e49d214b17a096ca5162865ccb79f516840e5ba21b394f531f1f1d50e2e293ad" }, "downloads": -1, "filename": "timeout-decorator-0.4.0.tar.gz", "has_sig": false, "md5_digest": "6ef20407e517a80055844e68dfe34af6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4734, "upload_time": "2017-08-14T17:06:30", "url": "https://files.pythonhosted.org/packages/a2/bc/bc7395efa9212c5507c489cd348ad50ac437dbfc94fa5d88f87e58f9fa3c/timeout-decorator-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "04cf660cf86815dd6f564b68aea6630d", "sha256": "1a5e276e75c1c5acbf3cdbd9b5e45d77e1f8626f93e39bd5115d68119171d3c6" }, "downloads": -1, "filename": "timeout-decorator-0.4.1.tar.gz", "has_sig": false, "md5_digest": "04cf660cf86815dd6f564b68aea6630d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4771, "upload_time": "2018-12-05T18:36:51", "url": "https://files.pythonhosted.org/packages/07/1c/0d9adcb848f1690f3253dcb1c1557b6cf229a93e724977cb83f266cbd0ae/timeout-decorator-0.4.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "04cf660cf86815dd6f564b68aea6630d", "sha256": "1a5e276e75c1c5acbf3cdbd9b5e45d77e1f8626f93e39bd5115d68119171d3c6" }, "downloads": -1, "filename": "timeout-decorator-0.4.1.tar.gz", "has_sig": false, "md5_digest": "04cf660cf86815dd6f564b68aea6630d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4771, "upload_time": "2018-12-05T18:36:51", "url": "https://files.pythonhosted.org/packages/07/1c/0d9adcb848f1690f3253dcb1c1557b6cf229a93e724977cb83f266cbd0ae/timeout-decorator-0.4.1.tar.gz" } ] }