{ "info": { "author": "Ryan Northey", "author_email": "ryan@synca.io", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Programming Language :: Python :: 2.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Detailed documentation\n**********************\n\ndj.debug\n========\n\nSimple debug utils for Django apps to aid with test-driven development.\n\n\n|build| |coverage|\n\n\nInstall\n-------\n\n.. code-block:: console\n\n $ pip install dj.debug\n\n\nFor development install\n\n.. code-block:: console\n\n $ pip install -e git+git@github.com:translate/dj.debug#egg=dj.debug\n $ pip install dj.debug[test]\n\n\nInitializing the builtin object\n-------------------------------\n\nThe utils can be imported directly, but the better way is to use `_trace` builtin\nfunctionality.\n\nTo activate this call the following, anywhere in your code - eg. in your test settings\n\n\n.. code-block:: python\n\n >>> from dj.debug import trace_debug\n\n >>> trace_debug()\n\nOnce this is done, you will have a `_trace` object available anywhere in your environment.\n\n.. code-block:: python\n\n >>> _trace\n \n\n\nYou can specify the name of the builtin\n\n.. code-block:: python\n\n >>> trace_debug(\"_t\")\n >>> _t\n \n\nUsing the builtin object has the advantage that it won't be recognized by linters if you\naccidentally leave it in your code.\n\n\nUsage - pdb\n-----------\n\nThe `_t` object provides quick access to pdb\n\n.. code-block:: python\n\n >>> _t.pdb.set_trace()\n --Return--\n > (1)()->None\n (Pdb)\n\n\nUsage - trace debugging\n-----------------------\n\nIf a line of code that you want to debug is hit many times prior to the point at which you\nwant to debug it you can use the `_t` object's debug flag\n\n.. code-block:: python\n\n >>> def commonly_hit_code(*args, **kwargs):\n ... if _t.debug: _t.pdb.set_trace()\n\n >>> def some_other_code(*args, **kwargs):\n ... # we only want to debug after this point\n ... _t.debug = True\n ... something_which_triggers_commonly_hit_code()\n\n\nUsage - sql debugging\n---------------------\n\nThis tools is useful for finding non-performant code in Django. By tracing the sql that is\nbeing run in blocks of code, you can find and fix querysets that trigger too many queries,\nare too complex, have overly large results, etc. You can also use the output in Django's\n`dbshell` to analyze, improve and add indeces where appropriate.\n\n\n.. code-block:: python\n\n >>> with _t.debug_sql():\n ... trigger_some_orm_action()\n\n\n\n.. |build| image:: https://img.shields.io/travis/translate/dj.debug/master.svg?style=flat-square\n :alt: Build Status\n :target: https://travis-ci.org/translate/dj.debug/branches\n\n\n.. |coverage| image:: https://img.shields.io/codecov/c/github/translate/dj.debug/master.svg?style=flat-square\n :target: https://codecov.io/gh/translate/dj.debug/branch/master\n :alt: Test Coverage\n\n\ndj.debug usage\n==============\n\ndj.debug.debug_sql\n------------------------------\n\n...todo...\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/translate/dj.debug", "keywords": "", "license": "GPL3", "maintainer": "", "maintainer_email": "", "name": "dj.debug", "package_url": "https://pypi.org/project/dj.debug/", "platform": "", "project_url": "https://pypi.org/project/dj.debug/", "project_urls": { "Homepage": "http://github.com/translate/dj.debug" }, "release_url": "https://pypi.org/project/dj.debug/0.0.2/", "requires_dist": null, "requires_python": "", "summary": "Debugging tools for django", "version": "0.0.2" }, "last_serial": 3586871, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "c11b2b02c6c4cdacfe4912e37a202f05", "sha256": "0bb851ff9ee31c3991d6c11e67038fd2a5ad3c6d47f7f44140ffde5341b432ef" }, "downloads": -1, "filename": "dj.debug-0.0.1.tar.gz", "has_sig": false, "md5_digest": "c11b2b02c6c4cdacfe4912e37a202f05", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5443, "upload_time": "2017-11-26T15:23:59", "url": "https://files.pythonhosted.org/packages/99/71/b6c36727ff21682be64e7de5a8abeb07675c819bf59585d4a8332370bb88/dj.debug-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "63597c56b1554da0f88d77aff2be079d", "sha256": "0b7629bde97f1cce6077ac430537089f5a2552973004951cb3590e30fec9054a" }, "downloads": -1, "filename": "dj.debug-0.0.2.tar.gz", "has_sig": false, "md5_digest": "63597c56b1554da0f88d77aff2be079d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5804, "upload_time": "2018-02-16T09:52:55", "url": "https://files.pythonhosted.org/packages/da/9b/60b1d15995e79fff65e888937cc42daf0e52537eddd5a64e9c44236576f5/dj.debug-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "63597c56b1554da0f88d77aff2be079d", "sha256": "0b7629bde97f1cce6077ac430537089f5a2552973004951cb3590e30fec9054a" }, "downloads": -1, "filename": "dj.debug-0.0.2.tar.gz", "has_sig": false, "md5_digest": "63597c56b1554da0f88d77aff2be079d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5804, "upload_time": "2018-02-16T09:52:55", "url": "https://files.pythonhosted.org/packages/da/9b/60b1d15995e79fff65e888937cc42daf0e52537eddd5a64e9c44236576f5/dj.debug-0.0.2.tar.gz" } ] }