debug-dojo 0.2.0__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  ## v0.2.0 (2025-07-20)
2
2
 
3
- *release tag*: [v0.2.0](https://github.com/pydantic/pydantic/releases/tag/v2.11.6)
3
+ *release tag*: [v0.2.0]
4
4
 
5
5
  ### What's Changed
6
6
 
@@ -13,9 +13,9 @@
13
13
 
14
14
  - Fixed `pyproject.toml` to point to GitHub repository as the homepage.
15
15
 
16
- ## v0.1.0 (2025-07-20)
16
+ ## v0.1.0 (2025-07-19)
17
17
 
18
- *release tag*: [v0.1.0](https://github.com/pydantic/pydantic/releases/tag/v2.11.6)
18
+ *release tag*: [v0.1.0]
19
19
 
20
20
  ### What's Changed
21
21
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: debug-dojo
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: Debbugging dojo for Python developers
5
5
  Project-URL: Homepage, https://github.com/bwrob/debug-dojo
6
6
  Project-URL: Documentation, https://github.com/bwrob/debug-dojo/blob/main/README.md
@@ -22,26 +22,39 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
22
  Requires-Python: >=3.10
23
23
  Requires-Dist: pudb>=2020.1
24
24
  Requires-Dist: rich>=11.0.0
25
+ Requires-Dist: typer>=0.15.0
25
26
  Description-Content-Type: text/markdown
26
27
 
27
- # debug-dojo
28
+ <p align="center">
29
+ <img src="https://github.com/bwrob/debug-dojo/blob/main/logo/logo_white.png?raw=true" alt="debug dojo" style="width:50%; max-width:400px;"/>
30
+ </p>
31
+
32
+ <p align="center">
33
+ <em>debug dojo, a place for zen debugging</em>
34
+ </p>
35
+
36
+ [![PyPi Version](https://img.shields.io/pypi/v/debug-dojo.svg?style=flat-square)](https://pypi.org/project/debug-dojo)
37
+ [![PyPI pyversions](https://img.shields.io/pypi/pyversions/debug-dojo.svg?style=flat-square)](https://pypi.org/pypi/debug-dojo/)
28
38
 
29
39
  **debug-dojo** is a Python package providing utilities for enhanced debugging and inspection in the terminal. It leverages [`rich`](https://github.com/Textualize/rich) for beautiful output and offers helpers for side-by-side object comparison, improved tracebacks from `rich`, and easy integration with PuDB. All tools can be installed at once or individually, allowing for flexible debugging setups.
30
40
 
31
41
  ## Features
32
42
 
43
+ - **Convenient CLI** Quickly run your code with debugging tools enabled.
33
44
  - **Simple API:** Install all tools or only what you need.
34
45
  - **PuDB integration:** Quickly enable the PuDB TUI debugger.
35
46
  - **Rich tracebacks:** Get readable, colorized tracebacks for easier debugging.
36
47
  - **Side-by-side object inspection:** Visually compare Python objects, their attributes, and methods in the terminal.
37
48
 
38
- ## Installation
49
+ ## Usage
39
50
 
40
- ```sh
41
- pip install debug-dojo
42
- ```
51
+ ### CLI
43
52
 
44
- ## Usage
53
+ Run your Python script with debugging tools enabled using the `debug-dojo` command:
54
+
55
+ ```console
56
+ dojo my_script.py
57
+ ```
45
58
 
46
59
  ### Install all debugging tools
47
60
 
@@ -50,6 +63,7 @@ In the `PuDB` style, you can install all debugging tools and enter the debugging
50
63
  ```python
51
64
  import debug_dojo.all; b()
52
65
 
66
+ p(object_1) # Pretty print an object with Rich
53
67
  i(object_1) # Inspect an object
54
68
  c(object_1, object_2) # Compare two objects side-by-side
55
69
  ```
@@ -57,7 +71,8 @@ c(object_1, object_2) # Compare two objects side-by-side
57
71
  Where:
58
72
 
59
73
  - `b()` is a builtin-injected function that sets a breakpoint using PuDB's `set_trace()`.
60
- - `i(object_1)` to inspect an object.
74
+ - `p(object_1)` is pretty printing of an object using Rich.
75
+ - `i(object_1)` to inspect an object using Rich.
61
76
  - `c(object_1, object_2)` to compare two objects side-by-side.
62
77
 
63
78
  ### Use individual tools
@@ -80,17 +95,32 @@ b = [1, 2, 3]
80
95
  inspect_objects_side_by_side(a, b)
81
96
  ```
82
97
 
83
- ## Development
84
98
 
85
- ### Run tests
99
+ ## Installation
86
100
 
87
- ```sh
88
- pytest
101
+ The package is available on PyPI and can be installed using standard Python package management tools.
102
+
103
+ ```console
104
+ pip install debug-dojo
105
+ ```
106
+
107
+ You can also use `poetry` or `uv` to add it to your project:
108
+
109
+ ```console
110
+ poetry add debug-dojo
89
111
  ```
90
112
 
113
+ ```console
114
+ uv add debug-dojo
115
+ ```
116
+
117
+ Note that dojo most likely will not work when installed via `pipx` or `uvx`, as it relies on the current Python environment dependencies.
118
+
119
+ ## Development
120
+
91
121
  ### Lint and type check
92
122
 
93
- ```sh
123
+ ```console
94
124
  ruff check src/debug_dojo --fix
95
125
  basedpyright src/debug_dojo
96
126
  ```
@@ -100,7 +130,7 @@ basedpyright src/debug_dojo
100
130
 
101
131
  ## v0.2.0 (2025-07-20)
102
132
 
103
- *release tag*: [v0.2.0](https://github.com/pydantic/pydantic/releases/tag/v2.11.6)
133
+ *release tag*: [v0.2.0]
104
134
 
105
135
  ### What's Changed
106
136
 
@@ -113,9 +143,9 @@ basedpyright src/debug_dojo
113
143
 
114
144
  - Fixed `pyproject.toml` to point to GitHub repository as the homepage.
115
145
 
116
- ## v0.1.0 (2025-07-20)
146
+ ## v0.1.0 (2025-07-19)
117
147
 
118
- *release tag*: [v0.1.0](https://github.com/pydantic/pydantic/releases/tag/v2.11.6)
148
+ *release tag*: [v0.1.0]
119
149
 
120
150
  ### What's Changed
121
151
 
@@ -1,21 +1,33 @@
1
- # debug-dojo
1
+ <p align="center">
2
+ <img src="https://github.com/bwrob/debug-dojo/blob/main/logo/logo_white.png?raw=true" alt="debug dojo" style="width:50%; max-width:400px;"/>
3
+ </p>
4
+
5
+ <p align="center">
6
+ <em>debug dojo, a place for zen debugging</em>
7
+ </p>
8
+
9
+ [![PyPi Version](https://img.shields.io/pypi/v/debug-dojo.svg?style=flat-square)](https://pypi.org/project/debug-dojo)
10
+ [![PyPI pyversions](https://img.shields.io/pypi/pyversions/debug-dojo.svg?style=flat-square)](https://pypi.org/pypi/debug-dojo/)
2
11
 
3
12
  **debug-dojo** is a Python package providing utilities for enhanced debugging and inspection in the terminal. It leverages [`rich`](https://github.com/Textualize/rich) for beautiful output and offers helpers for side-by-side object comparison, improved tracebacks from `rich`, and easy integration with PuDB. All tools can be installed at once or individually, allowing for flexible debugging setups.
4
13
 
5
14
  ## Features
6
15
 
16
+ - **Convenient CLI** Quickly run your code with debugging tools enabled.
7
17
  - **Simple API:** Install all tools or only what you need.
8
18
  - **PuDB integration:** Quickly enable the PuDB TUI debugger.
9
19
  - **Rich tracebacks:** Get readable, colorized tracebacks for easier debugging.
10
20
  - **Side-by-side object inspection:** Visually compare Python objects, their attributes, and methods in the terminal.
11
21
 
12
- ## Installation
22
+ ## Usage
13
23
 
14
- ```sh
15
- pip install debug-dojo
16
- ```
24
+ ### CLI
17
25
 
18
- ## Usage
26
+ Run your Python script with debugging tools enabled using the `debug-dojo` command:
27
+
28
+ ```console
29
+ dojo my_script.py
30
+ ```
19
31
 
20
32
  ### Install all debugging tools
21
33
 
@@ -24,6 +36,7 @@ In the `PuDB` style, you can install all debugging tools and enter the debugging
24
36
  ```python
25
37
  import debug_dojo.all; b()
26
38
 
39
+ p(object_1) # Pretty print an object with Rich
27
40
  i(object_1) # Inspect an object
28
41
  c(object_1, object_2) # Compare two objects side-by-side
29
42
  ```
@@ -31,7 +44,8 @@ c(object_1, object_2) # Compare two objects side-by-side
31
44
  Where:
32
45
 
33
46
  - `b()` is a builtin-injected function that sets a breakpoint using PuDB's `set_trace()`.
34
- - `i(object_1)` to inspect an object.
47
+ - `p(object_1)` is pretty printing of an object using Rich.
48
+ - `i(object_1)` to inspect an object using Rich.
35
49
  - `c(object_1, object_2)` to compare two objects side-by-side.
36
50
 
37
51
  ### Use individual tools
@@ -54,17 +68,32 @@ b = [1, 2, 3]
54
68
  inspect_objects_side_by_side(a, b)
55
69
  ```
56
70
 
57
- ## Development
58
71
 
59
- ### Run tests
72
+ ## Installation
60
73
 
61
- ```sh
62
- pytest
74
+ The package is available on PyPI and can be installed using standard Python package management tools.
75
+
76
+ ```console
77
+ pip install debug-dojo
78
+ ```
79
+
80
+ You can also use `poetry` or `uv` to add it to your project:
81
+
82
+ ```console
83
+ poetry add debug-dojo
63
84
  ```
64
85
 
86
+ ```console
87
+ uv add debug-dojo
88
+ ```
89
+
90
+ Note that dojo most likely will not work when installed via `pipx` or `uvx`, as it relies on the current Python environment dependencies.
91
+
92
+ ## Development
93
+
65
94
  ### Lint and type check
66
95
 
67
- ```sh
96
+ ```console
68
97
  ruff check src/debug_dojo --fix
69
98
  basedpyright src/debug_dojo
70
99
  ```
Binary file
Binary file
@@ -5,7 +5,11 @@
5
5
  { name = "bwrob", email = "bartosz.marcin.wroblewski@gmail.com" },
6
6
  ]
7
7
  requires-python = ">=3.10"
8
- dependencies = ["pudb>=2020.1", "rich>=11.0.0"]
8
+ dependencies = [
9
+ "pudb>=2020.1",
10
+ "rich>=11.0.0",
11
+ "typer>=0.15.0",
12
+ ]
9
13
  license = 'MIT'
10
14
  license-files = ['LICENSE']
11
15
  keywords = [
@@ -28,7 +32,8 @@
28
32
  "Topic :: Software Development :: Debuggers",
29
33
  "Topic :: Software Development :: Libraries :: Python Modules",
30
34
  ]
31
- dynamic = ['readme', 'version']
35
+ version = "0.3.0"
36
+ dynamic = ['readme']
32
37
 
33
38
  [project.urls]
34
39
  Homepage = "https://github.com/bwrob/debug-dojo"
@@ -39,7 +44,7 @@
39
44
  [project.scripts]
40
45
  # This defines your command-line script!
41
46
  # It points to the 'main' function in your 'cli' module.
42
- "dojo" = "debug_dojo.cli:main"
47
+ "dojo" = "debug_dojo._cli:main"
43
48
 
44
49
  [dependency-groups]
45
50
  dev = ["basedpyright>=1.31.0", "ruff>=0.12.4"]
@@ -0,0 +1,76 @@
1
+ """Command-line interface for running Python scripts or modules with debugging tools."""
2
+
3
+ import os
4
+ import runpy
5
+ import sys
6
+ from bdb import BdbQuit
7
+ from pathlib import Path
8
+ from typing import Annotated
9
+
10
+ import typer
11
+ from rich import print as rich_print
12
+
13
+ from .installers import install_all
14
+
15
+ cli = typer.Typer(
16
+ name="debug_dojo",
17
+ help="Run a Python script or module with debugging tools installed.",
18
+ no_args_is_help=True,
19
+ )
20
+
21
+
22
+ def execute_with_debug(target_name: str, args_for_target: list[str]) -> None:
23
+ """Execute a target script or module with installation of debugging tools."""
24
+ sys.argv = [target_name, *args_for_target]
25
+
26
+ install_all()
27
+
28
+ if (
29
+ Path(target_name).exists()
30
+ or target_name.endswith(".py")
31
+ or os.sep in target_name
32
+ ):
33
+ if not Path(target_name).exists():
34
+ sys.exit(1)
35
+ runner = runpy.run_path
36
+ else:
37
+ runner = runpy.run_module
38
+
39
+ _ = runner(target_name, run_name="__main__")
40
+
41
+
42
+ @cli.command(
43
+ name="",
44
+ context_settings={
45
+ "allow_extra_args": True,
46
+ "ignore_unknown_options": True,
47
+ },
48
+ )
49
+ def main(
50
+ ctx: typer.Context,
51
+ target_name: Annotated[
52
+ str,
53
+ typer.Argument(
54
+ ...,
55
+ help="The target script or module to debug. Provide the path or module name.",
56
+ ),
57
+ ],
58
+ ) -> None:
59
+ """Run the command-line interface."""
60
+ args_for_target = ctx.args
61
+ try:
62
+ execute_with_debug(target_name, args_for_target)
63
+ except BdbQuit:
64
+ rich_print("[red]Debugging session terminated by user.[/red]")
65
+ sys.exit(0)
66
+
67
+
68
+ @cli.command("config")
69
+ def config() -> None:
70
+ """Display the configuration for the debug dojo."""
71
+ rich_print("[green]Debug Dojo Configuration:[/green]")
72
+ rich_print("This tool installs debugging tools and runs Python scripts or modules.")
73
+ rich_print(
74
+ "You can specify a target script or module to debug, along with any arguments."
75
+ )
76
+ rich_print("Example usage: `debug_dojo target_to_debug.py --some-input-to-target`")
@@ -66,8 +66,7 @@ def install_breakpoint() -> None:
66
66
 
67
67
 
68
68
  def install_rich_print() -> None:
69
- """Install the breakpoint function."""
70
- # Set the breakpoint function to use PuDB's set_trace
69
+ """Install the print from rich."""
71
70
  builtins.p = rich_print # pyright: ignore[reportAttributeAccessIssue]
72
71
 
73
72
 
@@ -14,6 +14,18 @@ wheels = [
14
14
  { url = "https://files.pythonhosted.org/packages/5a/85/cb46707458c514ae959fe139135d8f7231d95faf1c383a56979a3436b965/basedpyright-1.31.0-py3-none-any.whl", hash = "sha256:d7460ddcd3a2332b1c3fd738735d18bf2966d49aed67237efa1f19635199d414", size = 11538999, upload-time = "2025-07-16T11:37:26.446Z" },
15
15
  ]
16
16
 
17
+ [[package]]
18
+ name = "click"
19
+ version = "8.2.1"
20
+ source = { registry = "https://pypi.org/simple" }
21
+ dependencies = [
22
+ { name = "colorama", marker = "sys_platform == 'win32'" },
23
+ ]
24
+ sdist = { url = "https://files.pythonhosted.org/packages/60/6c/8ca2efa64cf75a977a0d7fac081354553ebe483345c734fb6b6515d96bbc/click-8.2.1.tar.gz", hash = "sha256:27c491cc05d968d271d5a1db13e3b5a184636d9d930f148c50b038f0d0646202", size = 286342, upload-time = "2025-05-20T23:19:49.832Z" }
25
+ wheels = [
26
+ { url = "https://files.pythonhosted.org/packages/85/32/10bb5764d90a8eee674e9dc6f4db6a0ab47c8c4d0d83c27f7c39ac415a4d/click-8.2.1-py3-none-any.whl", hash = "sha256:61a3265b914e850b85317d0b3109c7f8cd35a670f963866005d6ef1d5175a12b", size = 102215, upload-time = "2025-05-20T23:19:47.796Z" },
27
+ ]
28
+
17
29
  [[package]]
18
30
  name = "colorama"
19
31
  version = "0.4.6"
@@ -34,10 +46,12 @@ wheels = [
34
46
 
35
47
  [[package]]
36
48
  name = "debug-dojo"
49
+ version = "0.3.0"
37
50
  source = { editable = "." }
38
51
  dependencies = [
39
52
  { name = "pudb" },
40
53
  { name = "rich" },
54
+ { name = "typer" },
41
55
  ]
42
56
 
43
57
  [package.dev-dependencies]
@@ -50,6 +64,7 @@ dev = [
50
64
  requires-dist = [
51
65
  { name = "pudb", specifier = ">=2020.1" },
52
66
  { name = "rich", specifier = ">=11.0.0" },
67
+ { name = "typer", specifier = ">=0.15.0" },
53
68
  ]
54
69
 
55
70
  [package.metadata.requires-dev]
@@ -168,6 +183,39 @@ wheels = [
168
183
  { url = "https://files.pythonhosted.org/packages/11/02/8857d0dfb8f44ef299a5dfd898f673edefb71e3b533b3b9d2db4c832dd13/ruff-0.12.4-py3-none-win_arm64.whl", hash = "sha256:0618ec4442a83ab545e5b71202a5c0ed7791e8471435b94e655b570a5031a98e", size = 10469336, upload-time = "2025-07-17T17:27:16.913Z" },
169
184
  ]
170
185
 
186
+ [[package]]
187
+ name = "shellingham"
188
+ version = "1.5.4"
189
+ source = { registry = "https://pypi.org/simple" }
190
+ sdist = { url = "https://files.pythonhosted.org/packages/58/15/8b3609fd3830ef7b27b655beb4b4e9c62313a4e8da8c676e142cc210d58e/shellingham-1.5.4.tar.gz", hash = "sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de", size = 10310, upload-time = "2023-10-24T04:13:40.426Z" }
191
+ wheels = [
192
+ { url = "https://files.pythonhosted.org/packages/e0/f9/0595336914c5619e5f28a1fb793285925a8cd4b432c9da0a987836c7f822/shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686", size = 9755, upload-time = "2023-10-24T04:13:38.866Z" },
193
+ ]
194
+
195
+ [[package]]
196
+ name = "typer"
197
+ version = "0.16.0"
198
+ source = { registry = "https://pypi.org/simple" }
199
+ dependencies = [
200
+ { name = "click" },
201
+ { name = "rich" },
202
+ { name = "shellingham" },
203
+ { name = "typing-extensions" },
204
+ ]
205
+ sdist = { url = "https://files.pythonhosted.org/packages/c5/8c/7d682431efca5fd290017663ea4588bf6f2c6aad085c7f108c5dbc316e70/typer-0.16.0.tar.gz", hash = "sha256:af377ffaee1dbe37ae9440cb4e8f11686ea5ce4e9bae01b84ae7c63b87f1dd3b", size = 102625, upload-time = "2025-05-26T14:30:31.824Z" }
206
+ wheels = [
207
+ { url = "https://files.pythonhosted.org/packages/76/42/3efaf858001d2c2913de7f354563e3a3a2f0decae3efe98427125a8f441e/typer-0.16.0-py3-none-any.whl", hash = "sha256:1f79bed11d4d02d4310e3c1b7ba594183bcedb0ac73b27a9e5f28f6fb5b98855", size = 46317, upload-time = "2025-05-26T14:30:30.523Z" },
208
+ ]
209
+
210
+ [[package]]
211
+ name = "typing-extensions"
212
+ version = "4.14.1"
213
+ source = { registry = "https://pypi.org/simple" }
214
+ sdist = { url = "https://files.pythonhosted.org/packages/98/5a/da40306b885cc8c09109dc2e1abd358d5684b1425678151cdaed4731c822/typing_extensions-4.14.1.tar.gz", hash = "sha256:38b39f4aeeab64884ce9f74c94263ef78f3c22467c8724005483154c26648d36", size = 107673, upload-time = "2025-07-04T13:28:34.16Z" }
215
+ wheels = [
216
+ { url = "https://files.pythonhosted.org/packages/b5/00/d631e67a838026495268c2f6884f3711a15a9a2a96cd244fdaea53b823fb/typing_extensions-4.14.1-py3-none-any.whl", hash = "sha256:d1e1e3b58374dc93031d6eda2420a48ea44a36c2b4766a4fdeb3710755731d76", size = 43906, upload-time = "2025-07-04T13:28:32.743Z" },
217
+ ]
218
+
171
219
  [[package]]
172
220
  name = "urwid"
173
221
  version = "3.0.2"
@@ -1,49 +0,0 @@
1
- """Command-line interface for running Python scripts or modules with debugging tools."""
2
-
3
- import os
4
- import runpy
5
- import sys
6
- from bdb import BdbQuit
7
- from pathlib import Path
8
-
9
- from rich import print as rich_print
10
-
11
- from .installers import install_all
12
-
13
-
14
- def execute_with_debug(target_name: str, args_for_target: list[str]) -> None:
15
- """Execute a target script or module with installation of debugging tools."""
16
- sys.argv = [target_name, *args_for_target]
17
-
18
- install_all()
19
-
20
- if (
21
- Path(target_name).exists()
22
- or target_name.endswith(".py")
23
- or os.sep in target_name
24
- ):
25
- if not Path(target_name).exists():
26
- sys.exit(1)
27
- runner = runpy.run_path
28
- else:
29
- runner = runpy.run_module
30
-
31
- _ = runner(target_name, run_name="__main__")
32
-
33
-
34
- def main() -> None:
35
- """Run the command-line interface."""
36
- if len(sys.argv) < 2:
37
- rich_print(
38
- "[red]No target specified. Example usage: \n"
39
- + "dojo target_to_debug.py --some-input-to-target[/red]"
40
- )
41
- sys.exit(1)
42
-
43
- target_name = sys.argv[1]
44
- args_for_target = sys.argv[2:]
45
- try:
46
- execute_with_debug(target_name, args_for_target)
47
- except BdbQuit:
48
- rich_print("[red]Debugging session terminated by user.[/red]")
49
- sys.exit(0)
@@ -1,3 +0,0 @@
1
- """The `version` module holds the version information for debug-dojo."""
2
-
3
- VERSION = "0.2.0"
File without changes
File without changes
File without changes
File without changes