{ "info": { "author": "Ramon Saraiva", "author_email": "ramonsaraiva@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# timy\n\n![Python 3.3](https://img.shields.io/badge/python-3.3-blue.svg)\n![Python 3.4](https://img.shields.io/badge/python-3.4-blue.svg)\n![Python 3.5](https://img.shields.io/badge/python-3.5-blue.svg)\n![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)\n\n![CircleCI](https://img.shields.io/circleci/project/github/ramonsaraiva/timy/master.svg)\n![Codecov](https://img.shields.io/codecov/c/github/ramonsaraiva/timy/master.svg)\n\nMinimalist measurement of python code time\n> **timy** comes with a different idea of the built-in module [timeit](https://docs.python.org/2.7/library/timeit.html). It adds flexibility and different ways of measuring code time, using simple context managers and function decorators.\n\n## Installing\n```\npip install timy\n```\n\n## Usage\n\n### Decorating a function\nLet's say you have a `calculate` function and you want to keep track of its execution time\n```python\nimport timy\n\n@timy.timer()\ndef calculate(n, r):\n \"\"\"\n Divide, multiply and sum 'n' to every number in range 'r'\n returning the result list\n \"\"\"\n return [i / n * n + n for i in range(r)]\n```\n\nWhenever you call that function, the execution time will be tracked\n\n```python\ncalculate(5, 10000000)\n>> Timy executed (calculate) for 1 time(s) in 1.529540 seconds\n>> Timy best time was 1.529540 seconds\n```\n\nChanging the **ident** and adding **loops** to the execution\n\n```python\nimport timy\n\n@timy.timer(ident='My calculation', loops=10)\ndef calculate(n, r):\n return [i / n * n + n for i in range(r)]\n\ncalculate(5, 10000000)\n>> My calculation executed (calculate) for 10 time(s) in 15.165313 seconds\n>> My calculation best time was 1.414186 seconds\n```\n\n### Tracking **specific points** along your code\nThe `with` statement can also be used to measure code time\n> Named tracking points can be added with the `track` function\n\n```python\nimport timy\n\nwith timy.Timer() as timer:\n N = 10000000\n for i in range(N):\n if i == N/2:\n timer.track('Half way')\n\n>> Timy (Half way) 0.557577 seconds\n>> Timy 0.988087 seconds \n```\n\nAnother usage of tracking in a prime factors function\n\n```python\ndef prime_factors(n):\n with timy.Timer('Factors') as timer:\n i = 2\n factors = []\n def add_factor(n):\n factors.append(n)\n timer.track('Found a factor')\n\n while i * i <= n:\n if n % i == 0:\n add_factor(i)\n n //= i\n else:\n i += 1\n return factors + [n]\n\nfactors = prime_factors(600851475143)\nprint(factors)\n\n>> Factors (Found a factor) 0.000017 seconds\n>> Factors (Found a factor) 0.000376 seconds\n>> Factors (Found a factor) 0.001547 seconds\n>> Factors 0.001754 seconds\n>> [71, 839, 1471, 6857]\n```\n\n### Configuring\n\n#### Importing timy config\n\n```python\nfrom timy.settings import timy_config\n```\n\n#### Enable or disable timy trackings\nYou can enable or disable timy trackings with the `tracking` value.\n> The default value of `tracking` is `True`\n\n```python\ntimy_config.tracking = False\n```\n\n#### Changing the way timy outputs information\nYou can choose between print or logging for all timy outputs by setting the\nvalue of `tracking_mode`.\n> The default value of `tracking_mode` is `TrackingMode.PRINTING`.\n\n```python\nfrom timy.settings import (\n timy_config,\n TrackingMode\n)\n\ntimy_config.tracking_mode = TrackingMode.LOGGING\n```\n\ntimy logs at the INFO level, which is not printed or stored by default. To\nconfigure the logging system to print all INFO messages do\n```\nimport logging\nlogging.basicConfig(level=logging.INFO)\n```\nor to configure the logging system to print only timy's INFO messages do\n```\nimport logging\nlogging.basicConfig()\nlogging.getLogger('timy').level=logging.INFO\n```\n\n## Contribute\nContributions are **always** welcome, but keep it simple and small.\n\n## License\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n\n\n## Changelog\n\n### v 0.4.0 (September 23, 2017)\n\n- Drops py2 support and adds 100% coverage with CI integration\n\n### v 0.3.3 (April 19, 2017)\n\n- Adds an optional argument `include_sleeptime` to count time elapsed including sleep time (`include_sleeptime=True`) and excluding sleep time (`include_sleeptime=False`)\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ramonsaraiva/timy", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "timy", "package_url": "https://pypi.org/project/timy/", "platform": "", "project_url": "https://pypi.org/project/timy/", "project_urls": { "Homepage": "https://github.com/ramonsaraiva/timy" }, "release_url": "https://pypi.org/project/timy/0.4.2/", "requires_dist": null, "requires_python": "", "summary": "Minimalist measurement of python code time", "version": "0.4.2" }, "last_serial": 4141243, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "9dd086149328433d3f7bccff13d5de20", "sha256": "3b1fb6728d9129fe203e3f0699c22fa84db151eeb3c82a5960adda2a5c1ca53a" }, "downloads": -1, "filename": "timy-0.1.tar.gz", "has_sig": false, "md5_digest": "9dd086149328433d3f7bccff13d5de20", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1246, "upload_time": "2017-01-07T22:39:13", "url": "https://files.pythonhosted.org/packages/a8/63/e24dc74d747b1a37d8f991b5c6edea2c6f979d4f770d79bb32c8cfac7636/timy-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "6404458b60cde5c98591d8b03c0b2f0f", "sha256": "242706d1595570ee02ee7501f78fef7581b35a56acced743404d48c8706f17b0" }, "downloads": -1, "filename": "timy-0.2.tar.gz", "has_sig": false, "md5_digest": "6404458b60cde5c98591d8b03c0b2f0f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1279, "upload_time": "2017-01-08T10:52:22", "url": "https://files.pythonhosted.org/packages/c4/be/9bc257f39d9f9963f4fa327ac20ac6efcbb1467d055b4cd880882dc68b1b/timy-0.2.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "86fda677acbbfd38d8bedbdb4dadf5ad", "sha256": "c2c759864fee1d24b5b4ee87ccbac1e2cf098d28beb3419846c3ec61992562fb" }, "downloads": -1, "filename": "timy-0.3.1.tar.gz", "has_sig": false, "md5_digest": "86fda677acbbfd38d8bedbdb4dadf5ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1576, "upload_time": "2017-01-10T16:25:21", "url": "https://files.pythonhosted.org/packages/87/b1/9d7d2564c54d52589d44fdbb24c5ae9ed92a4ec2b07865420bf232d964ac/timy-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "b94df16831d074e91b87b47fc4bfaf0c", "sha256": "58663321dbec00d774f09ead643d0d7f638beb2e11e4c604952b278f244f7f4e" }, "downloads": -1, "filename": "timy-0.3.2.tar.gz", "has_sig": false, "md5_digest": "b94df16831d074e91b87b47fc4bfaf0c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1578, "upload_time": "2017-01-12T11:34:03", "url": "https://files.pythonhosted.org/packages/a5/71/cfa08d1df61b749c39bad20bc7599833f71c1656e9efb8fd47553a38be41/timy-0.3.2.tar.gz" } ], "0.3.4": [ { "comment_text": "", "digests": { "md5": "c532ab866861ad2cb88c6be7ea02d68c", "sha256": "ca5e878ba22be4633de022e4bbb27b4ba09ee982d55d5f27e219bcab2310e5df" }, "downloads": -1, "filename": "timy-0.3.4.tar.gz", "has_sig": false, "md5_digest": "c532ab866861ad2cb88c6be7ea02d68c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1611, "upload_time": "2017-09-20T22:31:29", "url": "https://files.pythonhosted.org/packages/33/ea/e86d525497ac94252ecd39d91b094cf897d5e46913d198d0f83420bad114/timy-0.3.4.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "e95e9494d106f52cc639fa35ef1402d5", "sha256": "2090611c34000523f0a7c29006cc5ef112ac5422ee201ab2467776fae0f3a981" }, "downloads": -1, "filename": "timy-0.4.0.tar.gz", "has_sig": false, "md5_digest": "e95e9494d106f52cc639fa35ef1402d5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3075, "upload_time": "2017-09-23T23:40:25", "url": "https://files.pythonhosted.org/packages/1e/21/81d088030fcf64720d84022843d1e5b840ba5f61808ae589b70608f66945/timy-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "d5f21ed9bc1a6257399a4412e1b95397", "sha256": "664882759b237c393e4a0dfdb260cb5ea0e14103465a5353382f66d62cfa1235" }, "downloads": -1, "filename": "timy-0.4.1-py3-none-any.whl", "has_sig": false, "md5_digest": "d5f21ed9bc1a6257399a4412e1b95397", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3862, "upload_time": "2018-08-06T17:33:30", "url": "https://files.pythonhosted.org/packages/b4/3d/5be767b262917ae75d2eb92bf35169307529709bf6a7a1e9a41235676b30/timy-0.4.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7540610f1eeb59b910f18ca4c00f890a", "sha256": "8b727d7e433ad6e2777b934d1ffd81e066eeb0aa349fd9ab47fce5f155d548cd" }, "downloads": -1, "filename": "timy-0.4.1.tar.gz", "has_sig": false, "md5_digest": "7540610f1eeb59b910f18ca4c00f890a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3719, "upload_time": "2018-08-06T17:33:32", "url": "https://files.pythonhosted.org/packages/a0/15/17a4c0172f3194503a79332c1c69433d8d25ade19f0c39ae97b51edd54f2/timy-0.4.1.tar.gz" } ], "0.4.2": [ { "comment_text": "", "digests": { "md5": "3e17f8559095f8499737a9550ffeb507", "sha256": "afd090509248dc638cd46e29a1d721ed8a079175269f5961eab576a429495b2e" }, "downloads": -1, "filename": "timy-0.4.2-py3-none-any.whl", "has_sig": false, "md5_digest": "3e17f8559095f8499737a9550ffeb507", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3892, "upload_time": "2018-08-06T17:37:40", "url": "https://files.pythonhosted.org/packages/2c/ad/b0bcdd4bc9de06f155d5b6cde2240426dc7017ed568a3aa2549447c9fd00/timy-0.4.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4359dfbc385d05fe1bf5e46c1c92f5b6", "sha256": "2d4cb1206cc012349c17cb496df0b70782c62862f494519cc82f1806125d84ab" }, "downloads": -1, "filename": "timy-0.4.2.tar.gz", "has_sig": false, "md5_digest": "4359dfbc385d05fe1bf5e46c1c92f5b6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3804, "upload_time": "2018-08-06T17:37:41", "url": "https://files.pythonhosted.org/packages/c9/f9/727adf584069a67de5a46ea33b22fa8023ca2fe8ea72cf09c0471cd16890/timy-0.4.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3e17f8559095f8499737a9550ffeb507", "sha256": "afd090509248dc638cd46e29a1d721ed8a079175269f5961eab576a429495b2e" }, "downloads": -1, "filename": "timy-0.4.2-py3-none-any.whl", "has_sig": false, "md5_digest": "3e17f8559095f8499737a9550ffeb507", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3892, "upload_time": "2018-08-06T17:37:40", "url": "https://files.pythonhosted.org/packages/2c/ad/b0bcdd4bc9de06f155d5b6cde2240426dc7017ed568a3aa2549447c9fd00/timy-0.4.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4359dfbc385d05fe1bf5e46c1c92f5b6", "sha256": "2d4cb1206cc012349c17cb496df0b70782c62862f494519cc82f1806125d84ab" }, "downloads": -1, "filename": "timy-0.4.2.tar.gz", "has_sig": false, "md5_digest": "4359dfbc385d05fe1bf5e46c1c92f5b6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3804, "upload_time": "2018-08-06T17:37:41", "url": "https://files.pythonhosted.org/packages/c9/f9/727adf584069a67de5a46ea33b22fa8023ca2fe8ea72cf09c0471cd16890/timy-0.4.2.tar.gz" } ] }