Skip to main content

debug-toolbar

Async-native debug toolbar for Python ASGI frameworks with first-class Litestar support.

Tests And Linting Latest Release PyPI Version Python Versions License


Documentation: https://jacobcoffee.github.io/debug-toolbar

Source Code: https://github.com/JacobCoffee/debug-toolbar


Screenshots

Debug Toolbar - Right Position

More Screenshots

Full-Width Top Position

Debug Toolbar - Top Position

SQL Queries with EXPLAIN

Debug Toolbar - SQL Queries

EXPLAIN Query Plan Modal

Debug Toolbar - EXPLAIN Modal

Light Theme

Debug Toolbar - Light Theme

Request History

Debug Toolbar - Request History

Events Panel (Lifecycle Hooks)

Debug Toolbar - Events Panel

N+1 Query Detection

Debug Toolbar - N+1 Detection

Alerts Panel (Proactive Issue Detection)

Debug Toolbar - Alerts Panel

MCP Integration (Claude Code)

Debug Toolbar - MCP Integration with Claude Code

Memory Panel

Debug Toolbar - Memory Panel

SQL Panel with Query Analysis

Debug Toolbar - SQL Panel

Profiling Panel

Debug Toolbar - Profiling Panel

WebSocket Panel (Live Updates)

Debug Toolbar - WebSocket Panel

Features

  • Async-Native: Built from the ground up for async/await patterns
  • Framework-Agnostic Core: Core package works with any ASGI framework
  • Litestar Integration: First-class plugin support for Litestar applications
  • Pluggable Panels: Easy to add, remove, or customize debug panels
  • Minimal Overhead: Negligible performance impact when disabled
  • Type-Safe: Full type annotations with strict type checking
  • Dark/Light Themes: Toggle between dark and light themes
  • Flexible Positioning: Place toolbar on any edge (left, right, top, bottom)
  • SQL Query Analysis: EXPLAIN query plans for PostgreSQL, SQLite, MySQL, MariaDB
  • N+1 Detection: Automatic detection of N+1 query patterns with fix suggestions
  • Flame Graphs: Interactive profiling visualization in speedscope format
  • Memory Profiling: Multi-backend support (tracemalloc, memray)
  • Proactive Alerts: Automatic detection of security, performance, and database issues
  • MCP Integration: AI assistant integration for automated debugging with Claude Code
  • WebSocket Debugging: Real-time connection tracking with live updates and message inspection

Installation

# Core package only
pip install litestar-debug-toolbar

# With Litestar integration
pip install litestar-debug-toolbar[litestar]

# With Advanced-Alchemy SQLAlchemy panel
pip install litestar-debug-toolbar[advanced-alchemy]

# All extras
pip install litestar-debug-toolbar[all]

Or with uv:

uv add litestar-debug-toolbar[litestar]

Quick Start

Litestar

from litestar import Litestar, get
from debug_toolbar.litestar import DebugToolbarPlugin, LitestarDebugToolbarConfig

@get("/")
async def index() -> dict[str, str]:
    return {"message": "Hello, World!"}

config = LitestarDebugToolbarConfig(enabled=True)
app = Litestar(
    route_handlers=[index],
    plugins=[DebugToolbarPlugin(config)],
)

With SQLAlchemy (Advanced-Alchemy)

from litestar import Litestar
from advanced_alchemy.extensions.litestar import SQLAlchemyPlugin, SQLAlchemyAsyncConfig
from debug_toolbar.litestar import DebugToolbarPlugin, LitestarDebugToolbarConfig

db_config = SQLAlchemyAsyncConfig(connection_string="sqlite+aiosqlite:///app.db")
toolbar_config = LitestarDebugToolbarConfig(
    enabled=True,
    extra_panels=["debug_toolbar.extras.advanced_alchemy.SQLAlchemyPanel"],
)

app = Litestar(
    plugins=[
        SQLAlchemyPlugin(config=db_config),
        DebugToolbarPlugin(toolbar_config),
    ],
)

Generic ASGI

from debug_toolbar import DebugToolbar, DebugToolbarConfig

config = DebugToolbarConfig(enabled=True)
toolbar = DebugToolbar(config)

# Wrap your ASGI app
app = toolbar.wrap(your_asgi_app)

Built-in Panels

