{ "info": { "author": "Rodrigo da Silva", "author_email": "dasil021@umn.edu", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# sloth-cli\n\n![logo](docs/sloth.jpg)\n\nA library to speed the profile (cProfile) analyses of code performance on a per\nline basis. This library allow the user to call a python script file with \narguments and analyse what lines of code are taking longer to process.\n\nAn example output of the `sloth-cli`:\n\n```shell\nSat Jun 8 11:56:40 2019 profileOutput.profile\n\n 5400 function calls (5340 primitive calls) in 3.017 seconds\n\n Ordered by: cumulative time\n List reduced from 352 to 100 due to restriction <100>\n\n ncalls tottime percall cumtime percall filename:lineno(function)\n 4/1 0.000 0.000 3.017 3.017 {built-in method builtins.exec}\n 1 0.000 0.000 3.017 3.017 tester.py:1()\n 1 0.000 0.000 3.014 3.014 tester.py:21(run)\n 3 3.012 1.004 3.012 1.004 {built-in method time.sleep}\n``` \n\n\n## Install\n\n```\npip install sloth-cli\n```\n\n## Decorator Usage\n\nThe `sloth.profile` allows you to gather the profile data by adding it as\na decorator. The decorator can be enabled or disabled whenever needed. It \ncan also be turned on by setting the environment variable `SLOTH_PROFILE` \nto `True` (`SLOTH_PROFILE='True'`) so you can set add it to your code and \nleave it; then just turn it on when you need to validate the code performance.\n\n### To use the decorator do the following\n\n```python\nimport time\n\nfrom sloth_cli import profile\n\n\ndef _loop_sleep():\n \"\"\"Loops and sleeps\"\"\"\n for i in range(3):\n print(i)\n time.sleep(1)\n\n\ndef _loop():\n \"\"\"Loops 1000 times\"\"\"\n ints = []\n for i in range(1000):\n ints.append(i)\n\n\n@profile(enable=True, lines=50, builtins=False)\ndef run():\n \"\"\"Run loops\"\"\"\n _loop()\n _loop()\n _loop_sleep()\n\n\nif __name__ == '__main__':\n run()\n```\n\n```bash\n 10 function calls in 3.006 seconds\n\n Ordered by: cumulative time\n\n ncalls tottime percall cumtime percall filename:lineno(function)\n 1 0.000 0.000 3.006 3.006 test_profiler.py:20(run)\n 1 3.005 3.005 3.005 3.005 test_profiler.py:6(_loop_sleep)\n 6 0.000 0.000 0.000 0.000 capture.py:413(write)\n 2 0.000 0.000 0.000 0.000 test_profiler.py:13(_loop)\n```\n\n## CLI Usage\n\nUsing a `tester.py` cli script (argsparse):\n\n### To run `tester.py` with arguments:\n\n```bash\nsloth -f tester.py --cmd fake --fake-arg test\n```\n\n### To get the `tester.py` help:\n\n```bash\nsloth -f tester.py -l 100 --cmd --help\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/rigogsilva/sloth-cli", "keywords": "cProfile,speed,cli,performance,slow", "license": "", "maintainer": "", "maintainer_email": "", "name": "sloth-cli", "package_url": "https://pypi.org/project/sloth-cli/", "platform": "", "project_url": "https://pypi.org/project/sloth-cli/", "project_urls": { "Homepage": "https://github.com/rigogsilva/sloth-cli" }, "release_url": "https://pypi.org/project/sloth-cli/1.1.1/", "requires_dist": null, "requires_python": "", "summary": "A library to analyse how slow your code is. This is a quick way to validate what is slow in your code.", "version": "1.1.1" }, "last_serial": 5400686, "releases": { "1.0.5": [ { "comment_text": "", "digests": { "md5": "60a2cdb1f664578a3dac0be6e646a90c", "sha256": "581812234b49f27c9f6affb606b7dfbe4c2a9bfa20eb093717b2cdd12e1cf146" }, "downloads": -1, "filename": "sloth-cli-1.0.5.tar.gz", "has_sig": false, "md5_digest": "60a2cdb1f664578a3dac0be6e646a90c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3910, "upload_time": "2019-06-09T07:14:17", "url": "https://files.pythonhosted.org/packages/bf/91/c63810610075e4312213c36281541813e9b6ecdcfbfbbba862e90dc707af/sloth-cli-1.0.5.tar.gz" } ], "1.0.6": [ { "comment_text": "", "digests": { "md5": "e20b31d699a534156c701de134f9bfc5", "sha256": "5ee545a8d63e2b346898c1ed0d963498b548d5f4e261ad0ad6b96fd55aa4c307" }, "downloads": -1, "filename": "sloth-cli-1.0.6.tar.gz", "has_sig": false, "md5_digest": "e20b31d699a534156c701de134f9bfc5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4132, "upload_time": "2019-06-09T07:27:25", "url": "https://files.pythonhosted.org/packages/e3/06/6b4562ce7c4d2a76591aff66facd79cd2082dd1840c7526f948ba9933b07/sloth-cli-1.0.6.tar.gz" } ], "1.0.7": [ { "comment_text": "", "digests": { "md5": "7d7228e8156fa0dd4dabd62e5489cba3", "sha256": "647d7d99cb0ad40ee64b413dc0a6647a011b97f9eef529e3cfceba8b58a26706" }, "downloads": -1, "filename": "sloth-cli-1.0.7.tar.gz", "has_sig": false, "md5_digest": "7d7228e8156fa0dd4dabd62e5489cba3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4140, "upload_time": "2019-06-09T07:32:42", "url": "https://files.pythonhosted.org/packages/fb/d6/620c5d0dfe8abbfc930cc0f97054ad3e11d0d783a37816af7c2a640095e3/sloth-cli-1.0.7.tar.gz" } ], "1.0.8": [ { "comment_text": "", "digests": { "md5": "f56832a43523d7b48d3ce2f8c0dc5609", "sha256": "02140dcb72d0f349d7757ae7d2e0d9de20e86c5d0fdf0a9bb243bec43e2bf122" }, "downloads": -1, "filename": "sloth-cli-1.0.8.tar.gz", "has_sig": false, "md5_digest": "f56832a43523d7b48d3ce2f8c0dc5609", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4134, "upload_time": "2019-06-09T07:54:54", "url": "https://files.pythonhosted.org/packages/f4/96/8c010a84e17150e4d759641cb9c38b6a888cc913ecdffca2c3bf9943c762/sloth-cli-1.0.8.tar.gz" } ], "1.0.9": [ { "comment_text": "", "digests": { "md5": "27d89f2ec55d23638033dce149bb8095", "sha256": "102155e12f65989831d27cab26c15f574fe0b294a93dece19b39180ba7eb977a" }, "downloads": -1, "filename": "sloth-cli-1.0.9.tar.gz", "has_sig": false, "md5_digest": "27d89f2ec55d23638033dce149bb8095", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4160, "upload_time": "2019-06-10T03:08:08", "url": "https://files.pythonhosted.org/packages/e5/a9/f2b2c34145176f9195468ea3ccd10053d83d5cca09ede03b9dd1987075c6/sloth-cli-1.0.9.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "e81615975d29417a2c35a4852c44c66d", "sha256": "b989def12d59afd4753385082907dc798a9036e09c8e087b31b59943ba812b43" }, "downloads": -1, "filename": "sloth-cli-1.1.0.tar.gz", "has_sig": false, "md5_digest": "e81615975d29417a2c35a4852c44c66d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5107, "upload_time": "2019-06-11T04:01:16", "url": "https://files.pythonhosted.org/packages/dd/4f/2ef5f0e8bedace901dbbbe4ecfbca44a9c1070acf29933d15b7c17dfbc39/sloth-cli-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "1f37f4485d04a8652a849ef8dba790fa", "sha256": "c2b99bfcef3c89fb0dbe01ded08540cff0e6d59fb2ace38e4008bc202df29463" }, "downloads": -1, "filename": "sloth-cli-1.1.1.tar.gz", "has_sig": false, "md5_digest": "1f37f4485d04a8652a849ef8dba790fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5115, "upload_time": "2019-06-14T13:54:09", "url": "https://files.pythonhosted.org/packages/80/40/d91e6d8716544f7fd4b27293216958281102e369b3444893063018e4d787/sloth-cli-1.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1f37f4485d04a8652a849ef8dba790fa", "sha256": "c2b99bfcef3c89fb0dbe01ded08540cff0e6d59fb2ace38e4008bc202df29463" }, "downloads": -1, "filename": "sloth-cli-1.1.1.tar.gz", "has_sig": false, "md5_digest": "1f37f4485d04a8652a849ef8dba790fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5115, "upload_time": "2019-06-14T13:54:09", "url": "https://files.pythonhosted.org/packages/80/40/d91e6d8716544f7fd4b27293216958281102e369b3444893063018e4d787/sloth-cli-1.1.1.tar.gz" } ] }