plotly / plotly/dash

dev tools: invoke debugger/logger ineractively

Open
#698 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature P3
Dominant language
Python
Stars
24.4k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
13

Description

Now that we have the callback graph in the dev tools UI, let's use that to enable interactive callback debugging!

  • Use clicks on a callback in the graph, and you get extra debugging of that callback. Not sure what the UI looks like to choose one, but either:
    • It becomes a breakpoint (maybe the callback circle changes from green to red?)
    • It gets a verbose logger - in Python there's https://github.com/cool-RR/PySnooper for example (callback circle turns orange?)
  • That flags this callback (based on its output list) for debugging, somewhere in the redux state.
  • When any callback is triggered, we check this state and if the requested outputs are flagged, add a key to the request like debug: ('breakpoint'|'logging')
  • On the back end, if we see such a key AND the app was run with dev_tools_ui: True (we don't want hackers to be able to hang the back end or dig into back-end code from production apps!), we invoke the specified debugger:
    • For breakpoint, wrap the callback in pdb.runcall, which starts pdb at the beginning of the function, in the server console (eventually perhaps we could pull this to the front end, but that sounds like a much bigger project). Then it's up to the user to run the debugger and allow the function to finish and return.
    • For logging we wrap the callback in the appropriate pysnooper call, capture the output, and return it with the output data, and display it in the error console.
    • @rpkyle do both of these modes have equivalents in R?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing callback graph in the dev tools UI and the callback request handling on the backend. The issue leaves the selection UI and logging details undecided; done would require choosing a breakpoint or logging interaction, carrying that choice through state and requests, and safely activating it only with dev_tools_ui enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, react
Domain
backend, devtools, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.