Give AlbumentationsX a star on GitHub — it powers this leaderboard

Star on GitHub

pyramid-debugtoolbar

A package which provides an interactive HTML debugger for Pyramid application development

Rank: #2754Downloads: 2,029,849 (30 days)

Description

pyramid_debugtoolbar
====================

``pyramid_debugtoolbar`` provides a debug toolbar useful while you're
developing your Pyramid application.

Note that ``pyramid_debugtoolbar`` is a blatant rip-off of Michael van
Tellingen's ``flask-debugtoolbar`` (which itself was derived from Rob Hudson's
``django-debugtoolbar``). It also includes a lightly sanded down version of the
Werkzeug debugger code by Armin Ronacher and team.


Documentation
-------------

The documentation of the current stable release of ``pyramid_debugtoolbar`` is
available at
https://docs.pylonsproject.org/projects/pyramid-debugtoolbar/en/latest/.


Demonstration
-------------

For a demonstration:

- Clone the ``pyramid_debugtoolbar`` trunk.

  .. code-block:: bash

      $ git clone https://github.com/Pylons/pyramid_debugtoolbar.git

- Create a virtual environment in the workspace.

  .. code-block:: bash

      $ cd pyramid_debugtoolbar
      $ python3 -m venv env

- Install the ``pyramid_debugtoolbar`` trunk into the virtualenv.

  .. code-block:: bash

      $ env/bin/pip install -e .

- Install the ``pyramid_debugtoolbar/demo`` package into the virtualenv.

  .. code-block:: bash

      $ env/bin/pip install -e demo

- Run the ``pyramid_debugtoolbar`` package's ``demo/demo.py`` file using the
  virtual environment's Python.

  .. code-block:: bash

      $ env/bin/python demo/demo.py

Visit http://localhost:8080 in a web browser to see a page full of test
options.


Testing
-------

If you have ``tox`` installed, run all tests with:

.. code-block:: bash

    $ tox

To run only a specific Python environment:

.. code-block:: bash

    $ tox -e py311

If you don't have ``tox`` installed, you can install the testing requirements,
then run the tests.

.. code-block:: bash

    $ python3 -m venv env
    $ env/bin/pip install -e ".[testing]"
    $ env/bin/py.test


Building documentation
----------------------

If you have ``tox`` installed, build the docs with:

.. code-block:: bash

    $ tox -e docs

If you don't have ``tox`` installed, you can install the requirements to build
the docs, then build them.

.. code-block:: bash

    $ env/bin/pip install -e ".[docs]"
    $ cd docs
    $ make clean html SPHINXBUILD=../env/bin/sphinx-build

4.12.1 (2024-02-04)
-------------------

- Fix a toolbar crash when loading the page and there aren't any visible
  requests yet.

- Fix a concern where the toolbar may access sensitive request attributes like
  ``request.authenticated_userid`` at times outside of the supported request
  lifecycle.

4.12 (2024-02-03)
-----------------

- Remove dependency on setuptools / pkg_resources.
  See https://github.com/Pylons/pyramid_debugtoolbar/pull/390

- Avoid triggering DeprecationWarnings when tracking values for
  deprecated attributes in Pyramid like ``effective_principals``.
  See https://github.com/Pylons/pyramid_debugtoolbar/pull/391

4.11 (2024-01-27)
-----------------

- Drop support for SQLAlchemy < 1.4.
  See https://github.com/Pylons/pyramid_debugtoolbar/pull/388

- Add support for Python 3.12.

- Add support for SQLAlchemy 2.x.
  See https://github.com/Pylons/pyramid_debugtoolbar/pull/388

- Fix an issue where a long-running request might not appear in the toolbar UI
  without refreshing the page.

- Use ``time.monotonic()`` when computing performance intervals.

4.10 (2022-01-02)
-----------------

- Drop support for Python 2.7, 3.4, 3.5, 3.6.

- Add support for Python 3.9, 3.10, 3.11.

- Fix deprecated usages of ``threading.currentThread()``.
  See https://github.com/Pylons/pyramid_debugtoolbar/pull/374

4.9 (2020-11-24)
----------------

- Support Python 3.9.

- Added a new Session Panel to track ingress and egress changes to a registered
  ISession interface across a request lifecycle.  By default, the panel only
  operates on accessed sessions via a wrapped loader. Users can activate the
  Session Panel, via the Toolbar Settings or a per-request cookie, to track the
  ingress and egress data on all requests.

  * Removed "Session" section from Request Vars Panel
  * Updated Documentation and Screenshots

- Ensured the Headers panel only operates when a Response object exists, to
  create better stack traces if other panels encounter errors.

- ``utils.dictrepr`` will now fallback to a string comparison of the keys if a
  TypeError is encountered, which can occur under Python3.

  * A test was added to check to ensure sorting errors occur under Python3.
    If the test fails in the future, this workaround may no longer be needed.

- Updated toolbar javascript to better handle multiple user-activated panels.

  * ``split`` and ``join`` functions now use the same delimiter.
  * If the browser supports it, use a "set" to de-duplicate active panels.

- Inline comments on toolbar.js and toolbar.py to alert future developers on
  the string delimiters and cookie names.


