dash-devtools-plus 0.1.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.
- dash_devtools_plus-0.1.0/LICENSE +21 -0
- dash_devtools_plus-0.1.0/PKG-INFO +315 -0
- dash_devtools_plus-0.1.0/README.md +288 -0
- dash_devtools_plus-0.1.0/dash_devtools_plus/__init__.py +11 -0
- dash_devtools_plus-0.1.0/dash_devtools_plus/assets/dash_devtools_plus.css +2 -0
- dash_devtools_plus-0.1.0/dash_devtools_plus/assets/dash_devtools_plus.js +428 -0
- dash_devtools_plus-0.1.0/dash_devtools_plus/hook_inventory.py +366 -0
- dash_devtools_plus-0.1.0/dash_devtools_plus/plugin.py +632 -0
- dash_devtools_plus-0.1.0/dash_devtools_plus/server_metrics.py +79 -0
- dash_devtools_plus-0.1.0/dash_devtools_plus.egg-info/PKG-INFO +315 -0
- dash_devtools_plus-0.1.0/dash_devtools_plus.egg-info/SOURCES.txt +20 -0
- dash_devtools_plus-0.1.0/dash_devtools_plus.egg-info/dependency_links.txt +1 -0
- dash_devtools_plus-0.1.0/dash_devtools_plus.egg-info/entry_points.txt +2 -0
- dash_devtools_plus-0.1.0/dash_devtools_plus.egg-info/requires.txt +7 -0
- dash_devtools_plus-0.1.0/dash_devtools_plus.egg-info/top_level.txt +1 -0
- dash_devtools_plus-0.1.0/pyproject.toml +55 -0
- dash_devtools_plus-0.1.0/setup.cfg +4 -0
- dash_devtools_plus-0.1.0/tests/test_example_app.py +214 -0
- dash_devtools_plus-0.1.0/tests/test_hook_inventory.py +48 -0
- dash_devtools_plus-0.1.0/tests/test_i18n.py +15 -0
- dash_devtools_plus-0.1.0/tests/test_plugin.py +219 -0
- dash_devtools_plus-0.1.0/tests/test_server_metrics.py +24 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Feffery
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dash-devtools-plus
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A focused developer console for Dash applications, powered by Dash hooks.
|
|
5
|
+
Author: dash-devtools-plus contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Repository, https://github.com/HogaStack/dash-devtools-plus
|
|
8
|
+
Project-URL: Issues, https://github.com/HogaStack/dash-devtools-plus/issues
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Framework :: Dash
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Requires-Python: >=3.9
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: dash>=3.3.0
|
|
21
|
+
Requires-Dist: psutil>=5.9
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: build>=1.2.2; extra == "dev"
|
|
24
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
25
|
+
Requires-Dist: ruff>=0.9; extra == "dev"
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
<img src="./branding/devtools-plus-logo.svg" alt="Dash Devtools Plus logo" width="88" />
|
|
29
|
+
|
|
30
|
+
# Dash Devtools Plus
|
|
31
|
+
|
|
32
|
+
A focused developer console for Dash applications, powered by the Dash Hooks API.
|
|
33
|
+
|
|
34
|
+
English | [简体中文](./README-zh_CN.md)
|
|
35
|
+
|
|
36
|
+
Dash Devtools Plus adds an Ant Design-based workspace to Dash's native developer toolbar without changing the application layout. It provides callback diagnostics, component inspection, state snapshots, runtime library inventories, and server resource monitoring during development.
|
|
37
|
+
|
|
38
|
+
> [!IMPORTANT]
|
|
39
|
+
> Dash Devtools Plus is a development tool. Its UI and metadata endpoints are available only when both Dash debug mode and the native Dev Tools UI are enabled. Do not expose a debug server to an untrusted network.
|
|
40
|
+
|
|
41
|
+
## Table of Contents
|
|
42
|
+
|
|
43
|
+
- [Features](#features)
|
|
44
|
+
- [Requirements](#requirements)
|
|
45
|
+
- [Installation](#installation)
|
|
46
|
+
- [Quick Start](#quick-start)
|
|
47
|
+
- [Configuration](#configuration)
|
|
48
|
+
- [Devtools Plus Panels](#devtools-plus-panels)
|
|
49
|
+
- [Server Resources](#server-resources)
|
|
50
|
+
- [Callbacks](#callbacks)
|
|
51
|
+
- [Component Inspector](#component-inspector)
|
|
52
|
+
- [State Snapshots](#state-snapshots)
|
|
53
|
+
- [Component Libraries](#component-libraries)
|
|
54
|
+
- [Dash Hooks](#dash-hooks)
|
|
55
|
+
- [Toolbar Skins](#toolbar-skins)
|
|
56
|
+
- [Security and Usage Boundary](#security-and-usage-boundary)
|
|
57
|
+
- [Development](#development)
|
|
58
|
+
- [Project Structure](#project-structure)
|
|
59
|
+
- [Architecture](#architecture)
|
|
60
|
+
- [Contributing](#contributing)
|
|
61
|
+
- [License](#license)
|
|
62
|
+
|
|
63
|
+
## Features
|
|
64
|
+
|
|
65
|
+
- Native integration with `hooks.devtool` and Dash's shared Dev Tools popup state.
|
|
66
|
+
- English and Simplified Chinese user interfaces.
|
|
67
|
+
- Searchable callback relationships with source locations and IDE navigation.
|
|
68
|
+
- Point-and-click inspection of rendered Dash components and their current props.
|
|
69
|
+
- Selective, session-scoped state snapshots and prop restoration.
|
|
70
|
+
- Runtime inventories for component libraries and Dash Hooks plugins.
|
|
71
|
+
- Live CPU, memory, disk, operating-system, and Python runtime information.
|
|
72
|
+
- A browser-local Dash Dev Tools skin chooser covering the native toolbar and in-app error display.
|
|
73
|
+
- Locally built frontend assets with no CDN dependency at runtime.
|
|
74
|
+
- Debug-only metadata endpoints with non-cacheable responses.
|
|
75
|
+
|
|
76
|
+
## Requirements
|
|
77
|
+
|
|
78
|
+
| Dependency | Version | Purpose |
|
|
79
|
+
| --- | --- | --- |
|
|
80
|
+
| Python | 3.9 or later | Package and Dash application runtime |
|
|
81
|
+
| Dash | 3.3 or later | Dash Hooks and Dev Tools APIs |
|
|
82
|
+
| Node.js | 20.19 or later, or 22.12 or later | Frontend development only |
|
|
83
|
+
| npm | Bundled with Node.js | Frontend dependency management and builds |
|
|
84
|
+
|
|
85
|
+
End users installing the Python package do not need Node.js. The distributable JavaScript and CSS files are included in the package.
|
|
86
|
+
|
|
87
|
+
## Installation
|
|
88
|
+
|
|
89
|
+
Install from PyPI:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
pip install dash-devtools-plus
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
For local development, follow the [Development](#development) guide instead.
|
|
96
|
+
|
|
97
|
+
## Quick Start
|
|
98
|
+
|
|
99
|
+
Installed packages are discovered automatically through Dash's `dash_hooks` entry-point group. Import the configuration helper before constructing the Dash application when customization is required:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from dash import Dash, html
|
|
103
|
+
from dash_devtools_plus import configure_devtools_plus
|
|
104
|
+
|
|
105
|
+
configure_devtools_plus(
|
|
106
|
+
default_locale="en",
|
|
107
|
+
accent_color="#119DFF",
|
|
108
|
+
editor="vscode",
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
app = Dash(__name__)
|
|
112
|
+
app.layout = html.Div("Hello Dash")
|
|
113
|
+
|
|
114
|
+
if __name__ == "__main__":
|
|
115
|
+
app.run(debug=True)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Open the application and select **Devtools Plus** from the native Dash developer toolbar.
|
|
119
|
+
|
|
120
|
+
## Configuration
|
|
121
|
+
|
|
122
|
+
Call `configure_devtools_plus` before creating the `Dash` instance.
|
|
123
|
+
|
|
124
|
+
| Option | Type | Default | Description |
|
|
125
|
+
| --- | --- | --- | --- |
|
|
126
|
+
| `default_locale` | `"en" \| "zh-CN"` | `"en"` | Initial interface language. A browser-local preference takes precedence after the user switches languages. |
|
|
127
|
+
| `accent_color` | `str` | `"#119DFF"` | Accent color used by the Devtools Plus interface. |
|
|
128
|
+
| `editor` | `"vscode" \| "cursor" \| "pycharm" \| None` | `"vscode"` | Preferred editor for callback source navigation. Set to `None` to disable editor links. |
|
|
129
|
+
| `project_root` | `str \| Path \| None` | `None` | Explicit server-side project boundary used when resolving callback source files. |
|
|
130
|
+
| `editor_project_root` | `str \| Path \| None` | `None` | Client-side checkout root used when the browser and Dash server see different filesystem paths. |
|
|
131
|
+
|
|
132
|
+
For Docker, WSL, remote workspaces, or other split filesystem layouts, map the server checkout to the path visible to the local editor:
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
configure_devtools_plus(
|
|
136
|
+
project_root="/app",
|
|
137
|
+
editor_project_root=r"C:\projects\my-dash-app",
|
|
138
|
+
)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Only callback files contained by the resolved project root receive editor links. The server does not launch an editor process or accept browser-provided file paths.
|
|
142
|
+
|
|
143
|
+
## Devtools Plus Panels
|
|
144
|
+
|
|
145
|
+
| Panel | Summary | Details |
|
|
146
|
+
| --- | --- | --- |
|
|
147
|
+
| Server Resources | Live server utilization and runtime environment overview | [View details](#server-resources) |
|
|
148
|
+
| Callbacks | Searchable callback dependencies, behavior, and source metadata | [View details](#callbacks) |
|
|
149
|
+
| Component Inspector | Point-and-click DOM-to-Dash component inspection | [View details](#component-inspector) |
|
|
150
|
+
| State Snapshots | Selective component prop capture and restoration | [View details](#state-snapshots) |
|
|
151
|
+
| Component Libraries | Loaded Dash component packages, versions, and aliases | [View details](#component-libraries) |
|
|
152
|
+
| Dash Hooks | Hook plugin discovery, registration order, and diagnostics | [View details](#dash-hooks) |
|
|
153
|
+
| Toolbar Skins | Native Dash toolbar and error-display appearance presets | [View details](#toolbar-skins) |
|
|
154
|
+
|
|
155
|
+
### Server Resources
|
|
156
|
+
|
|
157
|
+
### Callbacks
|
|
158
|
+
|
|
159
|
+
### Component Inspector
|
|
160
|
+
|
|
161
|
+
### State Snapshots
|
|
162
|
+
|
|
163
|
+
### Component Libraries
|
|
164
|
+
|
|
165
|
+
### Dash Hooks
|
|
166
|
+
|
|
167
|
+
### Toolbar Skins
|
|
168
|
+
|
|
169
|
+
The **工具条换肤 / Toolbar skins** tab offers two vertically stacked, full-width choices: Dash's original style (the default) and **浮光工具岛 / Luminous Dock**, a floating translucent blue dock. Selection applies immediately to the native bottom-right debug toolbar (including its collapsed handle), error count, error list, expanded details, and Python traceback iframe. It is saved in this browser's `localStorage`. Switching back to the original style removes all theme overrides. Callback graphs and devtool behavior are unchanged.
|
|
170
|
+
|
|
171
|
+
## Security and Usage Boundary
|
|
172
|
+
|
|
173
|
+
The toolbar component and all Devtools Plus metadata routes require both Dash debug mode and the native Dev Tools UI. Requests made while this condition is not satisfied receive a generic, non-cacheable `404` response.
|
|
174
|
+
|
|
175
|
+
The development endpoints may expose callback names, project-relative source paths, installed package versions, Hook registrations, and server runtime information. They do not provide an authentication boundary of their own. Keep debug applications on a trusted machine or protected development network.
|
|
176
|
+
|
|
177
|
+
State snapshots and component inspection run in the browser. Snapshots are stored in the current tab's `sessionStorage`, and restoring props may trigger related Dash callbacks.
|
|
178
|
+
|
|
179
|
+
## Development
|
|
180
|
+
|
|
181
|
+
### Create a Conda or Mamba Environment
|
|
182
|
+
|
|
183
|
+
The simplest setup uses one Conda environment for both Python and Node.js. Installing Node.js from `conda-forge` avoids a separate system-level Node.js installation.
|
|
184
|
+
|
|
185
|
+
Using Mamba:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
mamba create -n dash-devtools-plus-dev -c conda-forge python=3.12 "nodejs>=22.12,<23"
|
|
189
|
+
conda activate dash-devtools-plus-dev
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Using Conda:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
conda create -n dash-devtools-plus-dev -c conda-forge python=3.12 "nodejs>=22.12,<23"
|
|
196
|
+
conda activate dash-devtools-plus-dev
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Verify the toolchain:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
python --version
|
|
203
|
+
node --version
|
|
204
|
+
npm --version
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Install Development Dependencies
|
|
208
|
+
|
|
209
|
+
From the repository root:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
python -m pip install -e ".[dev]"
|
|
213
|
+
npm ci
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
`npm ci` installs the exact frontend dependency versions recorded in `package-lock.json`.
|
|
217
|
+
|
|
218
|
+
### Build the Frontend
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
npm run build
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Vite writes the distributable assets to `dash_devtools_plus/assets/`. These generated JavaScript and CSS files are part of the Python package and must be committed when frontend source code changes.
|
|
225
|
+
|
|
226
|
+
For continuous frontend rebuilding:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
npm run dev
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Test the Project
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
python -m pytest
|
|
236
|
+
npm run test:frontend
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Lint and Format with Ruff
|
|
240
|
+
|
|
241
|
+
Check the Python code:
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
ruff check .
|
|
245
|
+
ruff format --check .
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Apply safe lint fixes and formatting:
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
ruff check . --fix
|
|
252
|
+
ruff format .
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Ruff settings, including the supported Python target and line length, are defined in `pyproject.toml`.
|
|
256
|
+
|
|
257
|
+
### Run the Demo Application
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
python examples/app.py
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Open <http://127.0.0.1:8050> and select **Devtools Plus** from the Dash developer toolbar.
|
|
264
|
+
|
|
265
|
+
The demo's **ERROR REPORTING TEST** controls can deliberately raise a Python `ZeroDivisionError` (`1 / 0`) or a clientside JavaScript `Error`. Both start dormant and require a click, making it easy to inspect the native error UI with either toolbar skin.
|
|
266
|
+
|
|
267
|
+
### Build the Python Package
|
|
268
|
+
|
|
269
|
+
Build the source distribution and wheel after rebuilding the frontend assets:
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
python -m build
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Generated package archives are written to `dist/`.
|
|
276
|
+
|
|
277
|
+
## Project Structure
|
|
278
|
+
|
|
279
|
+
```text
|
|
280
|
+
dash_devtools_plus/
|
|
281
|
+
assets/ Built JavaScript and CSS distributed with Python
|
|
282
|
+
hook_inventory.py Dash Hooks discovery and runtime inventory
|
|
283
|
+
plugin.py Hook, route, configuration, and Dev Tools registration
|
|
284
|
+
server_metrics.py Server resource sampling
|
|
285
|
+
frontend/
|
|
286
|
+
src/ React interface and browser-side diagnostics
|
|
287
|
+
tests/ Node-based frontend tests
|
|
288
|
+
examples/ Development and acceptance demo application
|
|
289
|
+
tests/ Python tests
|
|
290
|
+
package.json Frontend dependencies and scripts
|
|
291
|
+
pyproject.toml Python package and tool configuration
|
|
292
|
+
vite.config.js Frontend library build configuration
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
## Architecture
|
|
296
|
+
|
|
297
|
+
- Importing the package registers its assets, metadata routes, setup hook, and Dev Tools component through the Dash Hooks registry.
|
|
298
|
+
- The setup hook binds the Dev Tools component to the owning Dash application and tracks Dash's resolved debug state.
|
|
299
|
+
- Callback, component-library, Hook-library, and server-resource data are exposed through debug-gated application routes.
|
|
300
|
+
- The React interface is compiled as an IIFE bundle and uses the React and ReactDOM instances supplied by Dash.
|
|
301
|
+
- Component inspection reads the active Dash layout through the browser component API and resolves rendered elements through their React tree.
|
|
302
|
+
- State snapshots serialize JSON-safe component props in the browser and restore them with `dash_clientside.set_props`.
|
|
303
|
+
|
|
304
|
+
## Contributing
|
|
305
|
+
|
|
306
|
+
Contributions are welcome. Before opening a pull request:
|
|
307
|
+
|
|
308
|
+
1. Update source files and rebuild frontend assets when necessary.
|
|
309
|
+
2. Run the Python and frontend test suites.
|
|
310
|
+
3. Run Ruff linting and formatting checks.
|
|
311
|
+
4. Keep generated caches, local environments, and build archives out of the commit.
|
|
312
|
+
|
|
313
|
+
## License
|
|
314
|
+
|
|
315
|
+
[MIT](./LICENSE)
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
<img src="./branding/devtools-plus-logo.svg" alt="Dash Devtools Plus logo" width="88" />
|
|
2
|
+
|
|
3
|
+
# Dash Devtools Plus
|
|
4
|
+
|
|
5
|
+
A focused developer console for Dash applications, powered by the Dash Hooks API.
|
|
6
|
+
|
|
7
|
+
English | [简体中文](./README-zh_CN.md)
|
|
8
|
+
|
|
9
|
+
Dash Devtools Plus adds an Ant Design-based workspace to Dash's native developer toolbar without changing the application layout. It provides callback diagnostics, component inspection, state snapshots, runtime library inventories, and server resource monitoring during development.
|
|
10
|
+
|
|
11
|
+
> [!IMPORTANT]
|
|
12
|
+
> Dash Devtools Plus is a development tool. Its UI and metadata endpoints are available only when both Dash debug mode and the native Dev Tools UI are enabled. Do not expose a debug server to an untrusted network.
|
|
13
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Features](#features)
|
|
17
|
+
- [Requirements](#requirements)
|
|
18
|
+
- [Installation](#installation)
|
|
19
|
+
- [Quick Start](#quick-start)
|
|
20
|
+
- [Configuration](#configuration)
|
|
21
|
+
- [Devtools Plus Panels](#devtools-plus-panels)
|
|
22
|
+
- [Server Resources](#server-resources)
|
|
23
|
+
- [Callbacks](#callbacks)
|
|
24
|
+
- [Component Inspector](#component-inspector)
|
|
25
|
+
- [State Snapshots](#state-snapshots)
|
|
26
|
+
- [Component Libraries](#component-libraries)
|
|
27
|
+
- [Dash Hooks](#dash-hooks)
|
|
28
|
+
- [Toolbar Skins](#toolbar-skins)
|
|
29
|
+
- [Security and Usage Boundary](#security-and-usage-boundary)
|
|
30
|
+
- [Development](#development)
|
|
31
|
+
- [Project Structure](#project-structure)
|
|
32
|
+
- [Architecture](#architecture)
|
|
33
|
+
- [Contributing](#contributing)
|
|
34
|
+
- [License](#license)
|
|
35
|
+
|
|
36
|
+
## Features
|
|
37
|
+
|
|
38
|
+
- Native integration with `hooks.devtool` and Dash's shared Dev Tools popup state.
|
|
39
|
+
- English and Simplified Chinese user interfaces.
|
|
40
|
+
- Searchable callback relationships with source locations and IDE navigation.
|
|
41
|
+
- Point-and-click inspection of rendered Dash components and their current props.
|
|
42
|
+
- Selective, session-scoped state snapshots and prop restoration.
|
|
43
|
+
- Runtime inventories for component libraries and Dash Hooks plugins.
|
|
44
|
+
- Live CPU, memory, disk, operating-system, and Python runtime information.
|
|
45
|
+
- A browser-local Dash Dev Tools skin chooser covering the native toolbar and in-app error display.
|
|
46
|
+
- Locally built frontend assets with no CDN dependency at runtime.
|
|
47
|
+
- Debug-only metadata endpoints with non-cacheable responses.
|
|
48
|
+
|
|
49
|
+
## Requirements
|
|
50
|
+
|
|
51
|
+
| Dependency | Version | Purpose |
|
|
52
|
+
| --- | --- | --- |
|
|
53
|
+
| Python | 3.9 or later | Package and Dash application runtime |
|
|
54
|
+
| Dash | 3.3 or later | Dash Hooks and Dev Tools APIs |
|
|
55
|
+
| Node.js | 20.19 or later, or 22.12 or later | Frontend development only |
|
|
56
|
+
| npm | Bundled with Node.js | Frontend dependency management and builds |
|
|
57
|
+
|
|
58
|
+
End users installing the Python package do not need Node.js. The distributable JavaScript and CSS files are included in the package.
|
|
59
|
+
|
|
60
|
+
## Installation
|
|
61
|
+
|
|
62
|
+
Install from PyPI:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pip install dash-devtools-plus
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
For local development, follow the [Development](#development) guide instead.
|
|
69
|
+
|
|
70
|
+
## Quick Start
|
|
71
|
+
|
|
72
|
+
Installed packages are discovered automatically through Dash's `dash_hooks` entry-point group. Import the configuration helper before constructing the Dash application when customization is required:
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
from dash import Dash, html
|
|
76
|
+
from dash_devtools_plus import configure_devtools_plus
|
|
77
|
+
|
|
78
|
+
configure_devtools_plus(
|
|
79
|
+
default_locale="en",
|
|
80
|
+
accent_color="#119DFF",
|
|
81
|
+
editor="vscode",
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
app = Dash(__name__)
|
|
85
|
+
app.layout = html.Div("Hello Dash")
|
|
86
|
+
|
|
87
|
+
if __name__ == "__main__":
|
|
88
|
+
app.run(debug=True)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Open the application and select **Devtools Plus** from the native Dash developer toolbar.
|
|
92
|
+
|
|
93
|
+
## Configuration
|
|
94
|
+
|
|
95
|
+
Call `configure_devtools_plus` before creating the `Dash` instance.
|
|
96
|
+
|
|
97
|
+
| Option | Type | Default | Description |
|
|
98
|
+
| --- | --- | --- | --- |
|
|
99
|
+
| `default_locale` | `"en" \| "zh-CN"` | `"en"` | Initial interface language. A browser-local preference takes precedence after the user switches languages. |
|
|
100
|
+
| `accent_color` | `str` | `"#119DFF"` | Accent color used by the Devtools Plus interface. |
|
|
101
|
+
| `editor` | `"vscode" \| "cursor" \| "pycharm" \| None` | `"vscode"` | Preferred editor for callback source navigation. Set to `None` to disable editor links. |
|
|
102
|
+
| `project_root` | `str \| Path \| None` | `None` | Explicit server-side project boundary used when resolving callback source files. |
|
|
103
|
+
| `editor_project_root` | `str \| Path \| None` | `None` | Client-side checkout root used when the browser and Dash server see different filesystem paths. |
|
|
104
|
+
|
|
105
|
+
For Docker, WSL, remote workspaces, or other split filesystem layouts, map the server checkout to the path visible to the local editor:
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
configure_devtools_plus(
|
|
109
|
+
project_root="/app",
|
|
110
|
+
editor_project_root=r"C:\projects\my-dash-app",
|
|
111
|
+
)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Only callback files contained by the resolved project root receive editor links. The server does not launch an editor process or accept browser-provided file paths.
|
|
115
|
+
|
|
116
|
+
## Devtools Plus Panels
|
|
117
|
+
|
|
118
|
+
| Panel | Summary | Details |
|
|
119
|
+
| --- | --- | --- |
|
|
120
|
+
| Server Resources | Live server utilization and runtime environment overview | [View details](#server-resources) |
|
|
121
|
+
| Callbacks | Searchable callback dependencies, behavior, and source metadata | [View details](#callbacks) |
|
|
122
|
+
| Component Inspector | Point-and-click DOM-to-Dash component inspection | [View details](#component-inspector) |
|
|
123
|
+
| State Snapshots | Selective component prop capture and restoration | [View details](#state-snapshots) |
|
|
124
|
+
| Component Libraries | Loaded Dash component packages, versions, and aliases | [View details](#component-libraries) |
|
|
125
|
+
| Dash Hooks | Hook plugin discovery, registration order, and diagnostics | [View details](#dash-hooks) |
|
|
126
|
+
| Toolbar Skins | Native Dash toolbar and error-display appearance presets | [View details](#toolbar-skins) |
|
|
127
|
+
|
|
128
|
+
### Server Resources
|
|
129
|
+
|
|
130
|
+
### Callbacks
|
|
131
|
+
|
|
132
|
+
### Component Inspector
|
|
133
|
+
|
|
134
|
+
### State Snapshots
|
|
135
|
+
|
|
136
|
+
### Component Libraries
|
|
137
|
+
|
|
138
|
+
### Dash Hooks
|
|
139
|
+
|
|
140
|
+
### Toolbar Skins
|
|
141
|
+
|
|
142
|
+
The **工具条换肤 / Toolbar skins** tab offers two vertically stacked, full-width choices: Dash's original style (the default) and **浮光工具岛 / Luminous Dock**, a floating translucent blue dock. Selection applies immediately to the native bottom-right debug toolbar (including its collapsed handle), error count, error list, expanded details, and Python traceback iframe. It is saved in this browser's `localStorage`. Switching back to the original style removes all theme overrides. Callback graphs and devtool behavior are unchanged.
|
|
143
|
+
|
|
144
|
+
## Security and Usage Boundary
|
|
145
|
+
|
|
146
|
+
The toolbar component and all Devtools Plus metadata routes require both Dash debug mode and the native Dev Tools UI. Requests made while this condition is not satisfied receive a generic, non-cacheable `404` response.
|
|
147
|
+
|
|
148
|
+
The development endpoints may expose callback names, project-relative source paths, installed package versions, Hook registrations, and server runtime information. They do not provide an authentication boundary of their own. Keep debug applications on a trusted machine or protected development network.
|
|
149
|
+
|
|
150
|
+
State snapshots and component inspection run in the browser. Snapshots are stored in the current tab's `sessionStorage`, and restoring props may trigger related Dash callbacks.
|
|
151
|
+
|
|
152
|
+
## Development
|
|
153
|
+
|
|
154
|
+
### Create a Conda or Mamba Environment
|
|
155
|
+
|
|
156
|
+
The simplest setup uses one Conda environment for both Python and Node.js. Installing Node.js from `conda-forge` avoids a separate system-level Node.js installation.
|
|
157
|
+
|
|
158
|
+
Using Mamba:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
mamba create -n dash-devtools-plus-dev -c conda-forge python=3.12 "nodejs>=22.12,<23"
|
|
162
|
+
conda activate dash-devtools-plus-dev
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Using Conda:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
conda create -n dash-devtools-plus-dev -c conda-forge python=3.12 "nodejs>=22.12,<23"
|
|
169
|
+
conda activate dash-devtools-plus-dev
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Verify the toolchain:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
python --version
|
|
176
|
+
node --version
|
|
177
|
+
npm --version
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Install Development Dependencies
|
|
181
|
+
|
|
182
|
+
From the repository root:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
python -m pip install -e ".[dev]"
|
|
186
|
+
npm ci
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
`npm ci` installs the exact frontend dependency versions recorded in `package-lock.json`.
|
|
190
|
+
|
|
191
|
+
### Build the Frontend
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
npm run build
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Vite writes the distributable assets to `dash_devtools_plus/assets/`. These generated JavaScript and CSS files are part of the Python package and must be committed when frontend source code changes.
|
|
198
|
+
|
|
199
|
+
For continuous frontend rebuilding:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
npm run dev
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Test the Project
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
python -m pytest
|
|
209
|
+
npm run test:frontend
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Lint and Format with Ruff
|
|
213
|
+
|
|
214
|
+
Check the Python code:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
ruff check .
|
|
218
|
+
ruff format --check .
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Apply safe lint fixes and formatting:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
ruff check . --fix
|
|
225
|
+
ruff format .
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Ruff settings, including the supported Python target and line length, are defined in `pyproject.toml`.
|
|
229
|
+
|
|
230
|
+
### Run the Demo Application
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
python examples/app.py
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Open <http://127.0.0.1:8050> and select **Devtools Plus** from the Dash developer toolbar.
|
|
237
|
+
|
|
238
|
+
The demo's **ERROR REPORTING TEST** controls can deliberately raise a Python `ZeroDivisionError` (`1 / 0`) or a clientside JavaScript `Error`. Both start dormant and require a click, making it easy to inspect the native error UI with either toolbar skin.
|
|
239
|
+
|
|
240
|
+
### Build the Python Package
|
|
241
|
+
|
|
242
|
+
Build the source distribution and wheel after rebuilding the frontend assets:
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
python -m build
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Generated package archives are written to `dist/`.
|
|
249
|
+
|
|
250
|
+
## Project Structure
|
|
251
|
+
|
|
252
|
+
```text
|
|
253
|
+
dash_devtools_plus/
|
|
254
|
+
assets/ Built JavaScript and CSS distributed with Python
|
|
255
|
+
hook_inventory.py Dash Hooks discovery and runtime inventory
|
|
256
|
+
plugin.py Hook, route, configuration, and Dev Tools registration
|
|
257
|
+
server_metrics.py Server resource sampling
|
|
258
|
+
frontend/
|
|
259
|
+
src/ React interface and browser-side diagnostics
|
|
260
|
+
tests/ Node-based frontend tests
|
|
261
|
+
examples/ Development and acceptance demo application
|
|
262
|
+
tests/ Python tests
|
|
263
|
+
package.json Frontend dependencies and scripts
|
|
264
|
+
pyproject.toml Python package and tool configuration
|
|
265
|
+
vite.config.js Frontend library build configuration
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## Architecture
|
|
269
|
+
|
|
270
|
+
- Importing the package registers its assets, metadata routes, setup hook, and Dev Tools component through the Dash Hooks registry.
|
|
271
|
+
- The setup hook binds the Dev Tools component to the owning Dash application and tracks Dash's resolved debug state.
|
|
272
|
+
- Callback, component-library, Hook-library, and server-resource data are exposed through debug-gated application routes.
|
|
273
|
+
- The React interface is compiled as an IIFE bundle and uses the React and ReactDOM instances supplied by Dash.
|
|
274
|
+
- Component inspection reads the active Dash layout through the browser component API and resolves rendered elements through their React tree.
|
|
275
|
+
- State snapshots serialize JSON-safe component props in the browser and restore them with `dash_clientside.set_props`.
|
|
276
|
+
|
|
277
|
+
## Contributing
|
|
278
|
+
|
|
279
|
+
Contributions are welcome. Before opening a pull request:
|
|
280
|
+
|
|
281
|
+
1. Update source files and rebuild frontend assets when necessary.
|
|
282
|
+
2. Run the Python and frontend test suites.
|
|
283
|
+
3. Run Ruff linting and formatting checks.
|
|
284
|
+
4. Keep generated caches, local environments, and build archives out of the commit.
|
|
285
|
+
|
|
286
|
+
## License
|
|
287
|
+
|
|
288
|
+
[MIT](./LICENSE)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""Dash Devtools Plus public API and Dash hook entry point."""
|
|
2
|
+
|
|
3
|
+
from .plugin import configure_devtools_plus, register
|
|
4
|
+
|
|
5
|
+
__version__ = "0.1.0"
|
|
6
|
+
|
|
7
|
+
# Loading the ``dash_hooks`` entry point imports this module. Registration is
|
|
8
|
+
# idempotent, so explicit imports and automatic discovery can safely coexist.
|
|
9
|
+
register()
|
|
10
|
+
|
|
11
|
+
__all__ = ["configure_devtools_plus", "register", "__version__"]
|