dbgr-server 1.1.0.dev1__py3-none-any.whl

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.
Files changed (86) hide show
  1. dbgr_server/__init__.py +1 -0
  2. dbgr_server/__main__.py +61 -0
  3. dbgr_server/app.py +139 -0
  4. dbgr_server/constants.py +10 -0
  5. dbgr_server/routes.py +22 -0
  6. dbgr_server/static/fonts/MapleMono-NF-Bold.ttf +0 -0
  7. dbgr_server/static/fonts/MapleMono-NF-BoldItalic.ttf +0 -0
  8. dbgr_server/static/fonts/MapleMono-NF-Italic.ttf +0 -0
  9. dbgr_server/static/fonts/MapleMono-NF-Regular.ttf +0 -0
  10. dbgr_server/static/images/favicon.ico +0 -0
  11. dbgr_server/static/javascripts/dist/0d8bb5b3ee5f5dac9e44.woff2 +0 -0
  12. dbgr_server/static/javascripts/dist/16b1558858fe1064b5af.woff +0 -0
  13. dbgr_server/static/javascripts/dist/176f8f5bd5f02b3abfcf.woff2 +0 -0
  14. dbgr_server/static/javascripts/dist/18d00f739ff1e1c52db1.woff +0 -0
  15. dbgr_server/static/javascripts/dist/1b3b4f49d5b3b3fb2c20.jpg +0 -0
  16. dbgr_server/static/javascripts/dist/1ce08cfde36c0d81af5b.woff +0 -0
  17. dbgr_server/static/javascripts/dist/213eedde97d22010287c.woff +0 -0
  18. dbgr_server/static/javascripts/dist/2267169ee7270a22a963.woff +0 -0
  19. dbgr_server/static/javascripts/dist/24a9d3bbf9b715214bf5.woff +0 -0
  20. dbgr_server/static/javascripts/dist/2900d24e7347deaf65cd.woff +0 -0
  21. dbgr_server/static/javascripts/dist/2ed4651232a34d737777.woff +0 -0
  22. dbgr_server/static/javascripts/dist/37a7069dc30fc663c878.woff2 +0 -0
  23. dbgr_server/static/javascripts/dist/451d4e559d6f57cdf6a1.woff +0 -0
  24. dbgr_server/static/javascripts/dist/4674f8ded773cb03e824.eot +0 -0
  25. dbgr_server/static/javascripts/dist/498042b7fe9cd07b4fd1.woff +0 -0
  26. dbgr_server/static/javascripts/dist/49ae34d4cc6b98c00c69.woff +0 -0
  27. dbgr_server/static/javascripts/dist/51aa168dd4ba03bd83f0.woff2 +0 -0
  28. dbgr_server/static/javascripts/dist/535bc89d4af715503b01.woff2 +0 -0
  29. dbgr_server/static/javascripts/dist/53b43867955fbecc811a.woff2 +0 -0
  30. dbgr_server/static/javascripts/dist/5e7382c63da0098d634a.ttf +0 -0
  31. dbgr_server/static/javascripts/dist/640f8692dc49a19f1541.woff +0 -0
  32. dbgr_server/static/javascripts/dist/79f21d796f266ce0ea70.woff +0 -0
  33. dbgr_server/static/javascripts/dist/7d8125ff7f707231fd89.woff2 +0 -0
  34. dbgr_server/static/javascripts/dist/7f7e9cd596438fea4b02.woff2 +0 -0
  35. dbgr_server/static/javascripts/dist/7f839a8652da29745ce4.woff2 +0 -0
  36. dbgr_server/static/javascripts/dist/83bebaf37c09c7e1c3ee.woff +0 -0
  37. dbgr_server/static/javascripts/dist/865f928cbabcc9f8f2b5.woff +0 -0
  38. dbgr_server/static/javascripts/dist/870c8c1486f76054301a.woff2 +0 -0
  39. dbgr_server/static/javascripts/dist/9216be4e13fe7dbe70ef.woff2 +0 -0
  40. dbgr_server/static/javascripts/dist/9360531f9bb817f917f0.woff +0 -0
  41. dbgr_server/static/javascripts/dist/969a44e1b6fc26105bd6.woff2 +0 -0
  42. dbgr_server/static/javascripts/dist/a45108d3b34af91f9113.woff +0 -0
  43. dbgr_server/static/javascripts/dist/b1d9d9904bfca8802a63.woff +0 -0
  44. dbgr_server/static/javascripts/dist/b39a11f9a6107e57a21f.woff2 +0 -0
  45. dbgr_server/static/javascripts/dist/bac8362e7a6ea60b6983.woff +0 -0
  46. dbgr_server/static/javascripts/dist/bbbf6951525a78fff340.woff +0 -0
  47. dbgr_server/static/javascripts/dist/bc628a95b5026af0df2c.woff2 +0 -0
  48. dbgr_server/static/javascripts/dist/bd5b7a13f2c52b531a2a.woff +0 -0
  49. dbgr_server/static/javascripts/dist/bf4b4e73015a3066da91.woff +0 -0
  50. dbgr_server/static/javascripts/dist/bfe6eaec56c141a0bd72.woff2 +0 -0
  51. dbgr_server/static/javascripts/dist/c18ee39fb002ad58b6dc.woff2 +0 -0
  52. dbgr_server/static/javascripts/dist/c1f17364fee75703a7ee.woff2 +0 -0
  53. dbgr_server/static/javascripts/dist/c20d916c1a1b094c1cec.woff +0 -0
  54. dbgr_server/static/javascripts/dist/c2aa4ab115bf9c6057cb.woff2 +0 -0
  55. dbgr_server/static/javascripts/dist/c5c3959c04004102ea46.woff2 +0 -0
  56. dbgr_server/static/javascripts/dist/c64e7e354c88e613c77c.woff2 +0 -0
  57. dbgr_server/static/javascripts/dist/ca100b2be6274105bb16.woff +0 -0
  58. dbgr_server/static/javascripts/dist/cb5ad999740e9d8a8bd1.woff2 +0 -0
  59. dbgr_server/static/javascripts/dist/cc9e42999888377183f8.woff2 +0 -0
  60. dbgr_server/static/javascripts/dist/cea99d3e3e13a3a599a0.woff +0 -0
  61. dbgr_server/static/javascripts/dist/cff684e59ffb052d72cb.woff2 +0 -0
  62. dbgr_server/static/javascripts/dist/d022bc70dc1bf7b3425d.woff2 +0 -0
  63. dbgr_server/static/javascripts/dist/d97850bb044fb5584361.woff2 +0 -0
  64. dbgr_server/static/javascripts/dist/da65dcd09cdc4863ece2.woff +0 -0
  65. dbgr_server/static/javascripts/dist/dbgr.js +1463 -0
  66. dbgr_server/static/javascripts/dist/eba647ae67ba7dc20f05.woff +0 -0
  67. dbgr_server/static/javascripts/dist/f5b74d7ffcdf85b9dd60.woff2 +0 -0
  68. dbgr_server/static/javascripts/dist/ff2c5c919a01e9ddda85.woff2 +0 -0
  69. dbgr_server/static/javascripts/dist/home.js +1037 -0
  70. dbgr_server/static/libs/material-design-lite/material.indigo-red.min.css +8 -0
  71. dbgr_server/templates/_layout.html +17 -0
  72. dbgr_server/templates/dbgr.html +138 -0
  73. dbgr_server/templates/home.html +115 -0
  74. dbgr_server/utils/__init__.py +0 -0
  75. dbgr_server/utils/state.py +249 -0
  76. dbgr_server/utils/streams.py +151 -0
  77. dbgr_server/utils/technical.py +132 -0
  78. dbgr_server/views.py +298 -0
  79. dbgr_server-1.1.0.dev1.data/scripts/dbgr.server.py +105 -0
  80. dbgr_server-1.1.0.dev1.dist-info/METADATA +534 -0
  81. dbgr_server-1.1.0.dev1.dist-info/RECORD +86 -0
  82. dbgr_server-1.1.0.dev1.dist-info/WHEEL +5 -0
  83. dbgr_server-1.1.0.dev1.dist-info/licenses/LICENSE +674 -0
  84. dbgr_server-1.1.0.dev1.dist-info/top_level.txt +2 -0
  85. tests/__init__.py +0 -0
  86. tests/test_app.py +84 -0