Panel Description
Timer Request timing and CPU time
Request HTTP method, path, headers, cookies
Response Status code, response headers
Logging Log records captured during request
Versions Python and package versions
Headers Categorized headers with security analysis
Settings Application configuration viewer
Templates Jinja2/Mako render tracking
Profiling cProfile/pyinstrument with flame graphs
Alerts Proactive security/performance issue detection
Memory Memory profiling (tracemalloc/memray)
Cache Redis/memcached operation tracking
Routes Application routes (Litestar-specific)
Events Lifecycle hooks and exception handlers (Litestar-specific)
WebSocket Real-time connection tracking, message inspection, live updates
SQLAlchemy Query tracking with N+1 detection (requires advanced-alchemy extra)

Configuration

from debug_toolbar.litestar import LitestarDebugToolbarConfig

config = LitestarDebugToolbarConfig(
    enabled=True,
    exclude_paths=["/_debug_toolbar", "/static", "/health"],
    max_request_history=50,
    intercept_redirects=False,
    show_toolbar_callback=lambda request: request.app.debug,
    extra_panels=["myapp.panels.CustomPanel"],
    exclude_panels=["VersionsPanel"],
)

Creating Custom Panels

from typing import Any, ClassVar
from debug_toolbar.core import Panel, RequestContext

class MyCustomPanel(Panel):
    panel_id: ClassVar[str] = "MyCustomPanel"
    title: ClassVar[str] = "My Panel"
    template: ClassVar[str] = "panels/my_panel.html"
    has_content: ClassVar[bool] = True

    async def generate_stats(self, context: RequestContext) -> dict[str, Any]:
        return {"custom_data": "Your debug information here"}

Development

# Clone the repository
git clone https://github.com/JacobCoffee/debug-toolbar.git
cd debug-toolbar

# Install dependencies
make dev

# Run tests
make test

# Run all CI checks
make ci

Package Structure

debug_toolbar/
├── core/           # Framework-agnostic core
│   ├── panels/     # Built-in panels
│   │   ├── timer.py, request.py, response.py  # Default panels
│   │   ├── headers.py, settings.py            # Optional panels
│   │   ├── profiling.py, memory/, alerts.py   # Advanced panels
│   │   ├── templates.py, cache.py             # Integration panels
│   │   └── websocket.py                       # WebSocket debugging
│   ├── config.py   # DebugToolbarConfig
│   ├── context.py  # RequestContext (contextvars-based)
│   ├── panel.py    # Panel base class
│   ├── storage.py  # LRU request history storage
│   └── toolbar.py  # DebugToolbar manager
├── litestar/       # Litestar integration
│   ├── panels/     # Litestar-specific panels (routes, events)
│   ├── config.py   # LitestarDebugToolbarConfig
│   ├── middleware.py
│   └── plugin.py   # DebugToolbarPlugin
└── extras/         # Optional integrations
    └── advanced_alchemy/  # SQLAlchemy panel with N+1 detection

Versioning

This project uses Semantic Versioning.

  • Major versions introduce breaking changes
  • Major versions support currently supported Litestar versions
  • See the Litestar Versioning Policy for details

Contributing

Contributions are welcome! Please see CONTRIBUTING.rst for guidelines.

License

MIT License - see LICENSE for details.

Acknowledgements

Inspired by:

Metadata

Release files for litestar-debug-toolbar 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for litestar-debug-toolbar 1.1.0
File Size Uploaded
litestar_debug_toolbar-1.1.0.tar.gz 118.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for litestar-debug-toolbar 1.1.0
File Interpreter ABI Platform
litestar_debug_toolbar-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 272.8 kB

Release files / litestar_debug_toolbar-1.1.0.tar.gz

Download URL litestar_debug_toolbar-1.1.0.tar.gz
Size 118.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e857ba360501aefcaa83dbaccac7b6fdf90a77f7d156c42b339996f3fe3cb9f1
BLAKE2b-256 checksum
How to use checksums
1633957ba43ccb5bb81566fadb2af1a7591d6044637121cb9872543c1c9f7c5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release files / litestar_debug_toolbar-1.1.0-py3-none-any.whl

Download URL litestar_debug_toolbar-1.1.0-py3-none-any.whl
Size 154.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4ccecf8624be50e96998d08cf009952750f2f560dc5015bb02901b497b2066ac
BLAKE2b-256 checksum
How to use checksums
df376b57db66877de1565f8507670ce20674d45531344bc5c520ce9f95ad6a48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release history Release notifications | RSS feed

1.1.1

2 release files

This release

1.1.0 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.4.2

1 release file

0.4.1

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page