4.8 (2020-10-23)
----------------

- Added tracking of transactional SQLAlchemy events to provide more insight
  into database session behavior during a request's lifecycle.
  See https://github.com/Pylons/pyramid_debugtoolbar/pull/368

4.7 (2020-10-22)
----------------

- Added black, isort, and github actions to the pipeline. Dropped travis-ci.

- Added some extra output to the "Request Vars" panel related to previewing
  the body contents.
  See https://github.com/Pylons/pyramid_debugtoolbar/pull/367

4.6.1 (2020-02-10)
------------------

- Fix parser errors when injecting the toolbar into XHTML formatted pages.
  See https://github.com/Pylons/pyramid_debugtoolbar/pull/360

4.6 (2020-01-20)
----------------

- Show the full URL in the tooltip on the requests panel.
  See https://github.com/Pylons/pyramid_debugtoolbar/pull/358

4.5.2 (2020-01-06)
------------------

- Stop accessing ``request.unauthenticated_userid`` in preparation for
  Pyramid 2.0 where it is deprecated.

- Catch a ``ValueError`` when JSON-serializing SQLA objects for display.
  See https://github.com/Pylons/pyramid_debugtoolbar/pull/357

4.5.1 (2019-11-08)
------------------

- Add Python 3.8 support.

- Fix internal deprecation warnings on Python 3.7.

4.5 (2018-09-09)
----------------

- Drop Python 3.3 support to align with Pyramid and its EOL.

- Add support for testing on Python 3.7.

- Add a list of engines to the SQLAlchemy panel if queries come from
  multiple engines.
  See https://github.com/Pylons/pyramid_debugtoolbar/pull/334

- When the toolbar intercepts an exception via
  ``debugtoolbar.intercept_exc = True`` and returns the interactive
  debugger, it will add ``request.exception`` and ``request.exc_info`` to
  the request to indicate what exception triggered the response. This helps
  upstream tweens such as ``pyramid_retry`` to possibly retry the requests.
  See https://github.com/Pylons/pyramid_debugtoolbar/pull/343

- Stop parsing the ``request.remote_addr`` value when it contains chain of
  comma-separated ip-addresses. Reject these values and emit a warning
  to sanitize the value upstream.
  See https://github.com/Pylons/pyramid_debugtoolbar/pull/342


4.4 (2018-02-19)
----------------

- Reduce the log output for squashed exceptions and put them at the INFO
  level so they can be filtered out if desired.
  See https://github.com/Pylons/pyramid_debugtoolbar/pull/328 and
  https://github.com/Pylons/pyramid_debugtoolbar/pull/329

4.3.1 (2018-01-28)
------------------

- Javascript syntax fixes for browsers that don't support trailing commas.
  See https://github.com/Pylons/pyramid_debugtoolbar/pull/326

4.3 (2017-07-14)
----------------

- The logging panel indicator is now color-coded to indicate the severity of
  the log messages as well as the number of messages at said level. There may
  be more messages, but the most severe show up in the annotation.

  This feature also added a new ``nav_subtitle_style`` hook to the
  ``DebugPanel`` API for adding a custom CSS class to the subtitle tag.

  See https://github.com/Pylons/pyramid_debugtoolbar/pull/322

4.2.1 (2017-06-30)
------------------

- Fix a bug with the logging of squashed exceptions on Python < 3.5.
  See https://github.com/Pylons/pyramid_debugtoolbar/pull/320

4.2 (2017-06-21)
----------------

This release contains a rewrite of the underlying exception / traceback
tracking machinery and fixes regressions caused by the 4.1 release that
broke the interactive debugger.
See https://github.com/Pylons/pyramid_debugtoolbar/pull/318

- Tracebacks are now tied to the per-request toolbar object one-to-one.
  A request may have only one traceback. Previously they actually stuck
  around for the entire lifetime of the app instead of being collected by
  the max_request_history setting.

- The routes for exceptions are standardized to look similar to the SQLA AJAX
  routes. For example, ``/{request_id}/exception`` instead of
  ``/exception?token=...&tb=...`` and
  ``/{request_id}/exception/execute/{frame_id}?cmd=...`` instead of
  ``/exception?token=...&tb=...&frm=...&cmd=...``.

- Fixed the url generation for the traceback panel link at the bottom of the
  traceback... it was actually empty previously - it got lost somewhere along
  the way.

- /favicon.ico is no longer specially handled.. it's just part of
  ``exclude_prefixes`` like anything else that you want to exclude.

- ``request.pdtb_history`` is available for toolbar requests (mostly AJAX
  requests or panel rendering).

- Removed the unused history predicate.

- URL generation was broken in the ``debugger.js`` but that's fixed now so the
  execute/source buttons work in tracebacks.

- Drop the license from ``LICENSE.txt`` for the removed ipaddr module in 4.1.
  See https://github.com/Pylons/pyramid_debugtoolbar/pull/315

4.1 (2017-05-30)
----------------

- Debug squashed exceptions! If you register an exception view for an exception
  it will render a response. The toolbar will see the squashed exception and
  enable the ``Traceback`` tab in the toolbar and emit a message on the
  console with the URL. You can then debug t