debug-dojo 0.5.0__tar.gz → 0.6.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.
- debug_dojo-0.6.0/PKG-INFO +137 -0
- debug_dojo-0.6.0/README.md +105 -0
- {debug_dojo-0.5.0 → debug_dojo-0.6.0}/pyproject.toml +32 -16
- {debug_dojo-0.5.0 → debug_dojo-0.6.0}/src/debug_dojo/_cli.py +42 -9
- {debug_dojo-0.5.0 → debug_dojo-0.6.0}/src/debug_dojo/_compare.py +37 -9
- {debug_dojo-0.5.0 → debug_dojo-0.6.0}/src/debug_dojo/_config.py +77 -36
- {debug_dojo-0.5.0 → debug_dojo-0.6.0}/src/debug_dojo/_config_models.py +45 -41
- debug_dojo-0.6.0/src/debug_dojo/_installers.py +253 -0
- debug_dojo-0.6.0/src/debug_dojo.egg-info/PKG-INFO +137 -0
- {debug_dojo-0.5.0 → debug_dojo-0.6.0}/src/debug_dojo.egg-info/SOURCES.txt +4 -1
- debug_dojo-0.6.0/src/debug_dojo.egg-info/requires.txt +7 -0
- debug_dojo-0.6.0/tests/test_compare.py +75 -0
- debug_dojo-0.6.0/tests/test_config.py +81 -0
- debug_dojo-0.6.0/tests/test_installers.py +161 -0
- debug_dojo-0.5.0/PKG-INFO +0 -83
- debug_dojo-0.5.0/README.md +0 -52
- debug_dojo-0.5.0/src/debug_dojo/_installers.py +0 -182
- debug_dojo-0.5.0/src/debug_dojo.egg-info/PKG-INFO +0 -83
- debug_dojo-0.5.0/src/debug_dojo.egg-info/requires.txt +0 -7
- {debug_dojo-0.5.0 → debug_dojo-0.6.0}/LICENSE +0 -0
- {debug_dojo-0.5.0 → debug_dojo-0.6.0}/setup.cfg +0 -0
- {debug_dojo-0.5.0 → debug_dojo-0.6.0}/src/debug_dojo/__init__.py +0 -0
- {debug_dojo-0.5.0 → debug_dojo-0.6.0}/src/debug_dojo/__main__.py +0 -0
- {debug_dojo-0.5.0 → debug_dojo-0.6.0}/src/debug_dojo/install.py +0 -0
- {debug_dojo-0.5.0 → debug_dojo-0.6.0}/src/debug_dojo/py.typed +0 -0
- {debug_dojo-0.5.0 → debug_dojo-0.6.0}/src/debug_dojo.egg-info/dependency_links.txt +0 -0
- {debug_dojo-0.5.0 → debug_dojo-0.6.0}/src/debug_dojo.egg-info/entry_points.txt +0 -0
- {debug_dojo-0.5.0 → debug_dojo-0.6.0}/src/debug_dojo.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: debug-dojo
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Summary: 🏣 debug dojo, a place for zen debugging
|
|
5
|
+
Author-email: bwrob <bartosz.marcin.wroblewski@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Changelog, https://bwrob.github.io/debug-dojo/changelog/
|
|
8
|
+
Project-URL: Documentation, https://bwrob.github.io/debug-dojo/
|
|
9
|
+
Project-URL: Homepage, https://bwrob.github.io/debug-dojo/
|
|
10
|
+
Project-URL: Source, https://github.com/bwrob/debug-dojo/
|
|
11
|
+
Keywords: debugging,inspection,tools,development
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Topic :: Software Development :: Debuggers
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Requires-Python: <3.15,>=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: dacite>=1.0.0
|
|
25
|
+
Requires-Dist: debugpy>=1.0.0
|
|
26
|
+
Requires-Dist: ipdb>=0.12.0
|
|
27
|
+
Requires-Dist: pudb>=2019.1
|
|
28
|
+
Requires-Dist: rich>=10.0.0
|
|
29
|
+
Requires-Dist: tomlkit>=0.7.0
|
|
30
|
+
Requires-Dist: typer>=0.3.0
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# debug dojo
|
|
34
|
+
|
|
35
|
+
<p align="center">
|
|
36
|
+
<img src="https://github.com/bwrob/debug-dojo/blob/main/docs/logo/logo_python.png?raw=true" alt="debug dojo" style="width:50%; max-width:350px;"/>
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
<p align="center">
|
|
40
|
+
<em>🏣 debug dojo, a place for zen debugging</em>
|
|
41
|
+
</p>
|
|
42
|
+
|
|
43
|
+
<p align="center">
|
|
44
|
+
<a href="https://pypi.org/project/debug-dojo">
|
|
45
|
+
<img src="https://img.shields.io/pypi/v/debug-dojo.svg?style=flat-square" alt="PyPi Version">
|
|
46
|
+
</a>
|
|
47
|
+
<a href="https://pypi.org/pypi/debug-dojo/">
|
|
48
|
+
<img src="https://img.shields.io/pypi/pyversions/debug-dojo.svg?style=flat-square" alt="PyPI pyversions">
|
|
49
|
+
</a>
|
|
50
|
+
<a href="https://pepy.tech/project/debug-dojo">
|
|
51
|
+
<img src="https://static.pepy.tech/badge/debug-dojo/month" alt="downloads">
|
|
52
|
+
</a>
|
|
53
|
+
<a href="https://github.com/bwrob/debug-dojo/blob/main/LICENSE">
|
|
54
|
+
<img src="https://img.shields.io/github/license/bwrob/debug-dojo.svg" alt="license">
|
|
55
|
+
</a>
|
|
56
|
+
<a href="https://results.pre-commit.ci/latest/github/bwrob/debug-dojo/main">
|
|
57
|
+
<img src="https://results.pre-commit.ci/badge/github/bwrob/debug-dojo/main.svg" alt="pre-commit.ci status">
|
|
58
|
+
</a>
|
|
59
|
+
</p>
|
|
60
|
+
|
|
61
|
+
[**debug-dojo**](https://bwrob.github.io/debug-dojo/) is a powerful Python package designed to streamline your debugging workflow directly from the terminal. It integrates seamlessly with popular debuggers and enhances your inspection capabilities with beautiful, readable output.
|
|
62
|
+
|
|
63
|
+
## ✨ Features
|
|
64
|
+
|
|
65
|
+
* **Unified Debugging Interface:** Easily launch your scripts or modules with your preferred debugger (`debugpy`, `pudb`, `pdb`, `ipdb`).
|
|
66
|
+
* **Enhanced Output with Rich:** Leverages [`rich`](https://github.com/Textualize/rich) for stunning, syntax-highlighted code, pretty-printed objects, and improved tracebacks.
|
|
67
|
+
* **Side-by-Side Object Comparison:** Quickly identify differences between two Python objects.
|
|
68
|
+
* **Interactive Object Inspection:** Dive deep into object structures with a powerful `inspect` utility.
|
|
69
|
+
* **Simplified Breakpoints:** Set breakpoints effortlessly with a concise helper function.
|
|
70
|
+
|
|
71
|
+
## 🚀 Installation
|
|
72
|
+
|
|
73
|
+
Install `debug-dojo` using `pip`:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pip install debug-dojo
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
For full debugger support, you might want to install optional dependencies:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pip install "debug-dojo[all]"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## 💻 CLI Usage
|
|
86
|
+
|
|
87
|
+
Run your Python script or module with `debug-dojo`:
|
|
88
|
+
|
|
89
|
+
```console
|
|
90
|
+
dojo my_script.py
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Specify a debugger, configuration file, or enable verbose output:
|
|
94
|
+
|
|
95
|
+
```console
|
|
96
|
+
dojo --debugger ipdb --config dojo.toml --verbose --module my_module
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Run an executable command with debugging tools:
|
|
100
|
+
|
|
101
|
+
```console
|
|
102
|
+
dojo --exec pytest
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## 🐍 Usage in Code
|
|
106
|
+
|
|
107
|
+
Integrate `debug-dojo` directly into your Python code for on-demand debugging and inspection utilities:
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
import debug_dojo.install
|
|
111
|
+
|
|
112
|
+
# Set a breakpoint and enter the debugger
|
|
113
|
+
# debug_dojo.install.b() # Equivalent to breakpoint()
|
|
114
|
+
|
|
115
|
+
object_1 = {"foo": 1, "bar": 2}
|
|
116
|
+
object_2 = [1, 2, 3]
|
|
117
|
+
|
|
118
|
+
# Pretty print an object with Rich
|
|
119
|
+
debug_dojo.install.p(object_1)
|
|
120
|
+
|
|
121
|
+
# Inspect an object using Rich
|
|
122
|
+
debug_dojo.install.i(object_1)
|
|
123
|
+
|
|
124
|
+
# Compare two objects side-by-side
|
|
125
|
+
debug_dojo.install.c(object_1, object_2)
|
|
126
|
+
|
|
127
|
+
# Enter the debugger (e.g., ipdb, pudb, pdb, debugpy based on config)
|
|
128
|
+
# debug_dojo.install.b()
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## 📚 Documentation
|
|
132
|
+
|
|
133
|
+
For comprehensive instructions on installation, configuration, advanced usage, and API reference, please visit the [official documentation](https://bwrob.github.io/debug-dojo/).
|
|
134
|
+
|
|
135
|
+
## 🤝 Contributing
|
|
136
|
+
|
|
137
|
+
Contributions are welcome! Please refer to the [development guidelines](https://bwrob.github.io/debug-dojo/development/) for details on how to set up your development environment and submit changes.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# debug dojo
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://github.com/bwrob/debug-dojo/blob/main/docs/logo/logo_python.png?raw=true" alt="debug dojo" style="width:50%; max-width:350px;"/>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<em>🏣 debug dojo, a place for zen debugging</em>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://pypi.org/project/debug-dojo">
|
|
13
|
+
<img src="https://img.shields.io/pypi/v/debug-dojo.svg?style=flat-square" alt="PyPi Version">
|
|
14
|
+
</a>
|
|
15
|
+
<a href="https://pypi.org/pypi/debug-dojo/">
|
|
16
|
+
<img src="https://img.shields.io/pypi/pyversions/debug-dojo.svg?style=flat-square" alt="PyPI pyversions">
|
|
17
|
+
</a>
|
|
18
|
+
<a href="https://pepy.tech/project/debug-dojo">
|
|
19
|
+
<img src="https://static.pepy.tech/badge/debug-dojo/month" alt="downloads">
|
|
20
|
+
</a>
|
|
21
|
+
<a href="https://github.com/bwrob/debug-dojo/blob/main/LICENSE">
|
|
22
|
+
<img src="https://img.shields.io/github/license/bwrob/debug-dojo.svg" alt="license">
|
|
23
|
+
</a>
|
|
24
|
+
<a href="https://results.pre-commit.ci/latest/github/bwrob/debug-dojo/main">
|
|
25
|
+
<img src="https://results.pre-commit.ci/badge/github/bwrob/debug-dojo/main.svg" alt="pre-commit.ci status">
|
|
26
|
+
</a>
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
[**debug-dojo**](https://bwrob.github.io/debug-dojo/) is a powerful Python package designed to streamline your debugging workflow directly from the terminal. It integrates seamlessly with popular debuggers and enhances your inspection capabilities with beautiful, readable output.
|
|
30
|
+
|
|
31
|
+
## ✨ Features
|
|
32
|
+
|
|
33
|
+
* **Unified Debugging Interface:** Easily launch your scripts or modules with your preferred debugger (`debugpy`, `pudb`, `pdb`, `ipdb`).
|
|
34
|
+
* **Enhanced Output with Rich:** Leverages [`rich`](https://github.com/Textualize/rich) for stunning, syntax-highlighted code, pretty-printed objects, and improved tracebacks.
|
|
35
|
+
* **Side-by-Side Object Comparison:** Quickly identify differences between two Python objects.
|
|
36
|
+
* **Interactive Object Inspection:** Dive deep into object structures with a powerful `inspect` utility.
|
|
37
|
+
* **Simplified Breakpoints:** Set breakpoints effortlessly with a concise helper function.
|
|
38
|
+
|
|
39
|
+
## 🚀 Installation
|
|
40
|
+
|
|
41
|
+
Install `debug-dojo` using `pip`:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install debug-dojo
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
For full debugger support, you might want to install optional dependencies:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install "debug-dojo[all]"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 💻 CLI Usage
|
|
54
|
+
|
|
55
|
+
Run your Python script or module with `debug-dojo`:
|
|
56
|
+
|
|
57
|
+
```console
|
|
58
|
+
dojo my_script.py
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Specify a debugger, configuration file, or enable verbose output:
|
|
62
|
+
|
|
63
|
+
```console
|
|
64
|
+
dojo --debugger ipdb --config dojo.toml --verbose --module my_module
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Run an executable command with debugging tools:
|
|
68
|
+
|
|
69
|
+
```console
|
|
70
|
+
dojo --exec pytest
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## 🐍 Usage in Code
|
|
74
|
+
|
|
75
|
+
Integrate `debug-dojo` directly into your Python code for on-demand debugging and inspection utilities:
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
import debug_dojo.install
|
|
79
|
+
|
|
80
|
+
# Set a breakpoint and enter the debugger
|
|
81
|
+
# debug_dojo.install.b() # Equivalent to breakpoint()
|
|
82
|
+
|
|
83
|
+
object_1 = {"foo": 1, "bar": 2}
|
|
84
|
+
object_2 = [1, 2, 3]
|
|
85
|
+
|
|
86
|
+
# Pretty print an object with Rich
|
|
87
|
+
debug_dojo.install.p(object_1)
|
|
88
|
+
|
|
89
|
+
# Inspect an object using Rich
|
|
90
|
+
debug_dojo.install.i(object_1)
|
|
91
|
+
|
|
92
|
+
# Compare two objects side-by-side
|
|
93
|
+
debug_dojo.install.c(object_1, object_2)
|
|
94
|
+
|
|
95
|
+
# Enter the debugger (e.g., ipdb, pudb, pdb, debugpy based on config)
|
|
96
|
+
# debug_dojo.install.b()
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## 📚 Documentation
|
|
100
|
+
|
|
101
|
+
For comprehensive instructions on installation, configuration, advanced usage, and API reference, please visit the [official documentation](https://bwrob.github.io/debug-dojo/).
|
|
102
|
+
|
|
103
|
+
## 🤝 Contributing
|
|
104
|
+
|
|
105
|
+
Contributions are welcome! Please refer to the [development guidelines](https://bwrob.github.io/debug-dojo/development/) for details on how to set up your development environment and submit changes.
|
|
@@ -7,17 +7,18 @@
|
|
|
7
7
|
"Programming Language :: Python :: 3.11",
|
|
8
8
|
"Programming Language :: Python :: 3.12",
|
|
9
9
|
"Programming Language :: Python :: 3.13",
|
|
10
|
+
"Programming Language :: Python :: 3.14",
|
|
10
11
|
"Topic :: Software Development :: Debuggers",
|
|
11
12
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
12
13
|
]
|
|
13
14
|
dependencies = [
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"rich>=
|
|
19
|
-
"tomlkit>=0.
|
|
20
|
-
"typer>=0.
|
|
15
|
+
"dacite>=1.0.0",
|
|
16
|
+
"debugpy>=1.0.0",
|
|
17
|
+
"ipdb>=0.12.0",
|
|
18
|
+
"pudb>=2019.1",
|
|
19
|
+
"rich>=10.0.0",
|
|
20
|
+
"tomlkit>=0.7.0",
|
|
21
|
+
"typer>=0.3.0",
|
|
21
22
|
]
|
|
22
23
|
description = "🏣 debug dojo, a place for zen debugging"
|
|
23
24
|
keywords = [ "debugging", "inspection", "tools", "development" ]
|
|
@@ -25,8 +26,8 @@
|
|
|
25
26
|
license-files = [ 'LICENSE' ]
|
|
26
27
|
name = "debug-dojo"
|
|
27
28
|
readme = "README.md"
|
|
28
|
-
requires-python = ">=3.10,<3.
|
|
29
|
-
version = "0.
|
|
29
|
+
requires-python = ">=3.10,<3.15"
|
|
30
|
+
version = "0.6.0"
|
|
30
31
|
|
|
31
32
|
[project.urls]
|
|
32
33
|
Changelog = "https://bwrob.github.io/debug-dojo/changelog/"
|
|
@@ -43,10 +44,13 @@ version = "0.5.0"
|
|
|
43
44
|
dev = [
|
|
44
45
|
"basedpyright>=1.31.2",
|
|
45
46
|
"coverage>=7.10.4",
|
|
47
|
+
"diff-cover>=9.6.0",
|
|
46
48
|
"poethepoet>=0.37.0",
|
|
47
49
|
"pytest>=8.4.1",
|
|
50
|
+
"pytest-cov>=6.2.1",
|
|
48
51
|
"ruff>=0.12.9",
|
|
49
|
-
|
|
52
|
+
"tach>=0.29.0",
|
|
53
|
+
]
|
|
50
54
|
docs = [
|
|
51
55
|
"mkdocs>=1.6.1",
|
|
52
56
|
"mkdocs-git-authors-plugin>=0.10.0",
|
|
@@ -55,11 +59,11 @@ version = "0.5.0"
|
|
|
55
59
|
"mkdocs-material>=9.6.17",
|
|
56
60
|
"mkdocs-typer2>=0.1.5",
|
|
57
61
|
"mkdocstrings-python>=1.17.0",
|
|
62
|
+
"pymdown-extensions>=10.16.1",
|
|
58
63
|
]
|
|
59
64
|
|
|
60
65
|
|
|
61
66
|
[tool.uv]
|
|
62
|
-
default-groups = "all"
|
|
63
67
|
package = true
|
|
64
68
|
required-version = ">=0.8.0"
|
|
65
69
|
|
|
@@ -93,11 +97,16 @@ version = "0.5.0"
|
|
|
93
97
|
|
|
94
98
|
[tool.poe.tasks]
|
|
95
99
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
coverage = { cmd = "pytest --doctest-modules --verbose --cov --cov-report=xml", help = "Create test coverage report." }
|
|
101
|
+
dependencies = { cmd = "tach check", help = "Check dependency layers using tach." }
|
|
102
|
+
dependency-graph = { cmd = "tach show --mermaid -o docs/dependency_graph.mmd", help = "Generate the dependency graph." }
|
|
103
|
+
docs = { cmd = "hap run mkdocs serve", help = "Spawn docs server." }
|
|
104
|
+
format = { cmd = "ruff format --diff --config=pyproject.toml", help = "Check code formatting using ruff." }
|
|
105
|
+
lint = { cmd = "uv run ruff check --config=pyproject.toml", help = "Check code rules using ruff." }
|
|
106
|
+
precommit = { cmd = "pre-commit run --all-files", help = "Run all code quality checks." }
|
|
107
|
+
publish-docs = { cmd = "mkdocs gh-deploy --force", help = "Publish the docs to GitHub Pages." }
|
|
108
|
+
test = { cmd = "pytest", help = "Run tests using pytest." }
|
|
109
|
+
type-check = { cmd = "basedpyright src tests", help = "Check static typing using basedpyright." }
|
|
101
110
|
|
|
102
111
|
[tool.poe.tasks.code-quality]
|
|
103
112
|
help = "Run all code quality checks."
|
|
@@ -119,8 +128,15 @@ version = "0.5.0"
|
|
|
119
128
|
{ cmd = "rm -rf dist" },
|
|
120
129
|
{ cmd = "uv build" },
|
|
121
130
|
{ cmd = "uv publish" },
|
|
131
|
+
"publish-docs",
|
|
122
132
|
]
|
|
123
133
|
|
|
124
134
|
[tool.docformatter]
|
|
125
135
|
black = true
|
|
126
136
|
non-cap = [ "dojo" ]
|
|
137
|
+
|
|
138
|
+
[tool.pytest.ini_options]
|
|
139
|
+
addopts = "--verbose --doctest-modules"
|
|
140
|
+
collect_imported_tests = false
|
|
141
|
+
console_output_style = "classic"
|
|
142
|
+
minversion = "8.0"
|
|
@@ -42,7 +42,20 @@ def __execute_with_debug( # noqa: C901
|
|
|
42
42
|
verbose: bool,
|
|
43
43
|
config: DebugDojoConfig,
|
|
44
44
|
) -> None:
|
|
45
|
-
"""Execute a target script or module with installed debugging tools.
|
|
45
|
+
"""Execute a target script or module with installed debugging tools.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
target_name (str): The name of the script, module, or executable to run.
|
|
49
|
+
target_args (list[str]): Arguments to pass to the target.
|
|
50
|
+
target_mode (ExecMode): The execution mode (FILE, MODULE, or EXECUTABLE).
|
|
51
|
+
verbose (bool): If True, print verbose output.
|
|
52
|
+
config (DebugDojoConfig): The debug-dojo configuration.
|
|
53
|
+
|
|
54
|
+
Raises:
|
|
55
|
+
typer.Exit: If the target file is not found, or if an import error occurs,
|
|
56
|
+
or if the script exits with a non-zero code.
|
|
57
|
+
|
|
58
|
+
"""
|
|
46
59
|
sys.argv = [target_name, *target_args]
|
|
47
60
|
|
|
48
61
|
if verbose:
|
|
@@ -87,12 +100,6 @@ def __execute_with_debug( # noqa: C901
|
|
|
87
100
|
raise typer.Exit(1) from e
|
|
88
101
|
|
|
89
102
|
|
|
90
|
-
def display_config(config: DebugDojoConfig) -> None:
|
|
91
|
-
"""Display the configuration for the debug dojo."""
|
|
92
|
-
rich_print("[blue]Using debug-dojo configuration:[/blue]")
|
|
93
|
-
rich_print(config.model_dump_json(indent=4))
|
|
94
|
-
|
|
95
|
-
|
|
96
103
|
@cli.command(
|
|
97
104
|
help="Run a Python script or module with debugging tools installed.",
|
|
98
105
|
no_args_is_help=True,
|
|
@@ -124,7 +131,33 @@ def run_debug( # noqa: PLR0913
|
|
|
124
131
|
typer.Option("--exec", "-e", help="Run a command"),
|
|
125
132
|
] = False,
|
|
126
133
|
) -> None:
|
|
127
|
-
"""Run
|
|
134
|
+
"""Run a Python script, module, or executable with debug-dojo tools.
|
|
135
|
+
|
|
136
|
+
This command acts as the main entry point for `debug-dojo`, allowing users to
|
|
137
|
+
execute their code while automatically installing and configuring debugging tools
|
|
138
|
+
based on the provided options or configuration file.
|
|
139
|
+
|
|
140
|
+
Args:
|
|
141
|
+
ctx (typer.Context): The Typer context object.
|
|
142
|
+
target_name (str | None): The path to the script, name of the module, or
|
|
143
|
+
name of the executable to run. If not provided,
|
|
144
|
+
the command will exit.
|
|
145
|
+
config_path (Path | None): Path to a custom configuration file
|
|
146
|
+
(e.g., `dojo.toml`).
|
|
147
|
+
debugger (DebuggerType | None): Override the default debugger specified
|
|
148
|
+
in the config.
|
|
149
|
+
verbose (bool): Enable verbose output, showing loaded configuration
|
|
150
|
+
and installation steps.
|
|
151
|
+
module (bool): Treat `target_name` as a Python module to run
|
|
152
|
+
(e.g., `dojo -m my_package.my_module`).
|
|
153
|
+
executable (bool): Treat `target_name` as an executable command to run
|
|
154
|
+
(e.g., `dojo -e pytest`).
|
|
155
|
+
|
|
156
|
+
Raises:
|
|
157
|
+
typer.Exit: If `--module` and `--exec` are used together, or if the target
|
|
158
|
+
cannot be executed, or if an error occurs during execution.
|
|
159
|
+
|
|
160
|
+
"""
|
|
128
161
|
if module and executable:
|
|
129
162
|
rich_print(
|
|
130
163
|
"[red]Error: --module and --command options are mutually exclusive.[/red]"
|
|
@@ -142,7 +175,7 @@ def run_debug( # noqa: PLR0913
|
|
|
142
175
|
config = load_config(config_path, verbose=verbose, debugger=debugger)
|
|
143
176
|
|
|
144
177
|
if verbose:
|
|
145
|
-
|
|
178
|
+
rich_print(f"[blue]Using debug-dojo configuration: {config} [/blue]")
|
|
146
179
|
|
|
147
180
|
if target_name:
|
|
148
181
|
__execute_with_debug(
|
|
@@ -14,8 +14,16 @@ from rich.panel import Panel
|
|
|
14
14
|
from rich.text import Text
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
def
|
|
18
|
-
"""Extract and format non-callable attributes of an object.
|
|
17
|
+
def get_object_attributes(obj: object) -> list[str]:
|
|
18
|
+
"""Extract and format non-callable attributes of an object.
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
obj (object): The object to extract attributes from.
|
|
22
|
+
|
|
23
|
+
Returns:
|
|
24
|
+
list[str]: A list of formatted strings, each representing an attribute.
|
|
25
|
+
|
|
26
|
+
"""
|
|
19
27
|
attributes: list[str] = []
|
|
20
28
|
for attr_name in sorted(dir(obj)):
|
|
21
29
|
# Safely get attribute, returning None if it doesn't exist
|
|
@@ -28,8 +36,16 @@ def _get_object_attributes(obj: object) -> list[str]:
|
|
|
28
36
|
return attributes
|
|
29
37
|
|
|
30
38
|
|
|
31
|
-
def
|
|
32
|
-
"""Extract and format public callable methods of an object.
|
|
39
|
+
def get_object_methods(obj: object) -> list[str]:
|
|
40
|
+
"""Extract and format public callable methods of an object.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
obj (object): The object to extract methods from.
|
|
44
|
+
|
|
45
|
+
Returns:
|
|
46
|
+
list[str]: A list of method names.
|
|
47
|
+
|
|
48
|
+
"""
|
|
33
49
|
methods: list[str] = []
|
|
34
50
|
for method_name in sorted(dir(obj)):
|
|
35
51
|
# Safely get attribute, returning None if it doesn't exist
|
|
@@ -40,11 +56,18 @@ def _get_object_methods(obj: object) -> list[str]:
|
|
|
40
56
|
return methods
|
|
41
57
|
|
|
42
58
|
|
|
43
|
-
def
|
|
59
|
+
def get_simplified_object_info(obj: object) -> list[Text]:
|
|
44
60
|
"""Generate a simplified, Rich-formatted inspection output for an object.
|
|
45
61
|
|
|
46
62
|
Handles basic Python types by displaying their value directly. For other objects, it
|
|
47
63
|
lists their attributes and public methods.
|
|
64
|
+
|
|
65
|
+
Args:
|
|
66
|
+
obj (object): The object to generate info for.
|
|
67
|
+
|
|
68
|
+
Returns:
|
|
69
|
+
list[Text]: A list of Rich Text objects representing the object's information.
|
|
70
|
+
|
|
48
71
|
"""
|
|
49
72
|
info_lines: list[Text] = []
|
|
50
73
|
obj_type: str = type(obj).__name__
|
|
@@ -62,7 +85,7 @@ def _get_simplified_object_info(obj: object) -> list[Text]:
|
|
|
62
85
|
return info_lines
|
|
63
86
|
|
|
64
87
|
# For other objects, list attributes
|
|
65
|
-
attributes =
|
|
88
|
+
attributes = get_object_attributes(obj)
|
|
66
89
|
if attributes:
|
|
67
90
|
info_lines.append(Text("Attributes:", style="bold"))
|
|
68
91
|
info_lines.extend([Text(f" {attr}") for attr in attributes])
|
|
@@ -71,7 +94,7 @@ def _get_simplified_object_info(obj: object) -> list[Text]:
|
|
|
71
94
|
info_lines.append(Text(""))
|
|
72
95
|
|
|
73
96
|
# List methods
|
|
74
|
-
methods =
|
|
97
|
+
methods = get_object_methods(obj)
|
|
75
98
|
if methods:
|
|
76
99
|
info_lines.append(Text("Methods:", style="bold"))
|
|
77
100
|
info_lines.extend([Text(f" {method}()") for method in methods])
|
|
@@ -88,11 +111,16 @@ def inspect_objects_side_by_side(
|
|
|
88
111
|
"""Display two Python objects side-by-side in the terminal using Rich.
|
|
89
112
|
|
|
90
113
|
Showing their attributes and methods in a simplified, aligned format.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
obj1 (object): The first object to display.
|
|
117
|
+
obj2 (object): The second object to display.
|
|
118
|
+
|
|
91
119
|
"""
|
|
92
120
|
main_console: Console = Console()
|
|
93
121
|
|
|
94
|
-
lines1: list[Text] =
|
|
95
|
-
lines2: list[Text] =
|
|
122
|
+
lines1: list[Text] = get_simplified_object_info(obj1)
|
|
123
|
+
lines2: list[Text] = get_simplified_object_info(obj2)
|
|
96
124
|
|
|
97
125
|
# Determine the maximum number of lines to ensure consistent height
|
|
98
126
|
max_lines: int = max(len(lines1), len(lines2))
|