{ "info": { "author": "Jamie Wong", "author_email": "jamie.lf.wong@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "Line Profile Panel for Flask Debug Toolbar\n==========================================\n\n.. image:: http://i.imgur.com/d5KaP.png\n\nThis is a panel for `flask_debugtoolbar`_ which enables the ability to view \nline profiling information from selected functions.\n\nThe line profile information comes from the `line_profiler`_ module, but you \ndon't need to worry about that.\n\nInstallation\n------------\n\nFirst, you need to get the package. Install it with pip:\n\n::\n\n pip install flask-debugtoolbar-lineprofilerpanel\n\nSomewhere after you've set ``app.debug = True`` and before ``app.run``, you need\nto specify the ``flask_debugtoolbar`` panels that you want to use and include\n``'flask_debugtoolbar_lineprofilerpanel.panels.LineProfilerPanel'`` in that\nlist.\n\nFor example, here's a small flask app with the panel installed and with line \nprofiling enabled for the `hello_world`:\n\n::\n\n from flask import Flask\n app = Flask(__name__)\n\n import flask_debugtoolbar\n\n from flask_debugtoolbar_lineprofilerpanel.profile import line_profile\n\n @app.route('/')\n @line_profile\n def hello_world():\n return flask.render_template('hello_world.html')\n\n if __name__ == '__main__':\n app.debug = True\n\n # Specify the debug panels you want\n app.config['DEBUG_TB_PANELS'] = [\n 'flask_debugtoolbar.panels.versions.VersionDebugPanel',\n 'flask_debugtoolbar.panels.timer.TimerDebugPanel',\n 'flask_debugtoolbar.panels.headers.HeaderDebugPanel',\n 'flask_debugtoolbar.panels.request_vars.RequestVarsDebugPanel',\n 'flask_debugtoolbar.panels.template.TemplateDebugPanel',\n 'flask_debugtoolbar.panels.sqlalchemy.SQLAlchemyDebugPanel',\n 'flask_debugtoolbar.panels.logger.LoggingPanel',\n 'flask_debugtoolbar.panels.profiler.ProfilerDebugPanel',\n # Add the line profiling\n 'flask_debugtoolbar_lineprofilerpanel.panels.LineProfilerPanel'\n ]\n toolbar = flask_debugtoolbar.DebugToolbarExtension(app)\n\n app.run()\n\n\nUsage\n-----\n\nUnlike the regular profile panel that comes with ``flask_debugtoolbar``, the\nline profiler will only profile functions you specifically tell it to. You can\neither use it as a decorator or directly as a function.\n\n::\n\n from flask_debugtoolbar_lineprofilerpanel.profile import line_profile\n\n # Using it as a decorator\n @app.route('/profile')\n @line_profile\n def profile_page():\n ...\n return flask.render_template('profile_page')\n\n # Explicit argument\n line_profile(some_function)\n\nNote that if I had done ``line_profile(profile_page)`` in the example above, it\nwould've profiled the wrapper created by ``app.route``. In general, you probably\njust want to use ``line_profile`` as a decorator.\n\nAlso note that the following will profile the decorator wrapper, not the inner\nfunction.\n\n::\n\n # Using it incorrectly as a decorator\n @line_profile\n @app.route('/profile')\n def profile_page():\n ...\n return flask.render_template('profile_page')\n\nAlways use ``@line_profile`` as the inner-most decorator.\n\n.. _`flask_debugtoolbar`: https://github.com/mgood/flask-debugtoolbar\n.. _`line_profiler`: https://github.com/certik/line_profiler\n\n\nUsing line_profiler with the Google AppEngine SDK\n-------------------------------------------------\n\n``line_profiler`` is implemented as a C extension. Unfortunately, AppEngine does not support C extensions in the cloud, and ``dev_appserver`` simulates this restriction on your local machine. If you'd like to use ``line_profiler`` on your local machine, you can monkey-patch the AppEngine SDK to permit it. The Flask-DebugToolbar will make sure this plugin is disabled in production (it will catch any ImportErrors and disable the affected panel).\n\nSimply open ``application/__init__.py``, which should look something like this::\n \n from __future__ import absolute_import\n\n from flask import Flask\n\n app = Flask('application')\n app.config.from_object('application.settings')\n\n if app.config['DEBUG']:\n from werkzeug.debug import DebuggedApplication\n \n app.wsgi_app = DebuggedApplication(app.wsgi_app, evalex=True)\n\n\n from flask.ext.debugtoolbar import DebugToolbarExtension\n \n toolbar = DebugToolbarExtension(app)\n\n\n import application.urls\n\n\nand insert the monkey-patch, like so:\n\n\n::\n\n from __future__ import absolute_import\n\n from flask import Flask\n\n app = Flask('application')\n app.config.from_object('application.settings')\n\n if app.config['DEBUG']:\n from werkzeug.debug import DebuggedApplication\n \n app.wsgi_app = DebuggedApplication(app.wsgi_app, evalex=True)\n\n\n # We can't use LineProfiler in production because it requires a C-extension,\n # but we can monkey-patch it in here for use on the dev server:\n try:\n import os, sys, re\n\n if 'SERVER_SOFTWARE' in os.environ and os.environ['SERVER_SOFTWARE'].startswith('Dev'):\n # white-list the line_profiler C extension\n sys.meta_path[3]._enabled_regexes.append(re.compile(r'.*line_profiler.*'))\n\n from flask_debugtoolbar_lineprofilerpanel.profile import line_profile\n\n\n ## import the methods you want to profile here, and whitelist them with line_profile:\n #from application.views import YourViewClass\n #\n #line_profile(YourViewClass.the_method_you_want_to_profile)\n #line_profile(YourViewClass.another_method_you_want_to_profile)\n except:\n pass\n \n\n # Make sure the monkey-patch is applied before you instantiate the DebugToolbarExtension.\n from flask.ext.debugtoolbar import DebugToolbarExtension\n \n toolbar = DebugToolbarExtension(app)\n\n\n import application.urls\n\n\n1.0.1 (2013-11-12)\n++++++++++++++++++\n\n* Make it >= 1.0.0 so the --pre flag isn't needed to install the package\n (it's 1.0.1 instead of 1.0.0 because I'm bad at things)\n* Specify version 1.0b3 of line-profiler to make the install work\n\n0.0.6 (2012-11-13)\n++++++++++++++++++\n\n* No longer polluting the template namespace\n* Show all lines, not just those with profiling information\n\n0.0.5 (2012-11-13)\n++++++++++++++++++\n\n* Table output, ditch the default output given by LineProfiler.print_stats()\n* Usage instructions in the panel\n\n0.0.1 (2012-11-12)\n++++++++++++++++++\n\n* Got it \"working\"\n* Super Ugly", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/phleet/flask_debugtoolbar_lineprofilerpanel", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "Flask-DebugToolbar-LineProfilerPanel", "package_url": "https://pypi.org/project/Flask-DebugToolbar-LineProfilerPanel/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/Flask-DebugToolbar-LineProfilerPanel/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/phleet/flask_debugtoolbar_lineprofilerpanel" }, "release_url": "https://pypi.org/project/Flask-DebugToolbar-LineProfilerPanel/1.0.2/", "requires_dist": null, "requires_python": null, "summary": "Panel for the Flask Debug toolbar to capture and view line-by-line profiling stats", "version": "1.0.2" }, "last_serial": 898456, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "48f7103773cd02b6d23e97a3144eda5f", "sha256": "ac4760244d2b5339ac550c845934704971cd9858d9d6baaf4881b49e88ce24b5" }, "downloads": -1, "filename": "Flask-DebugToolbar-LineProfilerPanel-0.0.1.tar.gz", "has_sig": false, "md5_digest": "48f7103773cd02b6d23e97a3144eda5f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2992, "upload_time": "2012-11-12T06:27:00", "url": "https://files.pythonhosted.org/packages/99/ff/090fe0b3b820bd17a33d36e201c29d7282fd1193cbb1145257dcd8a598f6/Flask-DebugToolbar-LineProfilerPanel-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "61e830be07f7acbf303061dbd4c2f858", "sha256": "c23885b6e2322ad909bae3954f94e56f3b09a6ed6f621abef463f2ee3b3a2b24" }, "downloads": -1, "filename": "Flask-DebugToolbar-LineProfilerPanel-0.0.2.tar.gz", "has_sig": false, "md5_digest": "61e830be07f7acbf303061dbd4c2f858", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2996, "upload_time": "2012-11-12T06:40:08", "url": "https://files.pythonhosted.org/packages/06/a1/bdc734676f4ed82e614336262f1b0c080c676d5f3320c7e7fc3c16d716e1/Flask-DebugToolbar-LineProfilerPanel-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "45760628c5c98646807ecfb48377a5ff", "sha256": "daa1f0dd9115e2ef6017c292e481a6c203398412b79bb0da8f0a15e4421420fb" }, "downloads": -1, "filename": "Flask-DebugToolbar-LineProfilerPanel-0.0.3.tar.gz", "has_sig": false, "md5_digest": "45760628c5c98646807ecfb48377a5ff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3021, "upload_time": "2012-11-12T06:47:30", "url": "https://files.pythonhosted.org/packages/f2/9d/ade12153d7db821ff309e9604552fbb32586f339a12b09c16c1dee28ea9c/Flask-DebugToolbar-LineProfilerPanel-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "1d04b1d952fec8bd23c77b66939ab914", "sha256": "4e26b87413b874d52b5f19369533b8583fb8c2103283229e2d9097dc0475c6dc" }, "downloads": -1, "filename": "Flask-DebugToolbar-LineProfilerPanel-0.0.4.tar.gz", "has_sig": false, "md5_digest": "1d04b1d952fec8bd23c77b66939ab914", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3159, "upload_time": "2012-11-12T07:38:37", "url": "https://files.pythonhosted.org/packages/67/35/6eb01ae0c069d87ae318a8848dc499e799a4bdc0b6bdb78087211e66d2cc/Flask-DebugToolbar-LineProfilerPanel-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "fa531f4840c9d653130b8dd23b8ed430", "sha256": "c5ba95f36b4d99844e01d9f4160126de2b2e425f9eef5d8e04e48f460b8e0056" }, "downloads": -1, "filename": "Flask-DebugToolbar-LineProfilerPanel-0.0.5.tar.gz", "has_sig": false, "md5_digest": "fa531f4840c9d653130b8dd23b8ed430", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4283, "upload_time": "2012-11-13T07:06:55", "url": "https://files.pythonhosted.org/packages/47/58/d12eb4872ce6c10ed6e7d3603011c9349786364ebcf2a56f73c1be59cd3c/Flask-DebugToolbar-LineProfilerPanel-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "2a19ac9976cdb16fa537b3b904eb4674", "sha256": "d75b48bb7fc7b8950e3f55f4d6ab042f7b7a10ebb52286e44ddfabe0d4c7906c" }, "downloads": -1, "filename": "Flask-DebugToolbar-LineProfilerPanel-0.0.6.tar.gz", "has_sig": false, "md5_digest": "2a19ac9976cdb16fa537b3b904eb4674", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4510, "upload_time": "2012-11-13T21:50:57", "url": "https://files.pythonhosted.org/packages/80/5f/0099ed7b98ebeee5013393e1b55e656b04d173fb25d193297d4b4ed53925/Flask-DebugToolbar-LineProfilerPanel-0.0.6.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "98cf5d8a955e485e362c6c075c95b95c", "sha256": "90e5adafb38493c6b782f4568fef4e50682d65a369ace6dd815883407070a930" }, "downloads": -1, "filename": "Flask-DebugToolbar-LineProfilerPanel-1.0.1.tar.gz", "has_sig": false, "md5_digest": "98cf5d8a955e485e362c6c075c95b95c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5369, "upload_time": "2013-10-12T17:03:04", "url": "https://files.pythonhosted.org/packages/54/2e/d9d61d84a9992f10f9fb0b1837260f8b3ebce4d6eecac3c3a64f90ef8dba/Flask-DebugToolbar-LineProfilerPanel-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "005d47cb98cff464ce9042b9bf66c230", "sha256": "9ea255a86a9480f9630abc217824b0487f429b35ee08c0c97d884377a2c702e7" }, "downloads": -1, "filename": "Flask-DebugToolbar-LineProfilerPanel-1.0.2.tar.gz", "has_sig": false, "md5_digest": "005d47cb98cff464ce9042b9bf66c230", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5384, "upload_time": "2013-10-19T17:53:54", "url": "https://files.pythonhosted.org/packages/56/96/25e9223dbecbc5df1078ccd7da78a5a091f4c1622d87c7812f1ec1f8788a/Flask-DebugToolbar-LineProfilerPanel-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "005d47cb98cff464ce9042b9bf66c230", "sha256": "9ea255a86a9480f9630abc217824b0487f429b35ee08c0c97d884377a2c702e7" }, "downloads": -1, "filename": "Flask-DebugToolbar-LineProfilerPanel-1.0.2.tar.gz", "has_sig": false, "md5_digest": "005d47cb98cff464ce9042b9bf66c230", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5384, "upload_time": "2013-10-19T17:53:54", "url": "https://files.pythonhosted.org/packages/56/96/25e9223dbecbc5df1078ccd7da78a5a091f4c1622d87c7812f1ec1f8788a/Flask-DebugToolbar-LineProfilerPanel-1.0.2.tar.gz" } ] }