{ "info": { "author": "Ram Rachum", "author_email": "ram@rachum.com", "bugtrack_url": null, "classifiers": [ "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Debuggers" ], "description": "# PySnooper - Never use print for debugging again #\n\n[![Travis CI](https://img.shields.io/travis/cool-RR/PySnooper/master.svg)](https://travis-ci.org/cool-RR/PySnooper)\n\n**PySnooper** is a poor man's debugger.\n\nYou're trying to figure out why your Python code isn't doing what you think it should be doing. You'd love to use a full-fledged debugger with breakpoints and watches, but you can't be bothered to set one up right now.\n\nYou want to know which lines are running and which aren't, and what the values of the local variables are.\n\nMost people would use `print` lines, in strategic locations, some of them showing the values of variables.\n\n**PySnooper** lets you do the same, except instead of carefully crafting the right `print` lines, you just add one decorator line to the function you're interested in. You'll get a play-by-play log of your function, including which lines ran and when, and exactly when local variables were changed.\n\nWhat makes **PySnooper** stand out from all other code intelligence tools? You can use it in your shitty, sprawling enterprise codebase without having to do any setup. Just slap the decorator on, as shown below, and redirect the output to a dedicated log file by specifying its path as the first argument.\n\n# Example #\n\nWe're writing a function that converts a number to binary, by returning a list of bits. Let's snoop on it by adding the `@pysnooper.snoop()` decorator:\n\n```python\nimport pysnooper\n\n@pysnooper.snoop()\ndef number_to_bits(number):\n if number:\n bits = []\n while number:\n number, remainder = divmod(number, 2)\n bits.insert(0, remainder)\n return bits\n else:\n return [0]\n\nnumber_to_bits(6)\n```\nThe output to stderr is:\n\n```\nStarting var:.. number = 6\n15:29:11.327032 call 4 def number_to_bits(number):\n15:29:11.327032 line 5 if number:\n15:29:11.327032 line 6 bits = []\nNew var:....... bits = []\n15:29:11.327032 line 7 while number:\n15:29:11.327032 line 8 number, remainder = divmod(number, 2)\nNew var:....... remainder = 0\nModified var:.. number = 3\n15:29:11.327032 line 9 bits.insert(0, remainder)\nModified var:.. bits = [0]\n15:29:11.327032 line 7 while number:\n15:29:11.327032 line 8 number, remainder = divmod(number, 2)\nModified var:.. number = 1\nModified var:.. remainder = 1\n15:29:11.327032 line 9 bits.insert(0, remainder)\nModified var:.. bits = [1, 0]\n15:29:11.327032 line 7 while number:\n15:29:11.327032 line 8 number, remainder = divmod(number, 2)\nModified var:.. number = 0\n15:29:11.327032 line 9 bits.insert(0, remainder)\nModified var:.. bits = [1, 1, 0]\n15:29:11.327032 line 7 while number:\n15:29:11.327032 line 10 return bits\n15:29:11.327032 return 10 return bits\nReturn value:.. [1, 1, 0]\n```\n\n# Features #\n\nIf stderr is not easily accessible for you, you can redirect the output to a file:\n\n```python\n@pysnooper.snoop('/my/log/file.log')\n```\n\nSee values of some variables that aren't local variables:\n\n```python\n@pysnooper.snoop(variables=('foo.bar', 'self.whatever'))\n```\n\nShow snoop lines for functions that your function calls:\n\n```python\n@pysnooper.snoop(depth=2)\n```\n\nStart all snoop lines with a prefix, to grep for them easily:\n\n```python\n@pysnooper.snoop(prefix='ZZZ ')\n```\n\n# Installation #\n\n```console\n$ pip install pysnooper\n```\n\n# Contribute #\n\n[Pull requests](https://github.com/cool-RR/PySnooper/pulls) are always welcome!\nPlease, write tests and run them with [Tox](https://tox.readthedocs.io/).\n\nTox installs all dependencies automatically. You only need to install Tox itself:\n\n```console\n$ pip install tox\n```\n\nList all environments `tox` would run:\n\n```console\n$ tox -lv\n```\n\nIf you want to run tests agains all target Python versions use [pyenv](\nhttps://github.com/pyenv/pyenv) to install them. Otherwise, you can run\nonly linters and the ones you have already installed on your machine:\n\n```console\n# run only some environments\n$ tox -e flake8,pylint,bandit,py27,py36\n```\n\nLinters and tests should pass before you push your code. They will be run again on Travis CI.\n\n# License #\n\nCopyright (c) 2019 Ram Rachum and collaborators, released under the MIT license.\n\nI provide [Development services in Python and Django](https://chipmunkdev.com\n) and I [give Python workshops](http://pythonworkshops.co/) to teach people\nPython and related topics.\n\n# Media Coverage #\n\n[Hacker News thread](https://news.ycombinator.com/item?id=19717786)\nand [/r/Python Reddit thread](https://www.reddit.com/r/Python/comments/bg0ida/pysnooper_never_use_print_for_debugging_again/) (22 April 2019)\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/MattGook/PySnooper.git", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "PySnooper-g", "package_url": "https://pypi.org/project/PySnooper-g/", "platform": "", "project_url": "https://pypi.org/project/PySnooper-g/", "project_urls": { "Homepage": "https://github.com/MattGook/PySnooper.git" }, "release_url": "https://pypi.org/project/PySnooper-g/0.1.0/", "requires_dist": null, "requires_python": "", "summary": "A poor man's debugger for Python.", "version": "0.1.0" }, "last_serial": 5191294, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "bf802d6f8290bb796efe96387339dd90", "sha256": "a61f4732ba12d7f0844606a3b7a2d770af0484ae2b86d320e23ef6383384597c" }, "downloads": -1, "filename": "PySnooper_g-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "bf802d6f8290bb796efe96387339dd90", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 23757, "upload_time": "2019-04-26T06:49:59", "url": "https://files.pythonhosted.org/packages/d4/d2/f3a25fc2af2c12290d5689994daee0fb6c594376c33c722bfea001996ab1/PySnooper_g-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c6f58ab56e5227b8ffe658d53751efc0", "sha256": "6a781a5b0f1ae91b70cbd00a2386bf43f6307eaec22e3eb8dea67986974ba9be" }, "downloads": -1, "filename": "PySnooper-g-0.1.0.tar.gz", "has_sig": false, "md5_digest": "c6f58ab56e5227b8ffe658d53751efc0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20579, "upload_time": "2019-04-26T06:50:03", "url": "https://files.pythonhosted.org/packages/c2/45/41d094e09d6d706cfea58329e5349f3314227fcb065569d7fed9d7aa2afe/PySnooper-g-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bf802d6f8290bb796efe96387339dd90", "sha256": "a61f4732ba12d7f0844606a3b7a2d770af0484ae2b86d320e23ef6383384597c" }, "downloads": -1, "filename": "PySnooper_g-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "bf802d6f8290bb796efe96387339dd90", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 23757, "upload_time": "2019-04-26T06:49:59", "url": "https://files.pythonhosted.org/packages/d4/d2/f3a25fc2af2c12290d5689994daee0fb6c594376c33c722bfea001996ab1/PySnooper_g-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c6f58ab56e5227b8ffe658d53751efc0", "sha256": "6a781a5b0f1ae91b70cbd00a2386bf43f6307eaec22e3eb8dea67986974ba9be" }, "downloads": -1, "filename": "PySnooper-g-0.1.0.tar.gz", "has_sig": false, "md5_digest": "c6f58ab56e5227b8ffe658d53751efc0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20579, "upload_time": "2019-04-26T06:50:03", "url": "https://files.pythonhosted.org/packages/c2/45/41d094e09d6d706cfea58329e5349f3314227fcb065569d7fed9d7aa2afe/PySnooper-g-0.1.0.tar.gz" } ] }