Panel in Pycharm debug mode

How to run Panel app in Pycharm debug mode?

I’m not a PyCharm user. I’m a VS Code user. I think you can do what I do

Insert breakpoint()

I just insert a breakpoint() in the code then panel serve app.py --autoreload from the command line. If you are used to this workflow its quite efficient.

Use .show() instead of .servable()

If you use app.show() on your one component or template then everything works just as a normal python script. I.e. when you click debug pycharm will perform its magic and run python .... behind the scenes. If you added a breakpoint in PyCharm to some line, the debugger should stop there.

use .servable() but configure PyCharm to run python -m panel serve app.py

At least this can be done in VS Code. See FR #2833

Please upvote FR #2833 if you would like a how-to debug guide added to the Panel docs.

Thank you Marc :+1:

1 Like