Skip to main content

Web-PDB

Travis-CI tests PyPI version

Web-PDB is a web-interface for Python’s built-in PDB debugger. It allows to debug Python scripts remotely in a web-browser.

Features

  • Responsive design based on Bootstrap.

  • Python syntax highlighting with Prism (“Okaida” theme).

  • Supports all PDB features.

  • Standard input and output can be redirected to the web-console to interact with Python scripts remotely.

  • Current file box tracks current position in a file being executed. Red line numbers indicate breakpoints, if any.

  • Globals and Locals boxes show local and global variables in the current scope. Special variables that start and end with double underscores __ are excluded (you can always view them using PDB commands).

  • Human-readable Unicode literals for Python 2.

  • Command history that stores up to 10 last unique PDB commands (accessed by arrow UP/DOWN keys).

Web-PDB screenshot

Web-PDB console in Chrome browser

Usage

Install Web-PDB into your working Python environment:

pip install web-pdb

Insert the following line into your Python program at the point where you want to start debugging:

import web_pdb; web_pdb.set_trace()

The set_trace() call will suspend your program and open a web-UI at the default port 5555 (port value can be changed). Enter in your browser’s address bar: http://<your Python machine hostname or IP>:5555, for example http://monty-python:5555, and you should see the web-UI like the one on the preceding screenshot. Now you can use all PDB commands and features. Additional Current file, Globals and Locals information boxes help you better track your program runtime state.

Note: it is strongly recommended to work with the Web-PDB web-UI only in one browser session. With more than one browser window accessing the web-UI it can display incorrect data in one or more browser sessions.

Subsequent set_trace() calls can be used as hardcoded breakpoints.

Additionally, Web-PDB provides catch_post_mortem context manager that can catch unhandled exceptions raised within its scope and automatically start PDB post-mortem debugging session. For example:

import web_pdb

with web_pdb.catch_post_mortem():
    # Some error-prone code
    assert foo == bar, 'Oops!'

For more detailed info about the Web-PDB API read docstrings in the ./web_pdb/__init__.py file.

Considerations for Multithreading and Multiprocessing Programs

Multithreading

Web-PDB maintains one debugger instance that traces only one thread. You should not call set_trace() from different threads to avoid race conditions. Each thread needs to be debugged separately one at a time.

Multiprocessing

Each process can have its own debugger instance provided you call set_trace with a different port value for each process. This way you can debug each process in a separate browser tab/window. To simplify this you can use set_trace(port=-1) to select a random port between 32768 and 65536.

Compatibility

  • Python: 2.7, 3+

  • Browsers: Firefox, Chrome (all modern browsers should work)

License

MIT, see LICENSE.txt.

The debugger icon made by Freepik from www.flaticon.com is licensed by CC 3.0 BY.

Changelog

v.1.3.0 (2016-12-12)

  • Implemented a multi-threaded WSGI server to increase responsiveness of the web-UI.

v.1.2.2 (2016-11-03)

  • Added deflate compression for data sent to a browser.

  • Attempt to fix Current file box auto-scrolling.

v.1.2.1 (2016-10-08)

  • Logger fix.

v.1.2.0 (2016-10-03)

  • Minor UI redesign.

  • Added a quick action toolbar and hotkeys for common commands.

  • Added a quick help dialog.

  • Breakpoints can be added/deleted with a click on a line number.

  • The Currrent file box is not auto-scrolled if the current line hasn’t changed.

  • Multiple set_trace() and post_mortem() calls are processed correctly.

  • Added random web-UI port selection with port=-1.

v.1.1.0 (2016-09-24)

  • Initial PyPI release

Metadata

Release files for web-pdb 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for web-pdb 1.3.0
File Size Uploaded Provenance Actions
web-pdb-1.3.0.tar.gz 197.3 kB Without provenance Details for web-pdb-1.3.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for web-pdb 1.3.0
File Interpreter ABI Platform Actions
web_pdb-1.3.0-py3.5.egg Legacy Egg format - - Details for web_pdb-1.3.0-py3.5.egg
web_pdb-1.3.0-py2.py3-none-any.whl Python 2, Python 3 none any Details for web_pdb-1.3.0-py2.py3-none-any.whl

Total release size: 606.4 kB

Release files / web-pdb-1.3.0.tar.gz

Download URL web-pdb-1.3.0.tar.gz
Size 197.3 kB
Tags Source
SHA-256 checksum
How to use checksums
07c8df2679e22fbc3b9e18c839dd0ca28eeaeabd7e035d438736f4fa5e07dc8a
BLAKE2b-256 checksum
How to use checksums
36d5d03c2328f4b020cb766e39b8b90dfb3cf9d1b3f9a004c17d84ba763eb45f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / web_pdb-1.3.0-py3.5.egg

Download URL web_pdb-1.3.0-py3.5.egg
Size 207.3 kB
Tags Egg
SHA-256 checksum
How to use checksums
f82de5dff518b4a3445caa9421fe9e00de57e9c764e09b844f4b585a50ecc483
BLAKE2b-256 checksum
How to use checksums
95788234343218db21a0e73dc7f3ce8264c589b10729e6d14600e63233ed77b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / web_pdb-1.3.0-py2.py3-none-any.whl

Download URL web_pdb-1.3.0-py2.py3-none-any.whl
Size 201.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
2aad219eeffca94b8ab46c2286ade166a4c9e8f25c933ee2f2d25d80ae122013
BLAKE2b-256 checksum
How to use checksums
d64a2f72ee55dcb02ff94e207cd9596a8000373784da2585cfbd3ab3efee8f2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for web-pdb 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page