Comprehensive Python debugger backend for IDEs with remote debugging, breakpoints, variable inspection, and performance optimizations
npx @tessl/cli install tessl/pypi-pydevd@3.3.0A comprehensive Python debugger backend that serves as the core debugging engine for multiple popular IDEs including PyDev for Eclipse, PyCharm, and VSCode Python extensions. PyDevD provides advanced debugging capabilities including remote debugging, breakpoint management, variable inspection, step-by-step execution control, and frame evaluation with optimized performance through Cython speedups and Python 3.12 sys.monitoring support.
pip install pydevdimport pydevdFor file utilities:
import pydevd_file_utilsFor interactive console:
import pydevconsoleFor programmatic API control:
from _pydevd_bundle.pydevd_api import PyDevdAPIimport pydevd
# Connect to debugger server (typically running in IDE)
pydevd.settrace('localhost', port=5678)
# Your code here - execution will pause at first line
x = 42
y = x * 2
print(f"Result: {y}")
# Stop debugging
pydevd.stoptrace()import pydevd
# Configure debugger protocol and logging
pydevd.config(protocol='http', debug_mode='True')
pydevd.log_to('/path/to/debugger.log', log_level=2)
# Start debugging with custom settings
pydevd.settrace(
host='192.168.1.100',
port=5678,
suspend=True,
trace_only_current_thread=False,
patch_multiprocessing=True
)PyDevD follows a modular architecture designed for flexibility and performance:
pydevd.py): Main debugging session management and control interfaceThis design enables PyDevD to serve as the universal debugging backend for Python development across different IDEs and environments.
Primary debugging functionality including session management, tracing control, configuration, and logging. These functions provide the main interface for starting, stopping, and configuring debugging sessions.
def settrace(host=None, stdout_to_server=False, stderr_to_server=False, port=5678, suspend=True, trace_only_current_thread=False, overwrite_prev_trace=False, patch_multiprocessing=False, stop_at_frame=None, block_until_connected=True, wait_for_ready_to_run=True, dont_trace_start_patterns=(), dont_trace_end_patterns=(), access_token=None, client_access_token=None, notify_stdin=True, protocol=None, **kwargs): ...
def stoptrace(): ...
def config(protocol="", debug_mode="", preimport=""): ...
def log_to(log_file: str, log_level=3): ...Cross-platform file path handling, normalization, and client-server path translation for remote debugging scenarios. Essential for handling source file references across different environments.
def canonical_normalized_path(filename): ...
def absolute_path(filename): ...
def normcase(s): ...
def get_client_filename_source_reference(client_filename): ...
def get_server_filename_from_source_reference(source_reference): ...Interactive debugging console interface for code evaluation and inspection during debugging sessions. Provides REPL-like functionality within the debugging context.
class Command: ...
# Console classes from _pydevd_bundle.pydevconsole_codeAdvanced programmatic interface for controlling debugger behavior, managing breakpoints, and handling debugging events. Used by IDEs and tools that need fine-grained control over debugging sessions.
class PyDevdAPI:
def add_breakpoint(self, py_db, original_filename, breakpoint_type, breakpoint_id, line, condition, func_name, expression, suspend_policy, hit_condition, is_logpoint, adjust_line=False, on_changed_breakpoint_state=None): ...
def remove_breakpoint(self, py_db, received_filename, breakpoint_type, breakpoint_id): ...
# Additional API methods for thread control, variable inspection, and debuggingRemote process attachment and code injection capabilities for debugging already-running Python processes. Enables debugging scenarios where the target process wasn't started with debugging enabled.
# Functions from pydevd_attach_to_process.add_code_to_python_process
def run_python_code(pid, python_code, connect_debugger_tracing=False, show_debug_info=0): ...Plugin system for framework-specific debugging support including Django templates, Jinja2 templates, and custom debugging extensions. Provides specialized debugging capabilities for web frameworks and template engines.
# Django debugging support
# Jinja2 template debugging support
# Custom plugin extension frameworkIntegration with IPython kernels and GUI toolkits for debugging interactive computing environments. Supports matplotlib, Qt applications, and other GUI frameworks commonly used in scientific computing.
# IPython kernel integration
# GUI toolkit event loop management
# Matplotlib integration utilitiesclass PyDB:
"""Main debugging session management class."""
def __init__(self, set_as_global=True): ...
def trace_dispatch(self, frame, event, arg): ...
def set_suspend(self, thread, stop_reason): ...
def do_wait_suspend(self, thread, frame, event, arg): ...
class SetupHolder:
"""Debugger configuration holder."""
setup: dict
class DebugInfoHolder:
"""Debug configuration and state container."""
default_stop_on_unhandled_exception: bool
default_stop_on_handled_exception: boolclass ExceptionBreakpoint:
"""Exception breakpoint configuration."""
def __init__(self, qname, condition, expression, notify_on_handled_exceptions, notify_on_unhandled_exceptions, notify_on_first_raise_only): ...
class LineBreakpoint:
"""Line-based breakpoint configuration."""
def __init__(self, line, condition, expression, suspend_policy, hit_condition, is_logpoint): ...# Debugger states
STATE_RUN = 1
STATE_SUSPEND = 2
# Suspend types
PYTHON_SUSPEND = 1
DJANGO_SUSPEND = 2
JINJA2_SUSPEND = 3
# Platform detection
IS_CPYTHON: bool
IS_IRONPYTHON: bool
IS_WINDOWS: bool
IS_LINUX: bool
IS_MAC: bool
# Configuration limits
MAXIMUM_VARIABLE_REPRESENTATION_SIZE = 1000