{ "info": { "author": "Andrea Stagi", "author_email": "stagi.andrea@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4" ], "description": "Lauda\r\n=====\r\n\r\n|Build Status| |Codecov.io Status| |Latest Version| |Supported Python\r\nversions| |License| |Downloads|\r\n\r\nA very simple python module for measuring time.\r\n\r\nInstall\r\n-------\r\n\r\n::\r\n\r\n pip install lauda\r\n\r\nUsage\r\n-----\r\n\r\nYou can use lauda ``StopWatch`` to measure the time spent in a portion\r\nof code\r\n\r\n.. code:: python\r\n\r\n from lauda import StopWatch\r\n\r\n watch = StopWatch()\r\n watch.start()\r\n for i in range(10000000):\r\n pass\r\n watch.stop()\r\n print ('Time spent in range {0}'.format(watch.elapsed_time))\r\n\r\nYou can also get the ``elapsed_time`` when the stopwatch is running\r\n\r\nYou can call checkpoint function if you want to set a checkpoint and get\r\nthe time spent between the last checkpoint:\r\n\r\n.. code:: python\r\n\r\n from lauda import StopWatch\r\n\r\n watch = StopWatch()\r\n watch.start()\r\n for i in range(10000000):\r\n pass\r\n check_time = watch.checkpoint()\r\n print ('Time spent in first range: {0} sec.'.format(check_time))\r\n for i in range(10000000):\r\n pass\r\n check_time = watch.checkpoint()\r\n print ('Time spent in second range: {0} sec.'.format(check_time))\r\n\r\nIf you want to measure an entire function execution, you can decorate it\r\nusing the ``stopwatch`` decorator\r\n\r\n.. code:: python\r\n\r\n from lauda import stopwatch\r\n\r\n @stopwatch\r\n def awesome_mul(a, b):\r\n return a * b\r\n\r\nBy default ``stopwatch`` decorator will print the time spent inside the\r\ndecorated function, if you want more control you can pass to your\r\ndecorator a callback that will receive a ``StopWatch`` instance and the\r\ndecorated function.\r\n\r\n.. code:: python\r\n\r\n from lauda import stopwatch\r\n\r\n def stopwatch_sum_cb(watch, function):\r\n print ('Time spent {0}'.format(watch.elapsed_time))\r\n\r\n @stopwatch(callback=stopwatch_sum_cb)\r\n def awesome_sum(a, b):\r\n return a + b\r\n\r\nIf you want to measure a block of code, you can use the ``stopwatchcm``\r\ncontext manager\r\n\r\n.. code:: python\r\n\r\n from lauda import stopwatchcm\r\n\r\n with stopwatchcm():\r\n c = a * b\r\n\r\nBy default ``stopwatchcm`` context manager will print the time spent\r\ninside the context manager body, if you want more control you can pass\r\nto your context manager a callback that will receive a ``StopWatch``\r\ninstance.\r\n\r\n.. code:: python\r\n\r\n from lauda import stopwatchcm\r\n\r\n def stopwatch_sum_cb(watch):\r\n print ('Time spent {0}'.format(watch.elapsed_time))\r\n\r\n with stopwatchcm(callback=stopwatch_sum_cb):\r\n c = a + b\r\n\r\n.. |Build Status| image:: http://img.shields.io/travis/astagi/lauda.svg?branch=master\r\n :target: https://travis-ci.org/astagi/lauda\r\n.. |Codecov.io Status| image:: https://img.shields.io/codecov/c/github/astagi/lauda.svg\r\n :target: http://codecov.io/github/astagi/lauda?branch=master\r\n.. |Latest Version| image:: https://img.shields.io/pypi/v/lauda.svg\r\n :target: https://pypi.python.org/pypi/lauda/\r\n.. |Supported Python versions| image:: https://img.shields.io/badge/python-2.6%2C%202.7%2C%203.3%2C%203.4-blue.svg\r\n :target: https://pypi.python.org/pypi/lauda/\r\n.. |License| image:: https://img.shields.io/github/license/astagi/lauda.svg\r\n :target: https://pypi.python.org/pypi/lauda/\r\n.. |Downloads| image:: https://img.shields.io/pypi/dm/lauda.svg\r\n :target: https://pypi.python.org/pypi/lauda/", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": "time measurement", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "lauda", "package_url": "https://pypi.org/project/lauda/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/lauda/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/lauda/1.2.0/", "requires_dist": null, "requires_python": null, "summary": "A very simple python module for measuring time.", "version": "1.2.0" }, "last_serial": 1800249, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "3bd49ae0f786952789368803d0d20a55", "sha256": "6acace94b046891b96a0c14bfcd5e87b85aab22cc0b4fae605721140dc18f2de" }, "downloads": -1, "filename": "lauda-1.0.0.tar.gz", "has_sig": false, "md5_digest": "3bd49ae0f786952789368803d0d20a55", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1767, "upload_time": "2015-06-16T18:57:32", "url": "https://files.pythonhosted.org/packages/2b/09/5e3a5116e64ed4b6bd38ef25d9bbdab0b202aedb9646cb5d1e7dfb3ffde8/lauda-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "98c14c14881118ec1d58dae631e53550", "sha256": "a34c21646ebcbdd4b7f88abecba7968b963b35fbf301fc343b3499b08c56e64b" }, "downloads": -1, "filename": "lauda-1.1.0.tar.gz", "has_sig": false, "md5_digest": "98c14c14881118ec1d58dae631e53550", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1877, "upload_time": "2015-09-16T09:47:15", "url": "https://files.pythonhosted.org/packages/37/c4/bcf9dd484dbcea5361fee13f59478231b5d2f7ea795770281cbd333dcec4/lauda-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "ca2d6a42d0c8cc03b9f2ab0c06299bac", "sha256": "cdaf83ecaa1ef4680ebac630f203087b8badc238370c135a19374457c0f9b74d" }, "downloads": -1, "filename": "lauda-1.2.0.tar.gz", "has_sig": false, "md5_digest": "ca2d6a42d0c8cc03b9f2ab0c06299bac", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1962, "upload_time": "2015-11-04T08:42:23", "url": "https://files.pythonhosted.org/packages/11/d6/b33a3a015ab640aa3a0ea46cebf0fb1028e3413b195aac92286f994069f4/lauda-1.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ca2d6a42d0c8cc03b9f2ab0c06299bac", "sha256": "cdaf83ecaa1ef4680ebac630f203087b8badc238370c135a19374457c0f9b74d" }, "downloads": -1, "filename": "lauda-1.2.0.tar.gz", "has_sig": false, "md5_digest": "ca2d6a42d0c8cc03b9f2ab0c06299bac", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1962, "upload_time": "2015-11-04T08:42:23", "url": "https://files.pythonhosted.org/packages/11/d6/b33a3a015ab640aa3a0ea46cebf0fb1028e3413b195aac92286f994069f4/lauda-1.2.0.tar.gz" } ] }