Debugging with girder


#1

Good morning everyone,
I am new to Girder and web development in general so I have a question that is maybe trivial:
I am used ,when coding in Python (or whatever language), to debug from the IDE or sometimes from an external debugger.
How do I achieve this with Girder ?

Example : I am coding a plugin in PyCharm, using the Swagger interface to try operations. I now want to be able to place a breakpoint, execute code step by step and inspect some variable values.

Thank you very much.
Edern


#2

What I usually do to debug Girder is to install ipdb and insert a breakpoint:

import ipdb
ipdb.set_trace()

This will stop the server when it hits this line of code and give you an ipython prompt. This also works with other terminal based debuggers like pudb.

I don’t have any experience using PyCharm or other graphical IDE’s. I suspect the challenge will be to get it to spin up the Girder server. I think there are other Girder developers who use PyCharm that may be able to give you more specific advice.


#3

Debugging With VIsual Studio Code

  1. Open up the girder folder in Visual Studio code and make sure your plugin is present in the plugins directory.
  2. Open __main__.py in the rootgirder` directory
  3. Click the Debug top menu item
  4. Click Start Debugging

You should now see girder starting up in the console. Add breakpoints to your plugin code and they should get hit. The only issue is that stepping over, into, out of will continue program execution. To get around this, place breakpoints on the fly and just click continue/the green arrow when you want to hit the next breakpoint.

I tried to do this with PyCharm and was unsuccessful.


#4

Thank you for your answers. For now, I guess I will just use vscode for debugging. I could not find a way to do trigger breakpoints in PyCharm.