How to debug a 3rd-party Python package in VS Code

Viewed 5667

How to enter into imported package while debugging in VS code

As an example:

import os
import mdfreader
k123 = mdfreader.mdf("Test.mf4")

How to enter into the mdf function in the imported package

5 Answers

Depends to the IDE you are using! For example in PyCharm IDE by pressing Ctrl+B you can simply reach to the function you are calling.

Use Alt and left mouse and click the function you want to explore.
And you can edit it in keybindings.json by Ctrl+K Ctrl+S.

While debugging generaly you can step into to inspect the inner function/code.

@Brett's answer is correct. However, when trying to debug 3rd party package while running unit tests (as opposed to running a predefined launch configuration) you need to create a separate configuration entry in the launch.json:

{
  "name": "Debug Unit Test",
  "type": "python",
  "request": "test",
  "justMyCode": false,
}
Related