By default, the VS Code debugger does not step into the source code of third-party packages.
- e.g., if you use
import pandas as pdand want to step intopandassource code - or
import my_packagewhenmy_packageis installed as a package in your PYTHONPATH or site packages - the VS Code debugger - by default - will only step through
my_packageif the source code is in the the top-level root of your repo, which is not always the case. - This is troublesome if you want to debug your own package that is contained in, say, a
./srcdirectory.- E.g., say you've pip-installed your package from source in editable mode (
pip install -e .). You still want to be able to step through the code using your IDE's debugger.
- E.g., say you've pip-installed your package from source in editable mode (
- for VS Code, set
justMyCodeparameter tofalsein your debuggerlaunch.jsonconfig - in PyCharm, there is both a
Step Into My CodeandStep Intobutton (PyCharm docs) - less user-friendly but works anywhere: use
pdb
// ./.vscode/launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": false,
}
]
}