{ "info": { "author": "Malcom Gilbert, Peter Magnusson", "author_email": "peter@birchroad.se", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5" ], "description": "# py-ndebug\n\n Tiny python debugging utility modeled after visionmedia's node.js debug module and the python 3 print function.\n This is started off as a branch of https://github.com/mjgil/pydebug\n\n## Installation\n\n```\n$ pip install ndebug\n```\n\n## Usage\n\n With `create` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or custom decorated function that emulates the python 3 `print` function but, by default, prints to `sys.stderr`. A unique color is selected per-function for visibility.\n\nExample _test.py_:\n\n```py\nimport ndebug\nimport time\n\n# \n# ndebug.create(name)\n#\n# once you have initialized the debug module you can call it as shown below\n#\n# debug(*objects, sep=' ', end='\\n', file=sys.stderr, flush=False)\n#\n\ndebug = ndebug.create(\"test\")\ndebug(\"hi there2\")\n\ndebug2 = ndebug.create(\"test2\")\ndebug2(\"awesome\")\n\ndebug({\"awesome\": True}, True, 1, \"test\")\ndebug([], {1,2,3}, {\"awesome\": True}, True, 1, \"test\")\n\ntime.sleep(0.1)\ndebug('should be milliseconds now')\n\ntime.sleep(1)\ndebug('should be seconds now')\n```\n\n The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:\n\n```\n$ DEBUG=* python test_ndebug.py\n$ DEBUG=test python test_ndebug.py\n$ DEBUG=test2 python test_ndebug.py\n$ DEBUG=test* python test_ndebug.py\n```\n\n## Microsecond diff\n\n When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the \"+NNNus\" will show you how much time was spent between calls.\n\n## When File is not a TTY\n When the file is not a TTY, `to_utc_string()` is called which mimicks the default behavior of the Javascript `Date#toUTCString()` method used in the node.js debug module, making it more useful for logging the debug information as shown below\n\n```\n$ DEBUG=* python test_ndebug.py 2>&1 | grep test\n$ DEBUG=* python test_ndebug.py 2>&1 | grep test2\n```\n\n\n## Conventions\n\n If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use \":\" to separate features. For example \"bodyParser\" from Connect would then be \"connect:bodyParser\". \n\n## Wildcards\n\n The \"*\" character may be used as a wildcard. Suppose for example your library has debuggers named \"connect:bodyParser\", \"connect:compress\", \"connect:session\", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.\n\n You can also exclude specific debuggers by prefixing them with a \"-\" character or whitespace. For example:\n\n```\n$ DEBUG=examples:*,-examples:test1 python -m examples\n```\n\n## License \n\nThe MIT License (MIT)\n\nCopyright (c) 2013 Malcom Gilbert\nCopyright (c) 2019 Peter Magnusson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\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/kmpm/py-ndebug", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "ndebug", "package_url": "https://pypi.org/project/ndebug/", "platform": "", "project_url": "https://pypi.org/project/ndebug/", "project_urls": { "Homepage": "https://github.com/kmpm/py-ndebug" }, "release_url": "https://pypi.org/project/ndebug/0.1.0/", "requires_dist": [ "colorama (==0.4.1)" ], "requires_python": "", "summary": "Tiny python debugging utility like node.js debug module", "version": "0.1.0" }, "last_serial": 4807689, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "3f44872392f9a94a0b395d7af6a1a5f9", "sha256": "7d7a9ead463cc9be2fdf3f2da95d51bf17d1db578fb9cc26cd16af5976351c71" }, "downloads": -1, "filename": "ndebug-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "3f44872392f9a94a0b395d7af6a1a5f9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6604, "upload_time": "2019-02-11T19:59:17", "url": "https://files.pythonhosted.org/packages/25/63/56cd614640c5b3fbf529d2d05c025ac4d8ac4ce79305d5457bbf92710bc3/ndebug-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7cdb1ce5954c5ab71460674a342b4661", "sha256": "ac5b75810b80f9504f30068523533e35a99b004ec02ad209e8ef3a3088601471" }, "downloads": -1, "filename": "ndebug-0.1.0.tar.gz", "has_sig": false, "md5_digest": "7cdb1ce5954c5ab71460674a342b4661", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5847, "upload_time": "2019-02-11T19:59:19", "url": "https://files.pythonhosted.org/packages/3b/ab/16a3c7b8bec439a16311b126b5d4579bcaf0c4cb3b11a1d1c0c03ed6071c/ndebug-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3f44872392f9a94a0b395d7af6a1a5f9", "sha256": "7d7a9ead463cc9be2fdf3f2da95d51bf17d1db578fb9cc26cd16af5976351c71" }, "downloads": -1, "filename": "ndebug-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "3f44872392f9a94a0b395d7af6a1a5f9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6604, "upload_time": "2019-02-11T19:59:17", "url": "https://files.pythonhosted.org/packages/25/63/56cd614640c5b3fbf529d2d05c025ac4d8ac4ce79305d5457bbf92710bc3/ndebug-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7cdb1ce5954c5ab71460674a342b4661", "sha256": "ac5b75810b80f9504f30068523533e35a99b004ec02ad209e8ef3a3088601471" }, "downloads": -1, "filename": "ndebug-0.1.0.tar.gz", "has_sig": false, "md5_digest": "7cdb1ce5954c5ab71460674a342b4661", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5847, "upload_time": "2019-02-11T19:59:19", "url": "https://files.pythonhosted.org/packages/3b/ab/16a3c7b8bec439a16311b126b5d4579bcaf0c4cb3b11a1d1c0c03ed6071c/ndebug-0.1.0.tar.gz" } ] }