API Reference¶
Debugging tools for Python.
This module provides functions to set up debugging tools like PuDB and Rich Traceback. It checks for the availability of these tools and configures them accordingly.
Importing this module will install the debugging tools based on the configuration. Example usage:
This will install the debugging tools and put debug breakpoint at this line.
Another way to use this module is to run the desired script or module with the
dojo
command-line interface.
Debugging tools for Python.
This module provides functions to set up debugging tools like PuDB and Rich Traceback. It checks for the availability of these tools and configures them accordingly.
install_by_config(config)
¶
Utilities for side-by-side inspection and comparison of Python objects using Rich.
This module provides functions to display attributes and methods of two objects in a visually appealing, side-by-side format in the terminal.
inspect_objects_side_by_side(obj1, obj2)
¶
Display two Python objects side-by-side in the terminal using Rich.
Showing their attributes and methods in a simplified, aligned format.
Source code in src/debug_dojo/_compareres.py
Debug Dojo configuration module.
It includes configurations for different debuggers, exception handling, and features that can be enabled or disabled.
__filter_pydantic_error_msg(error)
¶
Filter out specific lines from a Pydantic validation error.
Source code in src/debug_dojo/_config.py
load_config(config_path=None, *, verbose=False, debugger=None)
¶
Load the Debug Dojo configuration and return a DebugDojoConfig instance.
Source code in src/debug_dojo/_config.py
load_raw_config(config_path)
¶
Load the Debug Dojo configuration from a file.
Currently supports ‘dojo.toml’ or ‘pyproject.toml’. If no path is provided, it checks the current directory for these files.
Source code in src/debug_dojo/_config.py
resolve_config_path(config_path)
¶
Resolve the configuration path, returning a default if none is provided.
Source code in src/debug_dojo/_config.py
BaseConfig
¶
DebugDojoConfigV1
¶
Bases: BaseModel
Configuration for Debug Dojo.
Source code in src/debug_dojo/_config_models.py
debugger = DebuggerType.PUDB
class-attribute
instance-attribute
¶
The type of debugger to use.
features = Features()
class-attribute
instance-attribute
¶
Features to install for debugging.
update()
¶
Update the configuration to the latest version.
Source code in src/debug_dojo/_config_models.py
DebugDojoConfigV2
¶
Bases: BaseModel
Configuration for Debug Dojo.
Source code in src/debug_dojo/_config_models.py
DebuggerType
¶
DebuggersConfig
¶
Bases: BaseConfig
Configuration for debuggers.
Source code in src/debug_dojo/_config_models.py
debugpy = DebugpyConfig()
class-attribute
instance-attribute
¶
Configuration for debugpy debugger.
default = DebuggerType.IPDB
class-attribute
instance-attribute
¶
Default debugger to use.
ipdb = IpdbConfig()
class-attribute
instance-attribute
¶
Configuration for ipdb debugger.
prompt_name = 'debug-dojo> '
class-attribute
instance-attribute
¶
Prompt name for the debugger, used in the REPL.
DebugpyConfig
¶
Bases: BaseConfig
Configuration for debugpy debugger.
Source code in src/debug_dojo/_config_models.py
host = 'localhost'
class-attribute
instance-attribute
¶
Host for debugpy debugger.
log_to_file = False
class-attribute
instance-attribute
¶
Whether to log debugpy output to a file.
port = 1992
class-attribute
instance-attribute
¶
Port for debugpy debugger.
wait_for_client = True
class-attribute
instance-attribute
¶
Whether to wait for the client to connect before starting debugging.
ExceptionsConfig
¶
Bases: BaseConfig
Configuration for exceptions handling.
Source code in src/debug_dojo/_config_models.py
locals_in_traceback = False
class-attribute
instance-attribute
¶
Include local variables in traceback.
post_mortem = True
class-attribute
instance-attribute
¶
Enable post-mortem debugging after an exception.
rich_traceback = True
class-attribute
instance-attribute
¶
Enable rich traceback for better error reporting.
Features
¶
Bases: BaseModel
Configuration for installing debug features.
Source code in src/debug_dojo/_config_models.py
breakpoint = True
class-attribute
instance-attribute
¶
Install breakpoint as ‘b’ for setting breakpoints in code.
comparer = True
class-attribute
instance-attribute
¶
Install comparer as ‘c’ for side-by-side object comparison.
rich_inspect = True
class-attribute
instance-attribute
¶
Install rich inspect as ‘i’ for enhanced object inspection.
rich_print = True
class-attribute
instance-attribute
¶
Install rich print as ‘p’ for enhanced printing.
rich_traceback = True
class-attribute
instance-attribute
¶
Install rich traceback for better error reporting.
FeaturesConfig
¶
Bases: BaseConfig
Configuration for installing debug features.
Source code in src/debug_dojo/_config_models.py
breakpoint = 'b'
class-attribute
instance-attribute
¶
Install breakpoint as ‘b’ for setting breakpoints in code.
comparer = 'c'
class-attribute
instance-attribute
¶
Install comparer as ‘c’ for side-by-side object comparison.
rich_inspect = 'i'
class-attribute
instance-attribute
¶
Install rich inspect as ‘i’ for enhanced object inspection.
rich_print = 'p'
class-attribute
instance-attribute
¶
Install rich print as ‘p’ for enhanced printing.
IpdbConfig
¶
Bases: BaseConfig
Configuration for ipdb debugger.
Source code in src/debug_dojo/_config_models.py
context_lines = 20
class-attribute
instance-attribute
¶
Number of context lines to show in ipdb.
Command-line interface for running Python scripts or modules with debugging tools.
display_config(config)
¶
Display the configuration for the debug dojo.
execute_with_debug(target_name, target_args, *, target_is_module, verbose, config)
¶
Execute a target script or module with installation of debugging tools.
Source code in src/debug_dojo/_cli.py
main()
¶
run_debug(ctx, target_name=None, *, config_path=None, debugger=None, verbose=False, module=False)
¶
Run the command-line interface.