@@ -0,0 +1,534 @@
1
+ Metadata-Version: 2.4
2
+ Name: dbgr-server
3
+ Version: 1.1.0.dev1
4
+ Summary: An improbable web debugger through WebSockets (server)
5
+ Home-page: https://github.com/arkhan/dbgr
6
+ Author: Shepilov Vladislav
7
+ Author-email: shepilov.v@protonmail.com
8
+ License: GPLv3
9
+ Platform: Any
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: Implementation :: CPython
16
+ Classifier: Topic :: Software Development :: Debuggers
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: fastapi>=0.100.0
20
+ Requires-Dist: uvicorn[standard]>=0.23.0
21
+ Requires-Dist: python-multipart>=0.0.6
22
+ Requires-Dist: httpx>=0.24.0
23
+ Requires-Dist: jinja2>=3.1.0
24
+ Requires-Dist: psutil==5.9.0
25
+ Requires-Dist: uvloop==0.16.0
26
+ Requires-Dist: pyinotify
27
+ Dynamic: author
28
+ Dynamic: author-email
29
+ Dynamic: classifier
30
+ Dynamic: description
31
+ Dynamic: description-content-type
32
+ Dynamic: home-page
33
+ Dynamic: license
34
+ Dynamic: license-file
35
+ Dynamic: platform
36
+ Dynamic: requires-dist
37
+ Dynamic: summary
38
+
39
+ # dbgr - Web Debugger
40
+
41
+ ## PyPI
42
+
43
+ [![PyPI - dbgr](https://img.shields.io/pypi/v/dbgr?label=dbgr&style=flat-square)](https://pypi.org/project/dbgr)
44
+ [![PyPI - dbgr-server](https://img.shields.io/pypi/v/dbgr-server?label=dbgr-server&style=flat-square)](https://pypi.org/project/dbgr-server)
45
+ [![Python Versions](https://img.shields.io/pypi/pyversions/dbgr-server?logo=python&style=flat-square)](https://pypi.org/project/dbgr-server)
46
+
47
+ ## GitHub
48
+
49
+ [![GitHub last commit](https://img.shields.io/github/last-commit/arkhan/dbgr?style=flat-square)](https://github.com/arkhan/dbgr/commits/master)
50
+ [![License](https://img.shields.io/github/license/arkhan/dbgr?style=flat-square)](https://github.com/arkhan/dbgr/blob/master/LICENSE)
51
+
52
+ # About this project
53
+
54
+ **dbgr** is a full featured web debugger based on a client-server architecture,
55
+ similar in spirit to [pudb](https://github.com/inducer/pudb) but running as a web
56
+ application instead of a terminal UI. It lets you step through code, inspect
57
+ locals/globals in a live tree view, set breakpoints, and evaluate Python
58
+ expressions, all from your browser.
59
+
60
+ This project is a continuation of the original [`wdb`](https://github.com/Kozea/wdb)
61
+ client/server debugger by Florian Mounier (Kozea), and of
62
+ [`wdb_server_aiohttp`](https://github.com/shepilov-vladislav/wdb_server_aiohttp),
63
+ Shepilov Vladislav's `aiohttp`-based rewrite of the original `tornado` server.
64
+ Both of those projects had gone stale (last releases several years old, built
65
+ on stacks that have since been deprecated), so **dbgr** picks up where they
66
+ left off: the server was migrated from `aiohttp` to `FastAPI`, the frontend
67
+ editor was upgraded from CodeMirror 5 to CodeMirror 6, and a pudb-style
68
+ variables/watches panel was added next to the source and console panes.
69
+
70
+ This is an actively maintained fork meant to keep the project usable on
71
+ current Python and browser versions. Contributions, bug reports, and ideas
72
+ for where to take it next are welcome — see [Contribute](#contribute) below.
73
+
74
+ # What changed from the original `wdb`/`wdb_server_aiohttp`
75
+
76
+ - `aiohttp` -> `FastAPI` / `uvicorn` server
77
+ - CodeMirror 5 -> CodeMirror 6 editor
78
+ - Added a pudb-style variables/watches panel (locals, globals, and expandable
79
+ containers) next to the source and console panes
80
+ - `tornado` -> `aiohttp` (inherited from `wdb_server_aiohttp`) -> `FastAPI`
81
+ - Coffeescript -> Typescript
82
+ - Bower -> npm/yarn
83
+ - Grunt -> Webpack
84
+ - yapf -> black
85
+ - Support for themes on any screen size
86
+ - Support for Safari
87
+ - Works without internet access (the original project required Google Fonts
88
+ from a CDN)
89
+ - Renamed packages/imports: `wdb` -> `dbgr`, `wdb.server` -> `dbgr-server`
90
+
91
+ # Description
92
+
93
+ **dbgr** is a full featured web debugger based on a client-server architecture.
94
+
95
+ The dbgr server, which is responsible for managing debugging instances along
96
+ with browser connections (through websockets), is based on
97
+ [FastAPI](https://fastapi.tiangolo.com/). The dbgr client allows step by step
98
+ debugging, in-program python code execution, code edition (based on
99
+ [CodeMirror](https://codemirror.net/)), and setting breakpoints.
100
+
101
+ Due to this architecture, all of this is fully compatible with **multithread**
102
+ and **multiprocess** programs.
103
+
104
+ **dbgr** works with Python 3. It is possible to debug a program running on
105
+ one computer with a debugging server running on another computer, inside a
106
+ web page on a third computer.
107
+
108
+ It is also possible to pause a currently running python process/thread using
109
+ code injection from the web interface (this requires `gdb` and `ptrace`
110
+ enabled).
111
+
112
+ In other words, it's a very enhanced version of `pdb` directly in your
113
+ browser, with nice features.
114
+
115
+ ## Installation
116
+
117
+ Install the server (this pulls in the web interface and the debugging
118
+ protocol server):
119
+
120
+ ```bash
121
+ $ pip install dbgr-server
122
+ ```
123
+
124
+ In each virtualenv/interpreter you want to debug, install the client:
125
+
126
+ ```bash
127
+ $ pip install dbgr
128
+ ```
129
+
130
+ (You must have the server installed and running somewhere reachable from the
131
+ process you're debugging.)
132
+
133
+ ## Quick test
134
+
135
+ To try dbgr, first start the dbgr server:
136
+
137
+ ```bash
138
+ $ dbgr.server.py &
139
+ ```
140
+
141
+ Next run:
142
+
143
+ ```bash
144
+ $ python -m dbgr your_file.py
145
+ ```
146
+
147
+ Dbgr will open a debugging window right in your browser, paused at the
148
+ beginning of your program.
149
+
150
+ You can access <http://localhost:1984/> to have an overview of the server.
151
+
152
+ NB: You have to start the server only once. Multiple debugging sessions can
153
+ be run simultaneously without problem.
154
+
155
+ This is not the only way to debug a program, see below.
156
+
157
+ ## Usage
158
+
159
+ ### Setting trace
160
+
161
+ To debug any program, with the server on, just add:
162
+
163
+ ```python
164
+ import dbgr
165
+ dbgr.set_trace()
166
+ ```
167
+
168
+ anywhere in your code. Your program will stop at the `set_trace` line (just
169
+ like `pdb`).
170
+
171
+ ### Tracing code
172
+
173
+ To inspect your code on exception, you can do the following:
174
+
175
+ ```python
176
+ from dbgr import trace
177
+ with trace():
178
+ wrong_code()
179
+ ```
180
+
181
+ Any exception during `wrong_code` will launch a debugging session.
182
+
183
+ You can also use the `start_trace()` and `stop_trace()` methods (put
184
+ `stop_trace` in a `finally` block to avoid tracing the rest of your program
185
+ after an exception).
186
+
187
+ ### Debugging web servers
188
+
189
+ dbgr provides some tools to make it work nicely with different web servers:
190
+
191
+ #### WSGI servers
192
+
193
+ For WSGI servers you can use the `DbgrMiddleware`:
194
+
195
+ ```python
196
+ from dbgr.ext import DbgrMiddleware
197
+ wsgi_app = Whatever_wsgi_server_lib()
198
+ my_app = DbgrMiddleware(wsgi_app)
199
+ my_app.serve_forever()
200
+ ```
201
+
202
+ ##### Flask
203
+
204
+ ```python
205
+ from flask import Flask
206
+ from dbgr.ext import DbgrMiddleware
207
+ app = Flask(__name__)
208
+ app.debug = True
209
+ app.wsgi_app = DbgrMiddleware(app.wsgi_app)
210
+ app.run(use_debugger=False) # Disable builtin Werkzeug debugger
211
+ ```
212
+
213
+ ##### Django
214
+
215
+ Add the middleware in your `wsgi.py`, after:
216
+
217
+ ```python
218
+ from django.core.wsgi import get_wsgi_application
219
+ application = get_wsgi_application()
220
+ ```
221
+
222
+ add:
223
+
224
+ ```python
225
+ from dbgr.ext import DbgrMiddleware
226
+ application = DbgrMiddleware(application)
227
+ ```
228
+
229
+ And in your `settings.py`, activate exception propagation:
230
+
231
+ ```python
232
+ DEBUG = True
233
+ DEBUG_PROPAGATE_EXCEPTIONS = True
234
+ ```
235
+
236
+ ##### CherryPy
237
+
238
+ ```python
239
+ import cherrypy
240
+ from dbgr.ext import DbgrMiddleware
241
+
242
+ class HelloWorld(object):
243
+ @cherrypy.expose
244
+ def index(self):
245
+ undefined_method() # This will fail
246
+ return "Hello World!"
247
+
248
+ cherrypy.config.update({'global': {'request.throw_errors': True}})
249
+ app = cherrypy.Application(HelloWorld())
250
+ app.wsgiapp.pipeline.append(('debugger', DbgrMiddleware))
251
+
252
+ cherrypy.quickstart(app)
253
+ ```
254
+
255
+ #### Tornado
256
+
257
+ In Tornado, which is not a WSGI server, you can use the `dbgr_tornado`
258
+ function, which will monkey-patch the `execute` method on `RequestHandler`s:
259
+
260
+ ```python
261
+ from dbgr.ext import dbgr_tornado
262
+ from tornado.web import Application
263
+ my_app = Application([(r"/", MainHandler)])
264
+ if options.debug:
265
+ dbgr_tornado(my_app)
266
+ my_app.listen(8888)
267
+ ```
268
+
269
+ #### Page loading time becomes slow
270
+
271
+ If dbgr slows down your application too much (tracing everything takes
272
+ time), you can start it disabled with:
273
+
274
+ ```python
275
+ my_app = DbgrMiddleware(wsgi_app, start_disabled=True) # or
276
+ dbgr_tornado(my_app, start_disabled=True)
277
+ ```
278
+
279
+ Then when you get an exception just click on the on/off button.
280
+
281
+ ## Remote debugging
282
+
283
+ You can easily do remote debugging with dbgr:
284
+
285
+ Let's say you want to run a program `p.py` on computer A and you want to
286
+ debug it on computer B.
287
+
288
+ Start the dbgr server on computer A and launch this:
289
+
290
+ ```bash
291
+ DBGR_NO_BROWSER_AUTO_OPEN=True python -m dbgr p.py
292
+ ```
293
+
294
+ And open a browser on computer B at the url given by the dbgr log.
295
+
296
+ Now you can also run the dbgr server on a computer C and run on computer A:
297
+
298
+ ```bash
299
+ DBGR_NO_BROWSER_AUTO_OPEN=True DBGR_SOCKET_SERVER=computerC.addr DBGR_SOCKET_PORT=19840 python -m dbgr p.py
300
+ ```
301
+
302
+ And go with computer B to `http://computerC/debug/session/[uuid in log]`,
303
+ where you can step into `p.py` running on computer A.
304
+
305
+ You can use different configurations. See `dbgr.server.py --help` for
306
+ changing ports on the server, and these environment variables for dbgr
307
+ instances:
308
+
309
+ ```
310
+ DBGR_SOCKET_SERVER # dbgr server host
311
+ DBGR_SOCKET_PORT # dbgr server socket port
312
+ DBGR_WEB_SERVER # dbgr server host for browser opening
313
+ DBGR_WEB_PORT # dbgr server http port
314
+ DBGR_NO_BROWSER_AUTO_OPEN # Disable automatic browser opening (needed if the browser is not on the same machine)
315
+ ```
316
+
317
+ ### Docker
318
+
319
+ If you are developing locally with [Docker](https://www.docker.com/), you can
320
+ also use dbgr to debug code running inside a container. A `Dockerfile` for
321
+ the server is included in this repo; build it locally with:
322
+
323
+ ```bash
324
+ $ docker build -t dbgr-server .
325
+ ```
326
+
327
+ The basic setup looks like this:
328
+
329
+ 1. Start the `dbgr-server` container and expose port `1984` to your host
330
+ computer; this serves the debugging web UI.
331
+ 2. Start debugging in your app container, making sure to set
332
+ `DBGR_SOCKET_SERVER` to the address of the server container, and point it
333
+ to the exposed port `19840` on that server.
334
+ 3. When a trace is reached, open up `http://<your-docker-hostname>:1984`.
335
+
336
+ Example `docker-compose.yml`, starting from
337
+ [the official example for using Docker with Django](https://docs.docker.com/compose/django/):
338
+
339
+ ```yaml
340
+ db:
341
+ image: postgres
342
+ web:
343
+ build: .
344
+ command: python manage.py runserver 0.0.0.0:8000
345
+ volumes:
346
+ - .:/code
347
+ ports:
348
+ - "8000:8000"
349
+ links:
350
+ - db
351
+ - dbgr
352
+ environment:
353
+ DBGR_SOCKET_SERVER: dbgr
354
+ DBGR_NO_BROWSER_AUTO_OPEN: True
355
+ dbgr:
356
+ image: dbgr-server
357
+ ports:
358
+ - "1984:1984"
359
+ ```
360
+
361
+ Add `dbgr` to your `requirements.txt` in your web app:
362
+
363
+ ```bash
364
+ $ echo 'dbgr' >> requirements.txt
365
+ ```
366
+
367
+ Now you can use `dbgr.set_trace()` in your python app:
368
+
369
+ ```python
370
+ # ... some code
371
+ import dbgr
372
+ dbgr.set_trace()
373
+ ```
374
+
375
+ Then rebuild your web application and start everything up again:
376
+
377
+ ```bash
378
+ $ docker-compose stop
379
+ $ docker-compose build web
380
+ $ docker-compose up
381
+ ```
382
+
383
+ Now you can access `http://<local docker server>:1984` to see the traces as
384
+ they come up in your app.
385
+
386
+ ## In browser usage
387
+
388
+ Once you are in a breakpoint or in an exception, you can eval anything you
389
+ want in the prompt under the code. Multi-lines are partially supported using
390
+ `[Shift] + [Enter]`. There is help available by clicking the top help button.
391
+
392
+ As of now, the following special commands are supported during a breakpoint:
393
+
394
+ ```
395
+ .s or [Ctrl] + [↓] or [F11] : Step into
396
+ .n or [Ctrl] + [→] or [F10] : Step over (Next)
397
+ .r or [Ctrl] + [↑] or [F9] : Step out (Return)
398
+ .c or [Ctrl] + [←] or [F8] : Continue
399
+ .u or [F7] : Until (Next over loops)
400
+ .j lineno : Jump to lineno (must be at bottom frame and in the same function)
401
+ .b arg : Set a session breakpoint, see below for what arg can be
402
+ .t arg : Set a temporary breakpoint, arg follows the same syntax as .b
403
+ .z arg : Delete existing breakpoint
404
+ .l : List active breakpoints
405
+ .f : Echo all typed commands in the current debugging session
406
+ .d expression : Dump the result of expression in a table
407
+ .w expression : Watch expression in current file (click on the name to remove)
408
+ .q : Quit
409
+ .h : Get some help
410
+ .e : Toggle file edition mode
411
+ .g : Clear prompt
412
+ .i [mime/type;]expression : Display the result in an embed; mime type is auto-detected on Linux and defaults to "text/html" otherwise
413
+ iterable!sthg : If cutter is installed, executes cut(iterable).sthg
414
+ expr >! file : Write the result of expr in file
415
+ !< file : Eval the content of file
416
+ [Enter] : Eval the current selected text on the page, useful to eval code in the source
417
+
418
+ * arg follows this syntax:
419
+ [file/module][:lineno][#function][,condition]
420
+ which means:
421
+ - [file] : Break if any line of `file` is executed
422
+ - [file]:lineno : Break on `file` at `lineno`
423
+ - [file][:lineno],condition : Break on `file` at `lineno` if `condition` is True (e.g.: i == 10)
424
+ - [file]#function : Break when inside `function`
425
+ File is always the current file by default; you can also specify a module
426
+ like `logging.config`.
427
+ ```
428
+
429
+ You can also eval a variable in the source by middle-clicking on it. You can
430
+ add/remove a breakpoint by clicking on the line number.
431
+
432
+ NB: Hotkeys with arrows are purposely not triggered in the eval prompt, to
433
+ avoid conflicts when typing.
434
+
435
+ ## Dbgr Server
436
+
437
+ To see which debugging sessions are currently open, open your browser at
438
+ <http://localhost:1984/>. You can also close crashed sessions.
439
+
440
+ From there you should also see all Python processes and their threads
441
+ running, and you can try to pause them during execution to do step by step
442
+ debugging and current variable inspection. **This is highly experimental and
443
+ requires gdb and a kernel with ptrace enabled to inject python code into a
444
+ running python process.** If you get `ptrace: Operation not permitted.` you
445
+ will have to enable it.
446
+
447
+ Depending on your system it might work with:
448
+
449
+ ```bash
450
+ $ echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
451
+ ```
452
+
453
+ Make sure that `dbgr` is installed for the python version running the
454
+ program too.
455
+
456
+ ## Importing dbgr each time is exhausting
457
+
458
+ To avoid that, you can add a `w` builtin at the beginning of your
459
+ application:
460
+
461
+ ```python
462
+ from dbgr.ext import add_w_builtin
463
+ add_w_builtin()
464
+ ```
465
+
466
+ you can now use the `w` object anywhere in your code:
467
+
468
+ ```python
469
+ my_code()
470
+ w.tf # Stop next line
471
+ doubtful_code()
472
+ ```
473
+
474
+ ```python
475
+ my_code()
476
+ with w.trace():
477
+ doubtful_code()
478
+ ```
479
+
480
+ ## Code completion
481
+
482
+ dbgr has dynamic code completion in the eval prompt thanks to
483
+ [jedi](https://github.com/davidhalter/jedi).
484
+
485
+ ## FAQ
486
+
487
+ ### In Firefox opened debugging pages are not closed when done
488
+
489
+ It's a Firefox config flag; visit `about:config` and set
490
+ `dom.allow_scripts_to_close_windows` to `true`.
491
+
492
+ ### The logs are spammed with 'parsing Python module'
493
+
494
+ If your logging configuration is set to display DEBUG logs, you may see a log
495
+ for every imported file in your project any time dbgr is active, like so:
496
+
497
+ ```
498
+ DEBUG 2017-07-16 13:15:03,772 index 49835 123145573191680 parsing Python module /project/.virtualenv/python-3.6.1/lib/python3.6/site-packages/package/file.py for indexing
499
+ ```
500
+
501
+ To silence only this message, add a config for the `importmagic` module. For
502
+ example:
503
+
504
+ ```python
505
+ LOGGING = {
506
+ ...
507
+ 'loggers': {
508
+ ...
509
+ 'importmagic.index': {
510
+ 'level': 'ERROR',
511
+ 'propagate': False,
512
+ },
513
+ },
514
+ }
515
+ ```
516
+
517
+ ## Contribute
518
+
519
+ This project picks up an old, abandoned debugger and brings it back to a
520
+ modern stack, but there's plenty left to do (see `TODO.org`): finishing the
521
+ CodeMirror 6 migration polish, expanding the variables/watches panel,
522
+ covering the frontend with unit tests, adding frontend/backend integration
523
+ tests, and multithread/multiprocess/async debugging support are all open.
524
+ All contributions are more than welcome — fork it and send a PR.
525
+
526
+ ## Author
527
+
528
+ * [Florian Mounier](http://github.com/paradoxxxzero) @ [Kozea](http://kozea.fr/) — original author of `wdb`
529
+ * [Shepilov Vladislav](https://github.com/shepilov-vladislav) — author of `wdb_server_aiohttp`
530
+ * [arkhan](https://github.com/arkhan) — current maintainer of `dbgr`
531
+
532
+ ## License
533
+
534
+ This library is licensed under GPLv3
@@ -0,0 +1,86 @@
1
+ dbgr_server/__init__.py,sha256=FV4FkzB6JMd6HgWMaHFP2UB2LHEd_X42dnVlGgQXMck,27
2
+ dbgr_server/__main__.py,sha256=rMJSFhAaVGncMvFvTkE-R8_iPxezY7K7luBW3Mr2QI8,1732
3
+ dbgr_server/app.py,sha256=femUHsdF5m0ey6Kf8PT3vO3mKVhkTnMf3tUmf8HCcoo,4287
4
+ dbgr_server/constants.py,sha256=Y39MZqezhnlsr09gDv-JO3pAzIt6y-Ew-8ZZkeJIprw,263
5
+ dbgr_server/routes.py,sha256=UdcS43P-kXiV4AJ-x68O82s7M1LuLCAkP9AHXMLK19k,687
6
+ dbgr_server/views.py,sha256=TqiiKXvA1dTUI-2ft9rRqqeZ5TcwPnCfCEeDAnDycK4,9773
7
+ dbgr_server/static/fonts/MapleMono-NF-Bold.ttf,sha256=z2-xMWBCQlfqdkpd6x1VEWyatcNHy2nGviV2tE3D1UQ,2386736
8
+ dbgr_server/static/fonts/MapleMono-NF-BoldItalic.ttf,sha256=l6QOCiXIrbLJ4p11WhJ7f66Ynev0Dp9iyj45Ox3i1Ck,2416508
9
+ dbgr_server/static/fonts/MapleMono-NF-Italic.ttf,sha256=8gAS2jpzj_BwKSquRTtfe0feOZJFGlgc1Lpvf-17l4U,2414036
10
+ dbgr_server/static/fonts/MapleMono-NF-Regular.ttf,sha256=2_FgzpY1gFakd3fpWlCvIItDgxJ4fPIJF84jIQZt6OU,2384652
11
+ dbgr_server/static/images/favicon.ico,sha256=LH4-eMWqKPpwg_NBVpTXaGi4HBDL1w6FySeqoxyexwM,15086
12
+ dbgr_server/static/javascripts/dist/0d8bb5b3ee5f5dac9e44.woff2,sha256=hoi2IEJzjro56Lwu34augykF6O4yQbVYNVJkZdnrjhs,17316
13
+ dbgr_server/static/javascripts/dist/16b1558858fe1064b5af.woff,sha256=Qlf26jIeEoLoOwU2X3Qk9eCNArmQq9GMlXaVUcMPFVM,16344
14
+ dbgr_server/static/javascripts/dist/176f8f5bd5f02b3abfcf.woff2,sha256=SMP6b4bFTx2btRkiBxPUsKH4zRpYmjwDufqC6Y7LE-M,15736
15
+ dbgr_server/static/javascripts/dist/18d00f739ff1e1c52db1.woff,sha256=byl0o5bcBpXQcehCVR56-ccvDvjS0Hb-c6UjsaPC0Oc,22020
16
+ dbgr_server/static/javascripts/dist/1b3b4f49d5b3b3fb2c20.jpg,sha256=MSXKqHpdKvHpIBpJZbIXA2h8Hrz0uVVUF_pRhnwUPyA,2047452
17
+ dbgr_server/static/javascripts/dist/1ce08cfde36c0d81af5b.woff,sha256=a37MryCxkcabdpgCvQnXPeLYEzFoyU70gvawAVlGYBo,16816
18
+ dbgr_server/static/javascripts/dist/213eedde97d22010287c.woff,sha256=iADxyWPTD9xC-Jj9fIAfEM67D1RYup0GZGUM7pffgC8,16956
19
+ dbgr_server/static/javascripts/dist/2267169ee7270a22a963.woff,sha256=gG6kbEJq-Pwk5c9CohAihzlpaTPTYpnrKK7mT2n8cfE,20356
20
+ dbgr_server/static/javascripts/dist/24a9d3bbf9b715214bf5.woff,sha256=6dy1HPiHloxh8BHzgU1GFTG18fWkT8iEZRwuZiwXSek,16968
21
+ dbgr_server/static/javascripts/dist/2900d24e7347deaf65cd.woff,sha256=I4zZ5JTr3fZKaFlQ0ZlY1X5pYskxZbbHH9Q2_FfTE4E,15564
22
+ dbgr_server/static/javascripts/dist/2ed4651232a34d737777.woff,sha256=6vGtJWqr0Qd4Iw2JFb_L96QeFoxULVCKCuR1U_tfCPs,15364
23
+ dbgr_server/static/javascripts/dist/37a7069dc30fc663c878.woff2,sha256=KfbaCowhxWgVEbubCGY9P9LF0Jyb2AVOw1TFY7jIt8E,15784
24
+ dbgr_server/static/javascripts/dist/451d4e559d6f57cdf6a1.woff,sha256=WjqYQEFHaPouyYizPJ6Wb9_-LbflYKJws6nGugHxdxg,21704
25
+ dbgr_server/static/javascripts/dist/4674f8ded773cb03e824.eot,sha256=jJmLSpwKy7n-XdVywgaloz_dXKK1jbh_w7iTvqyFBo0,143258
26
+ dbgr_server/static/javascripts/dist/498042b7fe9cd07b4fd1.woff,sha256=LfwOhoz3rjpX_Gx7XIew1Whev2RUhDCrQd6ZkEsB2bY,15160
27
+ dbgr_server/static/javascripts/dist/49ae34d4cc6b98c00c69.woff,sha256=wdyH-Zx_8iiAYRfVjwhcbFcwV_ojcigIGAK32NPPdoQ,20268
28
+ dbgr_server/static/javascripts/dist/51aa168dd4ba03bd83f0.woff2,sha256=yKstqi0P-gfjo8s8q8mM5eRzjyVn0Gh01neLYuJRciU,13776
29
+ dbgr_server/static/javascripts/dist/535bc89d4af715503b01.woff2,sha256=4f0BOsGK66wo42a_gqrOOy-2kA_sxHkzA-2Trq3TGRA,12312
30
+ dbgr_server/static/javascripts/dist/53b43867955fbecc811a.woff2,sha256=xGSqVYTED0LvoFPh7HnBMBurWhuL4rIROYqI5A2RdLk,13680
31
+ dbgr_server/static/javascripts/dist/5e7382c63da0098d634a.ttf,sha256=t_Sjq1YgSPKN0fppFgG8QzY6YdD4dtFtgxbFLk8y1pY,128180
32
+ dbgr_server/static/javascripts/dist/640f8692dc49a19f1541.woff,sha256=pMeWslDpGQhBdRYZlEQ3ew91UvPDwvj95VJlz1dmjR8,15608
33
+ dbgr_server/static/javascripts/dist/79f21d796f266ce0ea70.woff,sha256=_Xgyvzi12k7GdWy7A6ECcB6xRc2nDZ66393QuEfd-a4,16996
34
+ dbgr_server/static/javascripts/dist/7d8125ff7f707231fd89.woff2,sha256=XMLkdwHufcnguhYwPhcNsPyy3ymJt3Y6xwWJPTe04jc,17020
35
+ dbgr_server/static/javascripts/dist/7f7e9cd596438fea4b02.woff2,sha256=WGX72U7MKVzYWxvok_LWdGstTpmYM7wOoT4l2nuF2Hw,12508
36
+ dbgr_server/static/javascripts/dist/7f839a8652da29745ce4.woff2,sha256=JskepDt5sdRWaV3kaPUD4BQenrdn_hZNr4vz86EBJW8,17008
37
+ dbgr_server/static/javascripts/dist/83bebaf37c09c7e1c3ee.woff,sha256=xKG67DANCeA6g4C4WRgmfugPqujgDGxWtI4udLHZs40,57620
38
+ dbgr_server/static/javascripts/dist/865f928cbabcc9f8f2b5.woff,sha256=drBUAP_52ltDhi43EwmeORORamKVYCZe0ksZ0DEifL8,20348
39
+ dbgr_server/static/javascripts/dist/870c8c1486f76054301a.woff2,sha256=7c3z9gJSpZh77cnIa1Qi2XK6UJu75g1YklMQx0SjPig,15712
40
+ dbgr_server/static/javascripts/dist/9216be4e13fe7dbe70ef.woff2,sha256=dj3gKBXvutE6HqIkUZb5VcZtm2RNgwj0LpbktrkozA8,13512
41
+ dbgr_server/static/javascripts/dist/9360531f9bb817f917f0.woff,sha256=7sFCYI6LQX4qy25TAadQBHoE4sWmVjIjyq5JnhnqCO4,21588
42
+ dbgr_server/static/javascripts/dist/969a44e1b6fc26105bd6.woff2,sha256=iYa-Fp-Lz6CeNErkKELf7nY5R5CAQD1UB68dS0F7upU,12688
43
+ dbgr_server/static/javascripts/dist/a45108d3b34af91f9113.woff,sha256=xOrU3p96_yN9BrUw6thBPRNXQn9qkllENCu04rHc5tA,20368
44
+ dbgr_server/static/javascripts/dist/b1d9d9904bfca8802a63.woff,sha256=gIFe_jvZMXxmbfDy5tcBM14XiVT2TrHpkQP-qBwqoTc,21952
45
+ dbgr_server/static/javascripts/dist/b39a11f9a6107e57a21f.woff2,sha256=aLHHHdf0om7p4xhLWT1oiqR3UJErXi7Lc3nadIW4gA0,13496
46
+ dbgr_server/static/javascripts/dist/bac8362e7a6ea60b6983.woff,sha256=6FhvnbfAUDqYTJRK0vH3g79gUa6ioGa8If3tyP5_poo,20392
47
+ dbgr_server/static/javascripts/dist/bbbf6951525a78fff340.woff,sha256=SCjUpRuU83uZlBD0rfIn7iEjZDocM2vK3j_Yty6LkJY,15392
48
+ dbgr_server/static/javascripts/dist/bc628a95b5026af0df2c.woff2,sha256=IIzVwPHXkaFsdLWPltZRIfUPKEofZULeKS5drrmIQKs,13568
49
+ dbgr_server/static/javascripts/dist/bd5b7a13f2c52b531a2a.woff,sha256=C-Cubv2FKzaVy3p2KGCW9g6Tt9McFuC3HKNeztf96PY,22204
50
+ dbgr_server/static/javascripts/dist/bf4b4e73015a3066da91.woff,sha256=hMjwm97vR4jpSaeMV2ztK-lXjOI4-0BdfK-wP0SE0Is,16904
51
+ dbgr_server/static/javascripts/dist/bfe6eaec56c141a0bd72.woff2,sha256=gsHMq1hHAOowIg2BkBtvp01qnrrVsLwYYrmTTtayBHA,12696
52
+ dbgr_server/static/javascripts/dist/c18ee39fb002ad58b6dc.woff2,sha256=tNB4ks3nFdULtpwZgt9JY4XR39j50YZ8MfGaPIY0z64,15816
53
+ dbgr_server/static/javascripts/dist/c1f17364fee75703a7ee.woff2,sha256=NOReGchjIa_-y2MhDnjMK3BgQdwnunB0BQdngFQztf8,12488
54
+ dbgr_server/static/javascripts/dist/c20d916c1a1b094c1cec.woff,sha256=aoDZy09JtZUbQH-JBc-oh_Hj8uLsQ2m_WOrGM7LgWUg,22304
55
+ dbgr_server/static/javascripts/dist/c2aa4ab115bf9c6057cb.woff2,sha256=EoI9WFYFI4EhVUr_i7BgojXcNvN-_Z-x5-bqGpYivDU,15808
56
+ dbgr_server/static/javascripts/dist/c5c3959c04004102ea46.woff2,sha256=RKmSeSw04ibV7P9hbfTtyvqoM7qbTh-p8HJqSXePoPY,12288
57
+ dbgr_server/static/javascripts/dist/c64e7e354c88e613c77c.woff2,sha256=ngJSTr7NgT_EvLQDNrsrAzhxsf3L0jQine5BidxEhQ0,17448
58
+ dbgr_server/static/javascripts/dist/ca100b2be6274105bb16.woff,sha256=2u5j2ILVwK544vQgPgx2uLfUSRsa5lbta7g9LYT2iVs,16880
59
+ dbgr_server/static/javascripts/dist/cb5ad999740e9d8a8bd1.woff2,sha256=leYLk5GTHcTVzJs7DCiw6ydRuQZgN_dZS6dsR3OcGHs,17520
60
+ dbgr_server/static/javascripts/dist/cc9e42999888377183f8.woff2,sha256=wis5LEEOiMuTbcQenqaLb5qKVMUSQqVd39l3EepXLWc,13668
61
+ dbgr_server/static/javascripts/dist/cea99d3e3e13a3a599a0.woff,sha256=upj5kdACxr-q97h0ZS_9zekmGoaSXbh98-0oYeoICt8,20464
62
+ dbgr_server/static/javascripts/dist/cff684e59ffb052d72cb.woff2,sha256=qH1myRsufcVTCu92wDvWo9JepYJhEL9IA7VhuBHMhyY,44300
63
+ dbgr_server/static/javascripts/dist/d022bc70dc1bf7b3425d.woff2,sha256=QB5sJYAbotWXldBabdlz-VVmtBBw05ObqTB9ZYYK5Q4,17324
64
+ dbgr_server/static/javascripts/dist/d97850bb044fb5584361.woff2,sha256=aICPzIlhBLxH-wCKfhvdOXojB9eNcBkESV4VKQhEy_A,13112
65
+ dbgr_server/static/javascripts/dist/da65dcd09cdc4863ece2.woff,sha256=w8xjtbOW8Rns0GnTSqGbvKHGv8uN0BAVrivw88prAeA,15384
66
+ dbgr_server/static/javascripts/dist/dbgr.js,sha256=DPzXAiKO7QYI8vZFfn13zbjQKASgEC0D9P1dFl1PZNs,2195909
67
+ dbgr_server/static/javascripts/dist/eba647ae67ba7dc20f05.woff,sha256=hUX93VZwObgcciSUm12TAhJ2K_e5MSTrhpBdb4tSmaI,15236
68
+ dbgr_server/static/javascripts/dist/f5b74d7ffcdf85b9dd60.woff2,sha256=JDaeGyRhr53O_sr5zJPWTPIqTFusMlBhALniEBRQe88,15872
69
+ dbgr_server/static/javascripts/dist/ff2c5c919a01e9ddda85.woff2,sha256=YQGPTTotUoroMywEhDCNoAm8zUHWGcgR_P7eWQSum7k,12464
70
+ dbgr_server/static/javascripts/dist/home.js,sha256=x17WqKoG0erIS0CEYe-HedBXQQVjP5FqVQsNfIATfQQ,681475
71
+ dbgr_server/static/libs/material-design-lite/material.indigo-red.min.css,sha256=Xh7VO65rxu8eO6xmFGXgT40xX1std0WUQPrvWcR3zVY,141281
72
+ dbgr_server/templates/_layout.html,sha256=Kp7FW_trf3352hgeMWqQk-hV9P7hB3_hpCWd-2RB2Nc,473
73
+ dbgr_server/templates/dbgr.html,sha256=ODvS-lEITfw2OTWpKlPDJhIR9qCy5vKUzLiZ5m5gSVU,5332
74
+ dbgr_server/templates/home.html,sha256=8QubLMP_qKBlPungOS-VPavpsas6COMyztqieNbvDUo,4000
75
+ dbgr_server/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
76
+ dbgr_server/utils/state.py,sha256=phxoORsVgkJFUPLwHbmwEvUmz5hRK4jdaGy0oFbFihE,6628
77
+ dbgr_server/utils/streams.py,sha256=Euka76obfpmXSqQbwVhPkEq04D5eNl9Kj8pUEa7SKC4,4465
78
+ dbgr_server/utils/technical.py,sha256=KM2QcVq7DanO7Roa-AtwqHuIS3uSsVNwpX_IQTjEK6g,4327
79
+ dbgr_server-1.1.0.dev1.data/scripts/dbgr.server.py,sha256=La-OsiyVd5-194leDBlzzCsxWvYKvAmCDPXIWfgIAGA,2685
80
+ dbgr_server-1.1.0.dev1.dist-info/licenses/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
81
+ tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
82
+ tests/test_app.py,sha256=LJCEWlVTz0xjo5hcz-5JVNXuaTWBLwEwA0DUoeq1dqk,2603
83
+ dbgr_server-1.1.0.dev1.dist-info/METADATA,sha256=51SRaklAOxAq6HeLGNLJ72Dg0UTbVto9AK285yo67IE,16634
84
+ dbgr_server-1.1.0.dev1.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
85
+ dbgr_server-1.1.0.dev1.dist-info/top_level.txt,sha256=vmf37Mu_ufsT8-Z6wEPFPQbFPxkDsinOOFrn5qTqfUY,18
86
+ dbgr_server-1.1.0.dev1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+